Subversion Repositories livecd

Rev

Rev 112 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 112 Rev 206
Line 9... Line 9...
9
#
9
#
10
 
10
 
11
NOLOCALE=1
11
NOLOCALE=1
12
. /etc/init.d/functions
12
. /etc/init.d/functions
13
 
13
 
-
 
14
UMOUNT="umount"
-
 
15
[ ! -w /etc ] && UMOUNT="umount -n"
-
 
16
 
14
action() {
17
action() {
15
   echo -n "$1 "
18
   echo -n "$1 "
16
   shift
19
   shift
17
   if [ "$BOOTUP" = "color" ]; then
20
   if [ "$BOOTUP" = "color" ]; then
18
      "$@" && echo_success || echo_failure
21
      "$@" && echo_success || echo_failure
Line 129... Line 132...
129
[ -x /sbin/hwclock ] && action $"Syncing hardware clock to system time" /sbin/hwclock $CLOCKFLAGS
132
[ -x /sbin/hwclock ] && action $"Syncing hardware clock to system time" /sbin/hwclock $CLOCKFLAGS
130
 
133
 
131
# Try to unmount tmpfs filesystems to avoid swapping them in.  Ignore failures.
134
# Try to unmount tmpfs filesystems to avoid swapping them in.  Ignore failures.
132
tmpfs=$(awk '$2 ~ /^\/($|proc|dev)/ { next; }
135
tmpfs=$(awk '$2 ~ /^\/($|proc|dev)/ { next; }
133
	     $3 == "tmpfs" { print $2; }' /proc/mounts | sort -r)
136
	     $3 == "tmpfs" { print $2; }' /proc/mounts | sort -r)
134
[ -n "$tmpfs" ] && fstab-decode umount $tmpfs 2>/dev/null
137
[ -n "$tmpfs" ] && fstab-decode $UMOUNT $tmpfs 2>/dev/null
135
 
138
 
136
# Turn off swap, then unmount file systems.
139
# Turn off swap, then unmount file systems.
137
[ -f /proc/swaps ] && SWAPS=`awk '! /^Filename/ { print $1 }' /proc/swaps`
140
[ -f /proc/swaps ] && SWAPS=`awk '! /^Filename/ { print $1 }' /proc/swaps`
138
if [ -n "$SWAPS" ]; then
141
if [ -n "$SWAPS" ]; then
139
    action $"Turning off swap: " swapoff $SWAPS
142
    action $"Turning off swap: " swapoff $SWAPS
Line 141... Line 144...
141
	if [[ "$dst" =~ "^/dev/mapper" ]] \
144
	if [[ "$dst" =~ "^/dev/mapper" ]] \
142
	    && [ "$(dmsetup status "$dst" | cut -d ' ' -f 3)" = crypt ]; then
145
	    && [ "$(dmsetup status "$dst" | cut -d ' ' -f 3)" = crypt ]; then
143
	    backdev=$(/sbin/cryptsetup status "$dst" \
146
	    backdev=$(/sbin/cryptsetup status "$dst" \
144
		| awk '$1 == "device:" { print $2 }')
147
		| awk '$1 == "device:" { print $2 }')
145
	    /sbin/cryptsetup remove "$dst"
148
	    /sbin/cryptsetup remove "$dst"
146
	    # Leave partition with a blank plain-text swap
-
 
147
	    mkswap "$backdev" > /dev/null
-
 
148
	fi
149
	fi
149
    done
150
    done
150
fi
151
fi
151
 
152
 
152
[ -x /sbin/quotaoff ] && action $"Turning off quotas: " /sbin/quotaoff -aug
153
[ -x /sbin/quotaoff ] && action $"Turning off quotas: " /sbin/quotaoff -aug
Line 168... Line 169...
168
	{print $2}' /proc/mounts \
169
	{print $2}' /proc/mounts \
169
	$"Unmounting file systems: " \
170
	$"Unmounting file systems: " \
170
	$"Unmounting file systems (retry): " \
171
	$"Unmounting file systems (retry): " \
171
	-f
172
	-f
172
 
173
 
173
[ -f /proc/bus/usb/devices ] && umount /proc/bus/usb
174
[ -f /proc/bus/usb/devices ] && $UMOUNT /proc/bus/usb
174
 
175
 
175
[ -f /etc/crypttab ] && \
176
[ -f /etc/crypttab ] && \
176
    LANG=C action $"Stopping disk encryption: " halt_crypto
177
    LANG=C action $"Stopping disk encryption: " halt_crypto
177
 
178
 
178
# remove the crash indicator flag
179
# remove the crash indicator flag
Line 181... Line 182...
181
# Try all file systems other than root, essential filesystems and RAM disks,
182
# Try all file systems other than root, essential filesystems and RAM disks,
182
# one last time.
183
# one last time.
183
awk '$2 !~ /\/(|dev|proc|selinux)$/ && $1 !~ /^\/dev\/ram/ { print $2 }' \
184
awk '$2 !~ /\/(|dev|proc|selinux)$/ && $1 !~ /^\/dev\/ram/ { print $2 }' \
184
    /proc/mounts | sort -r | \
185
    /proc/mounts | sort -r | \
185
  while read line; do
186
  while read line; do
186
    fstab-decode umount -f $line
187
    fstab-decode $UMOUNT -f $line
187
done
188
done
188
 
189
 
189
if [ -x /sbin/halt.local ]; then
190
if [ -x /sbin/halt.local ]; then
190
   /sbin/halt.local
191
   /sbin/halt.local
191
fi
192
fi