aboutsummaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
authorKurt J. Bosch <kjb-temp-2009@alpenjodel.de>2011-06-27 15:29:39 +0200
committerKurt J. Bosch <kjb-temp-2009@alpenjodel.de>2011-06-28 15:39:42 +0200
commit1f53c07a82b4b873c33884ddcbdebed2b7ee9558 (patch)
treec4cf122f96486ebed08d0d5d4c496a01cc9d8533 /functions
parent714ebaa6661be59e8d68c08bbdf09bbfb64ff210 (diff)
downloadinitscripts-1f53c07a82b4b873c33884ddcbdebed2b7ee9558.tar.xz
Refactor to get rid of simple if-constucts
Diffstat (limited to 'functions')
-rw-r--r--functions27
1 files changed, 7 insertions, 20 deletions
diff --git a/functions b/functions
index ec82c6c..4c4ca0e 100644
--- a/functions
+++ b/functions
@@ -237,11 +237,7 @@ status_stopped() {
}
ck_status() {
- if ! ck_daemon "$1"; then
- status_started
- else
- status_stopped
- fi
+ ! ck_daemon "$1" && status_started || status_stopped
}
# Return PID of $1
@@ -315,9 +311,8 @@ udevd_modprobe() {
stat_done
# Load modules from the MODULES array defined in rc.conf
- if [[ -f /proc/modules ]] && (( ${#MODULES[*]} )); then
+ [[ -f /proc/modules ]] && (( ${#MODULES[*]} )) &&
status "Loading Modules" modprobe -ab "${MODULES[@]}"
- fi
status "Waiting for UDev uevents to be processed" \
udevadm settle --timeout=${UDEV_TIMEOUT:-30}
@@ -333,11 +328,8 @@ activate_vgs() {
# Kernel 2.6.x, LVM2 groups
/sbin/modprobe -q dm-mod 2>/dev/null
stat_busy "Activating LVM2 groups"
- if /sbin/vgchange --sysinit -a y >/dev/null; then
- stat_done
- else
- stat_fail
- fi
+ /sbin/vgchange --sysinit -a y >/dev/null
+ (( $? == 0 )) && stat_done || stat_fail
}
# Arch cryptsetup packages traditionally contained the binaries
@@ -379,11 +371,7 @@ fsck_all() {
run_hook sysinit_prefsck
fsck -A -T -C$FSCK_FD -a -t "$NETFS,noopts=_netdev" $FORCEFSCK >|$FSCK_OUT 2>|$FSCK_ERR
local -r fsckret=$?
- if (( fsckret > 1 )); then
- stat_fail
- else
- stat_done
- fi
+ (( fsckret <= 1 )) && stat_done || stat_fail
run_hook sysinit_postfsck
return $fsckret
}
@@ -392,9 +380,8 @@ fsck_all() {
fsck_reboot() {
# $1 = exit code returned by fsck
# Ignore conditions 'FS errors corrected' and 'Cancelled by the user'
- if (( ($1 | 33) == 33 )); then
- return 0
- elif (( $1 & 2 )); then
+ (( ($1 | 33) == 33 )) && return 0
+ if (( $1 & 2 )); then
echo
echo "********************** REBOOT REQUIRED *********************"
echo "* *"