Re: systemd: root device on iscsi

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeremy Sanders wrote:

> 
> This works. I don't know whether you want to change "-m" to "-s"...

I tried changing -m to -s.

The network still tries to get shut down, despite the if statement being run 
and the exit 1 command being run. This is because the exit command only 
exits from the shell looping over the read, not the shell the script is 
executing in (I hate shells!).

I had to modify the patch to exit after the loop if the loop had exited 
internally.

This fixed version appears to work (attached).

Jeremy

-- 
http://jeremysanders.net/
--- network.orig	2011-10-25 20:23:32.000000000 +0100
+++ network	2011-11-30 14:26:20.823326251 +0000
@@ -174,11 +174,12 @@
 	[ "$EUID" != "0" ] && exit 4
   	# Don't shut the network down if root is on NFS or a network
 	# block device.
-        rootfs=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/" && $3 != "rootfs") { print $3; }}' /proc/mounts)
-        rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' /etc/mtab)
-	
-	if [[ "$rootfs" == nfs* || "$rootopts" =~ _r?netdev ]] ; then
-		exit 1
+	if ! findmnt -s -n -o fstype,options / | while read rootfs rootopts; do
+		if [[ "$rootfs" == nfs* || "$rootopts" =~ _r?netdev ]] ; then
+		    exit 1
+		fi
+	done; then
+	    exit 1
 	fi
   
   	# If this is a final shutdown/halt, check for network FS,

-- 
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux