[Pkg-sysvinit-commits] r622 - in sysvinit/trunk/debian: .
initscripts/etc/init.d
Thomas Hood
jdthood-guest at costa.debian.org
Thu Jan 12 10:47:13 UTC 2006
Author: jdthood-guest
Date: 2006-01-12 10:47:11 +0000 (Thu, 12 Jan 2006)
New Revision: 622
Modified:
sysvinit/trunk/debian/changelog
sysvinit/trunk/debian/initscripts/etc/init.d/bootclean
sysvinit/trunk/debian/initscripts/etc/init.d/checkfs.sh
sysvinit/trunk/debian/initscripts/etc/init.d/checkroot.sh
sysvinit/trunk/debian/initscripts/etc/init.d/mountall.sh
sysvinit/trunk/debian/initscripts/etc/init.d/mountnfs.sh
sysvinit/trunk/debian/initscripts/etc/init.d/umountfs
sysvinit/trunk/debian/initscripts/etc/init.d/umountnfs.sh
sysvinit/trunk/debian/initscripts/etc/init.d/umountroot
sysvinit/trunk/debian/initscripts/etc/init.d/urandom
Log:
Change polarity of checks of VERBOSE so that the resulting status is always 0; this reduces the chances of inadvertently returning 1. Remove check for pre-2.4 kernel before running swapon in mountall.sh
Modified: sysvinit/trunk/debian/changelog
===================================================================
--- sysvinit/trunk/debian/changelog 2006-01-12 10:25:16 UTC (rev 621)
+++ sysvinit/trunk/debian/changelog 2006-01-12 10:47:11 UTC (rev 622)
@@ -1,12 +1,13 @@
-sysvinit (2.86.ds1-10~13) experimental; urgency=low
+sysvinit (2.86.ds1-10~14) experimental; urgency=low
[ Thomas Hood ]
* rcS(5): Reword
* bootclean: Adapt from old bootclean.sh; handle return status more
carefully; print diagnostic messages on failures; eliminate use of
subshells; add comments
+ * mountall.sh: Eliminate unnecessary check for pre-2.4 Linux kernel
* mountnfs.sh, mountall.sh: Choose different names for intnl. functions
- * various scripts: Make more messages depend on VERBOSE being != no
+ * various scripts: Make more messages depend on VERBOSE being != "no"
* various scripts: Handle return status more carefully
* various scripts: Eliminate unnecessary uses of subshell
* mountvirtfs -> mountkernfs.sh; mountdevsubfs -> mountdevsubfs.sh;
Modified: sysvinit/trunk/debian/initscripts/etc/init.d/bootclean
===================================================================
--- sysvinit/trunk/debian/initscripts/etc/init.d/bootclean 2006-01-12 10:25:16 UTC (rev 621)
+++ sysvinit/trunk/debian/initscripts/etc/init.d/bootclean 2006-01-12 10:47:11 UTC (rev 622)
@@ -75,14 +75,14 @@
mkflagfile /tmp/.clean || return 1
- [ "$VERBOSE" != no ] && log_action_begin_msg "Cleaning /tmp"
+ [ "$VERBOSE" = no ] || log_action_begin_msg "Cleaning /tmp"
report_err()
{
- if [ "$VERBOSE" != no ]
+ if [ "$VERBOSE" = no ]
then
+ log_failure_msg "bootclean: Failure cleaning /tmp."
+ else
log_action_end_msg 1 "bootclean: Failure cleaning /tmp"
- else
- log_failure_msg "bootclean: Failure cleaning /tmp."
fi
}
# First remove all old files...
@@ -96,27 +96,27 @@
|| { report_err ; return 1 ; }
rm -f .X*-lock \
|| { report_err ; return 1 ; }
- [ "$VERBOSE" != no ] && log_action_end_msg 0
+ [ "$VERBOSE" = no ] || log_action_end_msg 0
return 0
}
clean_lock() {
cd /var/lock || { log_failure_msg "bootclean: Could not cd to /var/lock." ; return 1 ; }
- [ "$VERBOSE" != no ] && log_action_begin_msg "Cleaning /var/lock"
+ [ "$VERBOSE" = no ] || log_action_begin_msg "Cleaning /var/lock"
report_err()
{
- if [ "$VERBOSE" != no ]
+ if [ "$VERBOSE" = no ]
then
+ log_failure_msg "bootclean: Failure cleaning /var/lock."
+ else
log_action_end_msg 1 "bootclean: Failure cleaning /var/lock"
- else
- log_failure_msg "bootclean: Failure cleaning /var/lock."
fi
}
find . ! -type d \
-print0 | xargs -0r rm -f -- \
|| { report_err ; return 1 ; }
- [ "$VERBOSE" != no ] && log_action_end_msg 0
+ [ "$VERBOSE" = no ] || log_action_end_msg 0
mkflagfile /var/lock/.clean || return 1
return 0
}
@@ -124,20 +124,20 @@
clean_run() {
cd /var/run || { log_action_end_msg 1 "bootclean: Could not cd to /var/run." ; return 1 ; }
- [ "$VERBOSE" != no ] && log_action_begin_msg "Cleaning /var/run"
+ [ "$VERBOSE" = no ] || log_action_begin_msg "Cleaning /var/run"
report_err()
{
- if [ "$VERBOSE" != no ]
+ if [ "$VERBOSE" = no ]
then
+ log_failure_msg "bootclean: Failure cleaning /var/run."
+ else
log_action_end_msg 1 "bootclean: Failure cleaning /var/run"
- else
- log_failure_msg "bootclean: Failure cleaning /var/run."
fi
}
find . ! -xtype d ! -name utmp ! -name innd.pid \
-print0 | xargs -0r rm -f -- \
|| { report_err ; return 1 ; }
- [ "$VERBOSE" != no ] && log_action_end_msg 0
+ [ "$VERBOSE" = no ] || log_action_end_msg 0
mkflagfile /var/run/.clean || return 1
return 0
}
Modified: sysvinit/trunk/debian/initscripts/etc/init.d/checkfs.sh
===================================================================
--- sysvinit/trunk/debian/initscripts/etc/init.d/checkfs.sh 2006-01-12 10:25:16 UTC (rev 621)
+++ sysvinit/trunk/debian/initscripts/etc/init.d/checkfs.sh 2006-01-12 10:47:11 UTC (rev 622)
@@ -25,7 +25,7 @@
on_ac_power >/dev/null 2>&1
if [ $? -eq 1 ]
then
- [ "$VERBOSE" != no ] && log_success_msg "Running on battery power, so skipping file system check."
+ [ "$VERBOSE" = no ] || log_success_msg "Running on battery power, so skipping file system check."
BAT=yes
fi
fi
@@ -70,8 +70,19 @@
sleep 5
fi
}
- if [ "$VERBOSE" != no ]
+ if [ "$VERBOSE" = no ]
then
+ log_action_begin_msg "Checking file systems"
+ logsave -s $FSCK_LOGFILE fsck $spinner -R -A $fix $force $FSCKTYPES_OPT
+ FSCKCODE=$?
+ if [ "$FSCKCODE" -gt 1 ]
+ then
+ log_action_end_msg 1 "code $FSCKCODE"
+ handle_failed_fsck
+ else
+ log_action_end_msg 0
+ fi
+ else
if [ "$FSCKTYPES" ]
then
log_action_msg "Will now check all file systems of types $FSCKTYPES"
@@ -87,17 +98,6 @@
log_success_msg "Done checking file systems.
A log is being saved in ${FSCK_LOGFILE} if that location is writable."
fi
- else
- log_action_begin_msg "Checking file systems"
- logsave -s $FSCK_LOGFILE fsck $spinner -R -A $fix $force $FSCKTYPES_OPT
- FSCKCODE=$?
- if [ "$FSCKCODE" -gt 1 ]
- then
- log_action_end_msg 1 "code $FSCKCODE"
- handle_failed_fsck
- else
- log_action_end_msg 0
- fi
fi
fi
rm -f /fastboot /forcefsck
Modified: sysvinit/trunk/debian/initscripts/etc/init.d/checkroot.sh
===================================================================
--- sysvinit/trunk/debian/initscripts/etc/init.d/checkroot.sh 2006-01-12 10:25:16 UTC (rev 621)
+++ sysvinit/trunk/debian/initscripts/etc/init.d/checkroot.sh 2006-01-12 10:47:11 UTC (rev 622)
@@ -117,7 +117,7 @@
Linux:2.[0123].*)
if [ "$swap_on_md" = yes ] && grep -qs resync /proc/mdstat
then
- [ "$VERBOSE" != no ] && log_warning_msg "Not activating swap because RAID array is resyncing."
+ [ "$VERBOSE" = no ] || log_warning_msg "Not activating swap because RAID array is resyncing."
else
doswap=yes
fi
@@ -128,8 +128,12 @@
esac
if [ "$doswap" = yes ]
then
- if [ "$VERBOSE" != no ]
+ if [ "$VERBOSE" = no ]
then
+ log_action_begin_msg "Activating swap"
+ swapon -a -e >/dev/null 2>&1
+ log_action_end_msg $?
+ else
log_action_msg "Will now activate swap"
swapon -a
ES=$?
@@ -139,10 +143,6 @@
else
log_failure_msg "Swap activation failed with error code ${ES}."
fi
- else
- log_action_begin_msg "Activating swap"
- swapon -a >/dev/null 2>&1
- log_action_end_msg $?
fi
fi
@@ -191,7 +191,7 @@
log_failure_msg "Attempt to start maintenance shell failed. Will reboot in 5 seconds."
sleep 5
fi
- [ "$VERBOSE" != no ] && log_action_msg "Will now request reboot"
+ [ "$VERBOSE" = no ] || log_action_msg "Will now request reboot"
reboot -f
fi
@@ -272,27 +272,27 @@
spinner=""
fi
- if [ "$VERBOSE" != no ]
+ if [ "$VERBOSE" = no ]
then
- log_action_msg "Will now check root file system"
- logsave -s $FSCK_LOGFILE fsck $spinner $force $fix -V -t $roottype $rootdev
+ log_action_begin_msg "Checking root file system"
+ logsave -s $FSCK_LOGFILE fsck $spinner $force $fix -t $roottype $rootdev
FSCKCODE=$?
if [ "$FSCKCODE" = 0 ]
then
- log_success_msg "Done checking root file system. Log saved in ${FSCK_LOGFILE}."
+ log_action_end_msg 0
else
- log_failure_msg "Root file system check failed with error code ${FSCKCODE}.
-A log is being saved in ${FSCK_LOGFILE} if that location is writable."
+ log_action_end_msg 1 "code $FSCKCODE"
fi
else
- log_action_begin_msg "Checking root file system"
- logsave -s $FSCK_LOGFILE fsck $spinner $force $fix -t $roottype $rootdev
+ log_action_msg "Will now check root file system"
+ logsave -s $FSCK_LOGFILE fsck $spinner $force $fix -V -t $roottype $rootdev
FSCKCODE=$?
if [ "$FSCKCODE" = 0 ]
then
- log_action_end_msg 0
+ log_success_msg "Done checking root file system. Log saved in ${FSCK_LOGFILE}."
else
- log_action_end_msg 1 "code $FSCKCODE"
+ log_failure_msg "Root file system check failed with error code ${FSCKCODE}.
+A log is being saved in ${FSCK_LOGFILE} if that location is writable."
fi
fi
fi
@@ -323,7 +323,7 @@
log_failure_msg "Attempt to start maintenance shell failed. Will reboot in 5 seconds."
sleep 5
fi
- [ "$VERBOSE" != no ] && log_action_msg "Will now request reboot"
+ [ "$VERBOSE" = no ] || log_action_msg "Will now request reboot"
reboot -f
elif [ "$FSCKCODE" -gt 1 ]
then
@@ -331,7 +331,7 @@
but requested that the system be rebooted."
log_warning_msg "The system will be rebooted in 5 seconds."
sleep 5
- [ "$VERBOSE" != no ] && log_action_msg "Will now request reboot"
+ [ "$VERBOSE" = no ] || log_action_msg "Will now request reboot"
reboot -f
fi
Modified: sysvinit/trunk/debian/initscripts/etc/init.d/mountall.sh
===================================================================
--- sysvinit/trunk/debian/initscripts/etc/init.d/mountall.sh 2006-01-12 10:25:16 UTC (rev 621)
+++ sysvinit/trunk/debian/initscripts/etc/init.d/mountall.sh 2006-01-12 10:47:11 UTC (rev 622)
@@ -31,27 +31,27 @@
mount_all() { mount -av -t nonfs,nonfs4,nosmbfs,nocifs,noncp,noncpfs,nocoda,noocfs2,nogfs ; }
- if [ "$VERBOSE" != no ]
+ if [ "$VERBOSE" = no ]
then
- log_action_msg "Will now mount local filesystems"
- mount_all
+ log_action_begin_msg "Mounting local filesystems"
+ MOUNT_OUT="$(LC_ALL=C mount_all)"
ES=$?
+ echo "$MOUNT_OUT" | sed -e '/already mounted/d' -e '/nothing was mounted/d'
if [ 0 = "$ES" ] || [ 96 = "$ES" ] || [ 64 = "$ES" ]
then
- log_success_msg "Done mounting local filesystems."
+ log_action_end_msg 0
else
- log_failure_msg "Mounting local filesystems failed with error code ${ES}."
+ log_action_end_msg 1 "code $ES"
fi
else
- log_action_begin_msg "Mounting local filesystems"
- MOUNT_OUT="$(LC_ALL=C mount_all)"
+ log_action_msg "Will now mount local filesystems"
+ mount_all
ES=$?
- echo "$MOUNT_OUT" | sed -e '/already mounted/d' -e '/nothing was mounted/d'
if [ 0 = "$ES" ] || [ 96 = "$ES" ] || [ 64 = "$ES" ]
then
- log_action_end_msg 0
+ log_success_msg "Done mounting local filesystems."
else
- log_action_end_msg 1 "code $ES"
+ log_failure_msg "Mounting local filesystems failed with error code ${ES}."
fi
fi
@@ -79,19 +79,9 @@
# Execute swapon command again, in case we want to swap to
# a file on a now mounted filesystem.
#
- doswap=yes
- case "$(uname -sr)" in
- Linux\ 2.[0123].*)
- if grep -qs resync /proc/mdstat
- then
- doswap=no
- fi
- ;;
- esac
- if [ "$doswap" = yes ]
- then
- swapon -a -e
- fi
+ [ "$VERBOSE" = no ] || log_action_begin_msg "Activating swapfile swap"
+ swapon -a -e
+ [ "$VERBOSE" = no ] || log_action_end_msg $?
}
case "$1" in
Modified: sysvinit/trunk/debian/initscripts/etc/init.d/mountnfs.sh
===================================================================
--- sysvinit/trunk/debian/initscripts/etc/init.d/mountnfs.sh 2006-01-12 10:25:16 UTC (rev 621)
+++ sysvinit/trunk/debian/initscripts/etc/init.d/mountnfs.sh 2006-01-12 10:47:11 UTC (rev 622)
@@ -104,27 +104,27 @@
# the problem of mount reporting an error status when
# some filesystems are already mounted.
- if [ "$VERBOSE" != no ]
+ if [ "$VERBOSE" = no ]
then
- log_action_msg "Will now mount remote filesystems"
- mount_all_nfs
+ log_action_begin_msg "Mounting remote filesystems"
+ MOUNT_OUT="$(LC_ALL=C mount_all_nfs)"
ES=$?
+ echo "$MOUNT_OUT" | sed -e '/already mounted/d' -e '/nothing was mounted/d'
if [ 0 = "$ES" ] || [ 96 = "$ES" ] || [ 64 = "$ES" ]
then
- log_success_msg "Done mounting remote filesystems."
+ log_action_end_msg 0
else
- log_failure_msg "Mounting remote filesystems failed with error code ${ES}."
+ log_action_end_msg 1 "code $ES"
fi
else
- log_action_begin_msg "Mounting remote filesystems"
- MOUNT_OUT="$(LC_ALL=C mount_all_nfs)"
+ log_action_msg "Will now mount remote filesystems"
+ mount_all_nfs
ES=$?
- echo "$MOUNT_OUT" | sed -e '/already mounted/d' -e '/nothing was mounted/d'
if [ 0 = "$ES" ] || [ 96 = "$ES" ] || [ 64 = "$ES" ]
then
- log_action_end_msg 0
+ log_success_msg "Done mounting remote filesystems."
else
- log_action_end_msg 1 "code $ES"
+ log_failure_msg "Mounting remote filesystems failed with error code ${ES}."
fi
fi
fi
Modified: sysvinit/trunk/debian/initscripts/etc/init.d/umountfs
===================================================================
--- sysvinit/trunk/debian/initscripts/etc/init.d/umountfs 2006-01-12 10:25:16 UTC (rev 621)
+++ sysvinit/trunk/debian/initscripts/etc/init.d/umountfs 2006-01-12 10:47:11 UTC (rev 622)
@@ -23,17 +23,17 @@
#
# Generally /dev is still in use at this point; we want to ignore
# the error message and error code about that.
- [ "$VERBOSE" != no ] && log_action_begin_msg "Unmounting temporary filesystems"
+ [ "$VERBOSE" = no ] || log_action_begin_msg "Unmounting temporary filesystems"
umount -a -t tmpfs 9>&2 2>&1 1>&9 | grep -v '/dev: device is busy' 9>&2 2>&1 1>&9
- [ "$VERBOSE" != no ] && log_action_end_msg 0
+ [ "$VERBOSE" = no ] || log_action_end_msg 0
- [ "$VERBOSE" != no ] && log_action_begin_msg "Deactivating swap"
+ [ "$VERBOSE" = no ] || log_action_begin_msg "Deactivating swap"
swapoff -a >/dev/null
ES=$?
- [ "$VERBOSE" != no ] && log_action_end_msg $ES
+ [ "$VERBOSE" = no ] || log_action_end_msg $ES
# Umount all filesystems except root and the virtual ones
- [ "$VERBOSE" != no ] && log_action_begin_msg "Unmounting local filesystems"
+ [ "$VERBOSE" = no ] || log_action_begin_msg "Unmounting local filesystems"
# List all mounts, deepest mount point first
LC_ALL=C sort -r -k 2 /proc/mounts |
@@ -59,7 +59,7 @@
)
ES=$?
- [ "$VERBOSE" != no ] && log_action_end_msg $ES
+ [ "$VERBOSE" = no ] || log_action_end_msg $ES
}
case "$1" in
Modified: sysvinit/trunk/debian/initscripts/etc/init.d/umountnfs.sh
===================================================================
--- sysvinit/trunk/debian/initscripts/etc/init.d/umountnfs.sh 2006-01-12 10:25:16 UTC (rev 621)
+++ sysvinit/trunk/debian/initscripts/etc/init.d/umountnfs.sh 2006-01-12 10:47:11 UTC (rev 622)
@@ -36,7 +36,7 @@
# Remove bootclean flag files (precaution against symlink attacks)
rm -f /tmp/.clean /var/lock/.clean /var/run/.clean
- [ "$VERBOSE" != no ] && log_action_begin_msg "Unmounting remote and non-toplevel virtual filesystems"
+ [ "$VERBOSE" = no ] || log_action_begin_msg "Unmounting remote and non-toplevel virtual filesystems"
#
# Make list of points to unmount in reverse order of their creation
@@ -70,7 +70,7 @@
fi
ES=$?
- [ "$VERBOSE" != no ] && log_action_end_msg $ES
+ [ "$VERBOSE" = no ] || log_action_end_msg $ES
}
case "$1" in
Modified: sysvinit/trunk/debian/initscripts/etc/init.d/umountroot
===================================================================
--- sysvinit/trunk/debian/initscripts/etc/init.d/umountroot 2006-01-12 10:25:16 UTC (rev 621)
+++ sysvinit/trunk/debian/initscripts/etc/init.d/umountroot 2006-01-12 10:47:11 UTC (rev 622)
@@ -14,7 +14,7 @@
. /lib/lsb/init-functions
do_stop () {
- [ "$VERBOSE" != no ] && log_action_begin_msg "Mounting root filesystem read-only"
+ [ "$VERBOSE" = no ] || log_action_begin_msg "Mounting root filesystem read-only"
MOUNT_FORCE_OPT=
[ "$(uname -s)" = "GNU/kFreeBSD" ] && MOUNT_FORCE_OPT=-f
# This:
@@ -25,7 +25,7 @@
|| mount $MOUNT_FORCE_OPT -n -o remount,ro dummydev / 2>/dev/null \
|| mount $MOUNT_FORCE_OPT -n -o remount,ro / 2>/dev/null
ES=$?
- [ "$VERBOSE" != no ] && log_action_end_msg $ES
+ [ "$VERBOSE" = no ] || log_action_end_msg $ES
}
case "$1" in
Modified: sysvinit/trunk/debian/initscripts/etc/init.d/urandom
===================================================================
--- sysvinit/trunk/debian/initscripts/etc/init.d/urandom 2006-01-12 10:25:16 UTC (rev 621)
+++ sysvinit/trunk/debian/initscripts/etc/init.d/urandom 2006-01-12 10:47:11 UTC (rev 622)
@@ -22,7 +22,7 @@
case "$1" in
start|"")
- [ "$VERBOSE" != no ] && log_action_begin_msg "Initializing random number generator"
+ [ "$VERBOSE" = no ] || log_action_begin_msg "Initializing random number generator"
# Load and then save $POOLSIZE bytes,
# which is the size of the entropy pool
if [ -f "$SAVEDFILE" ]
@@ -41,16 +41,16 @@
dd if=/dev/urandom of=$SAVEDFILE bs=$POOLSIZE count=1 >/dev/null 2>&1
ES=$?
umask 022
- [ "$VERBOSE" != no ] && log_action_end_msg $ES
+ [ "$VERBOSE" = no ] || log_action_end_msg $ES
;;
stop)
# Carry a random seed from shut-down to start-up;
# see documentation in linux/drivers/char/random.c
- [ "$VERBOSE" != no ] && log_action_begin_msg "Saving random seed"
+ [ "$VERBOSE" = no ] || log_action_begin_msg "Saving random seed"
umask 077
dd if=/dev/urandom of=$SAVEDFILE bs=$POOLSIZE count=1 >/dev/null 2>&1
ES=$?
- [ "$VERBOSE" != no ] && log_action_end_msg $ES
+ [ "$VERBOSE" = no ] || log_action_end_msg $ES
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
More information about the Pkg-sysvinit-commits
mailing list