extrahd: use udev rule to mount extrahd partitions

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>
This commit is contained in:
Arne Fitzenreiter
2023-09-17 13:58:54 +02:00
parent fe2fd95a9e
commit 7c9f5f9882
4 changed files with 34 additions and 8 deletions

View 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