]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
extrahd: use udev rule to mount extrahd partitions
authorArne Fitzenreiter <arne_f@ipfire.org>
Sun, 17 Sep 2023 11:58:54 +0000 (13:58 +0200)
committerArne Fitzenreiter <arne_f@ipfire.org>
Sun, 17 Sep 2023 12:10:42 +0000 (12:10 +0000)
the previous patches for
https://bugzilla.ipfire.org/show_bug.cgi?id=12863
introduce a new bug that slow devices are not mounted
at boot. So now udev calls the extrahd script with
the uuid.

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
config/extrahd/extrahd.pl
config/rootfiles/common/udev
config/udev/61-extrahd.rules [new file with mode: 0644]
lfs/udev

index 145a2a43a1c255ca7f315d4126e4eb7ce5c5f0da..cc85228d56f17ad8dc5c69e388a63535af8f5333 100644 (file)
@@ -35,10 +35,20 @@ extrahd_mount() {
        local failed=0
 
        while IFS=';' read -r device filesystem mountpoint rest; do
-               # Filter by mountpoint if set
-               if [ -n "${_mountpoint}" ] && [ "${mountpoint}" != "${_mountpoint}" ]; then
-                       continue
-               fi
+               # Filter by UUID or mountpoint
+               case "${_mountpoint}" in
+                       UUID=*)
+                               if [ "${device}" != "${_mountpoint}" ]; then
+                                       continue
+                               fi
+                               ;;
+
+                       /*)
+                               if [ -n "${_mountpoint}" ] && [ "${mountpoint}" != "${_mountpoint}" ]; then
+                                       continue
+                               fi
+                               ;;
+               esac
 
                # Check that the mountpoint starts with a slash
                if [ "${mountpoint:0:1}" != "/" ]; then
@@ -75,10 +85,20 @@ extrahd_umount() {
        local failed=0
 
        while IFS=';' read -r device filesystem mountpoint rest; do
-               # Filter by mountpoint if set
-               if [ -n "${_mountpoint}" ] && [ "${mountpoint}" != "${_mountpoint}" ]; then
-                       continue
-               fi
+               # Filter by UUID or mountpoint
+               case "${_mountpoint}" in
+                       UUID=*)
+                               if [ "${device}" != "${_mountpoint}" ]; then
+                                       continue
+                               fi
+                               ;;
+
+                       /*)
+                               if [ -n "${_mountpoint}" ] && [ "${mountpoint}" != "${_mountpoint}" ]; then
+                                       continue
+                               fi
+                               ;;
+               esac
 
                # Do not try to umount if nothing is mounted
                if ! mountpoint "${mountpoint}" &>/dev/null; then
index e5c9bd01f88ac4414453dd3c0476682652c2db8e..876ae0c5a27b6e575b03ce1c668931d510d2f70b 100644 (file)
@@ -70,6 +70,7 @@ lib/udev/rules.d/60-persistent-storage.rules
 lib/udev/rules.d/60-persistent-v4l.rules
 lib/udev/rules.d/60-sensor.rules
 lib/udev/rules.d/60-serial.rules
+lib/udev/rules.d/61-extrahd.rules
 lib/udev/rules.d/64-btrfs.rules
 lib/udev/rules.d/70-camera.rules
 lib/udev/rules.d/70-joystick.rules
diff --git a/config/udev/61-extrahd.rules b/config/udev/61-extrahd.rules
new file mode 100644 (file)
index 0000000..114f2d6
--- /dev/null
@@ -0,0 +1 @@
+ACTION=="add", SUBSYSTEM=="block", RUN+="/var/ipfire/extrahd/bin/extrahd.pl udev-event"
index eb01ae848892bdfbad802ec7d1bb661832577bb9..703d98b8624808b32dcf342949edb1f9a71f876d 100644 (file)
--- a/lfs/udev
+++ b/lfs/udev
@@ -122,6 +122,10 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        install -v -m 644 $(DIR_SRC)/config/udev/60-net.rules \
                /lib/udev/rules.d
 
+       # Install ExtraHD rules
+       install -v -m 644 $(DIR_SRC)/config/udev/61-extrahd.rules \
+               /lib/udev/rules.d
+
        # Install AQM rules
        install -v -m 644 $(DIR_SRC)/config/udev/99-aqm.rules \
                /lib/udev/rules.d