From 5e145f4474349f18bb385cd30d21a22028fe0daf Mon Sep 17 00:00:00 2001 From: "David Kaspar [Dee'Kej]" Date: Tue, 24 Jul 2018 15:28:12 +0200 Subject: network: parsing of /proc/mounts returned This partially reverts the commit 15eaf7ece, because systemd's generated unit files might have incorrect dependencies at some circumstances, thus causing diskless nfs-clients to hang while unmounting root filesystem after '$ service network stop'. --- rc.d/init.d/network | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'rc.d/init.d') diff --git a/rc.d/init.d/network b/rc.d/init.d/network index 2834df47..1edb9884 100755 --- a/rc.d/init.d/network +++ b/rc.d/init.d/network @@ -162,11 +162,16 @@ stop) [ "$EUID" != "0" ] && exit 4 # Don't shut the network down if root or /usr is on NFS or a network # block device. - if systemctl show --property=RequiredBy -- -.mount usr.mount | grep -q 'remote-fs.target' ; then + root_fstype=$(gawk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/" && $3 != "rootfs") { print $3; }}' /proc/mounts) + usr_fstype=$(gawk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/usr" && $3 != "rootfs") { print $3; }}' /proc/mounts) + + if [[ "${root_fstype}" == nfs* || "${usr_fstype}" == nfs* ]] || systemctl show --property=RequiredBy -- -.mount usr.mount | grep -q 'remote-fs.target' ; then net_log $"rootfs or /usr is on network filesystem, leaving network up" exit 1 fi + unset root_fstype usr_fstype + # Don't shut the network down when shutting down the system if configured # as such in sysconfig if is_false "$IFDOWN_ON_SHUTDOWN"; then -- cgit v1.2.1