aboutsummaryrefslogtreecommitdiffstats
path: root/rc.d/init.d/halt
diff options
context:
space:
mode:
authorHarald Hoyer <harald@redhat.com>2008-09-16 10:23:22 +0200
committerHarald Hoyer <harald@redhat.com>2008-09-16 10:38:10 +0200
commit941a2a83127f206aa46c0e55cc57eada091c7abe (patch)
treeac107299def96bfd60aab71cdfdcaf69c5f5b5eb /rc.d/init.d/halt
parent58ddef0ad76b02840d6cf8babb0d036f1a1f1c83 (diff)
downloadinitscripts-941a2a83127f206aa46c0e55cc57eada091c7abe.tar
initscripts-941a2a83127f206aa46c0e55cc57eada091c7abe.tar.gz
initscripts-941a2a83127f206aa46c0e55cc57eada091c7abe.tar.bz2
initscripts-941a2a83127f206aa46c0e55cc57eada091c7abe.tar.xz
initscripts-941a2a83127f206aa46c0e55cc57eada091c7abe.zip
https://bugzilla.redhat.com/show_bug.cgi?id=433702
Changes to init scripts to better support stateless: --rc.sysinit-- - don't update mtab in a r/o root - mount on sys and /dev/pts returns EBUSY on a readonly root - [ -n $CLIENTSTATE ] is always returning true, causing an unnecessary timeout --network-- - /etc/mtab may not have any mount information in the readonly-root cause, but the root mount is likely to be a network mount. Without this, nfs hangs the reboot process. --halt-- - don't try and update a read-only mtab --rwtab-- - /var/empty/sshd/etc/localtime needs to be overwritten by sshd at startup - /var/lib/random-seed is written to at shutdown; this fixes the error but doesn't return the functionality lost in a r/o /var/lib.
Diffstat (limited to 'rc.d/init.d/halt')
-rwxr-xr-xrc.d/init.d/halt9
1 files changed, 6 insertions, 3 deletions
diff --git a/rc.d/init.d/halt b/rc.d/init.d/halt
index 2e5d8150..3242491a 100755
--- a/rc.d/init.d/halt
+++ b/rc.d/init.d/halt
@@ -11,6 +11,9 @@
NOLOCALE=1
. /etc/init.d/functions
+UMOUNT="umount"
+[ ! -w /etc ] && UMOUNT="umount -n"
+
action() {
echo -n "$1 "
shift
@@ -131,7 +134,7 @@ esac
# Try to unmount tmpfs filesystems to avoid swapping them in. Ignore failures.
tmpfs=$(awk '$2 ~ /^\/($|proc|dev)/ { next; }
$3 == "tmpfs" { print $2; }' /proc/mounts | sort -r)
-[ -n "$tmpfs" ] && fstab-decode umount $tmpfs 2>/dev/null
+[ -n "$tmpfs" ] && fstab-decode $UMOUNT $tmpfs 2>/dev/null
# Turn off swap, then unmount file systems.
[ -f /proc/swaps ] && SWAPS=`awk '! /^Filename/ { print $1 }' /proc/swaps`
@@ -170,7 +173,7 @@ LANG=C __umount_loop '$2 ~ /^\/$|^\/proc|^\/dev/{next}
$"Unmounting file systems (retry): " \
-f
-[ -f /proc/bus/usb/devices ] && umount /proc/bus/usb
+[ -f /proc/bus/usb/devices ] && $UMOUNT /proc/bus/usb
[ -f /etc/crypttab ] && \
LANG=C action $"Stopping disk encryption: " halt_crypto
@@ -183,7 +186,7 @@ rm -f /.autofsck
awk '$2 !~ /\/(|dev|proc|selinux)$/ && $1 !~ /^\/dev\/ram/ { print $2 }' \
/proc/mounts | sort -r | \
while read line; do
- fstab-decode umount -f $line
+ fstab-decode $UMOUNT -f $line
done
if [ -x /sbin/halt.local ]; then