From 7cf528f0ca95be55d6ae69d61d8316a06492f1dc Mon Sep 17 00:00:00 2001 From: art-latal Date: Mon, 10 Aug 2026 14:24:09 +0200 Subject: [PATCH] Added support for NO_UMOUNTS variable from localmount also to netmount (and conf.d/mount-ro, as init.d/mount-ro supports this variable). --- conf.d/mount-ro | 3 +++ conf.d/netmount | 4 ++++ init.d/netmount.in | 8 +++++++- 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 conf.d/mount-ro diff --git a/conf.d/mount-ro b/conf.d/mount-ro new file mode 100644 index 000000000..e3361da30 --- /dev/null +++ b/conf.d/mount-ro @@ -0,0 +1,3 @@ +# Stop the unmounting of certain points. +# This could be useful for some NFS related work. +#no_umounts="/dir1:/var/dir2" diff --git a/conf.d/netmount b/conf.d/netmount index e759adf10..34103928a 100644 --- a/conf.d/netmount +++ b/conf.d/netmount @@ -45,3 +45,7 @@ rc_need="net" # netmount will fail. # By default, this is empty. #critical_mounts="/home /var" +# +# Stop the unmounting of certain points. +# This could be useful for some NFS related work. +#no_umounts="/dir1:/var/dir2" diff --git a/init.d/netmount.in b/init.d/netmount.in index 5e285dfca..844ceee52 100644 --- a/init.d/netmount.in +++ b/init.d/netmount.in @@ -78,7 +78,13 @@ stop() fs="$fs${fs:+|}$x" done [ -n "$fs" ] && fs="^($fs)$" - do_unmount -- ${fs:+--fstype-regex} $fs --netdev + local IFS="$IFS:" no_umounts_r= + for x in $no_umounts; do + no_umounts_r="$no_umounts_r${no_umounts_r:+|}$x" + done + [ -n "$no_umounts_r" ] && no_umounts_r="^($no_umounts_r)$" + do_unmount umount ${no_umounts_r:+--skip-point-regex} $no_umounts_r \ + ${fs:+--fstype-regex} $fs --netdev retval=$? eoutdent