[arch-projects] [initscripts] [PATCH 0/3] Small style cleanup/minor tweaks
Nothing special. Mostly aesthetic changes. Tom: I pushed these to my "for-tom" branch as well. Lukas Fleischer (3): Fix indentation Small style cleanup rc.sysinit: Remove redundant command substitution arch-sysctl | 2 +- functions | 2 +- network | 4 ++-- rc.d | 8 ++++---- rc.sysinit | 6 +++--- zsh-completion | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) -- 1.7.9
Indent code using tabs (instead of spaces) in all source files. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- arch-sysctl | 2 +- rc.sysinit | 2 +- zsh-completion | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch-sysctl b/arch-sysctl index 4856df6..4c54217 100755 --- a/arch-sysctl +++ b/arch-sysctl @@ -19,7 +19,7 @@ declare -A fragments # files declared later in the sysctl_d array will override earlier # Example: `/etc/sysctl.d/foo.conf' supersedes `/usr/lib/sysctl.d/foo.conf'. for path in "${sysctl_d[@]}"; do - [[ -f $path ]] && fragments[${path##*/}]=$path + [[ -f $path ]] && fragments[${path##*/}]=$path done for path in "${fragments[@]}"; do diff --git a/rc.sysinit b/rc.sysinit index fbb1894..27ad124 100755 --- a/rc.sysinit +++ b/rc.sysinit @@ -36,7 +36,7 @@ run_hook sysinit_start bootlogd -p /run/bootlogd.pid if [[ ! -a /usr/lib ]] ; then - printf "${C_FAIL}/usr is not mounted. This is not supported.${C_OTHER}\n" + printf "${C_FAIL}/usr is not mounted. This is not supported.${C_OTHER}\n" fi if [[ ! $(grep devtmpfs /proc/filesystems) ]] ; then diff --git a/zsh-completion b/zsh-completion index 58fdfab..d860e51 100644 --- a/zsh-completion +++ b/zsh-completion @@ -28,7 +28,7 @@ _rc.d () { ;; esac ;; - esac + esac } _rc.d "$@" -- 1.7.9
* Add whitespace to arithmetic expressions. * Use boolean logic for semantically boolean variables. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- functions | 2 +- network | 4 ++-- rc.d | 8 ++++---- rc.sysinit | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/functions b/functions index 24da795..833711b 100644 --- a/functions +++ b/functions @@ -662,7 +662,7 @@ need_root() { # Quit script if it's not running by root # This can be disabled in scripts sourcing functions by setting NEED_ROOT=0 # A local call to need_root can be done to ensure part of script need root privilege -(( ${NEED_ROOT:-0} == 1 )) && need_root +(( NEED_ROOT )) && need_root # End of file # vim: set ts=2 sw=2 noet: diff --git a/network b/network index d22b5dd..faaac78 100755 --- a/network +++ b/network @@ -260,7 +260,7 @@ case "$1" in else network_up fi - if ((error == 0)); then + if (( ! error )); then add_daemon network stat_done else @@ -296,7 +296,7 @@ case "$1" in else network_down fi - if ((error == 0)); then + if (( ! error )); then stat_done else stat_fail diff --git a/rc.d b/rc.d index aed2e42..115dc05 100755 --- a/rc.d +++ b/rc.d @@ -41,10 +41,10 @@ not exist or is not executable.${C_CLEAR}\n" >&2 exit 2 fi # check filter - ((${filter[started]} == 1)) && ck_daemon "$daemon" && continue - ((${filter[stopped]} == 1)) && ! ck_daemon "$daemon" && continue - ((${filter[auto]} == 1)) && ck_autostart "$daemon" && continue - ((${filter[noauto]} == 1)) && ! ck_autostart "$daemon" && continue + (( ${filter[started]} )) && ck_daemon "$daemon" && continue + (( ${filter[stopped]} )) && ! ck_daemon "$daemon" && continue + (( ${filter[auto]} )) && ck_autostart "$daemon" && continue + (( ${filter[noauto]} )) && ! ck_autostart "$daemon" && continue new_daemons+=("$daemon") done daemons=("${new_daemons[@]}") diff --git a/rc.sysinit b/rc.sysinit index 27ad124..458239e 100755 --- a/rc.sysinit +++ b/rc.sysinit @@ -169,7 +169,7 @@ if [[ -f /etc/crypttab && $CS ]] && grep -q ^[^#] /etc/crypttab; then crypto_unlocked=0 read_crypttab do_unlock && stat_done || stat_fail # Maybe someone has LVM on an encrypted block device - (( crypto_unlocked == 1 )) && activate_vgs + (( crypto_unlocked )) && activate_vgs fi # Check filesystems -- 1.7.9
Invoke `grep -q` and check its return value instead of checking whether grep(1) produces non-empty output. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- rc.sysinit | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/rc.sysinit b/rc.sysinit index 458239e..88c72a0 100755 --- a/rc.sysinit +++ b/rc.sysinit @@ -39,7 +39,7 @@ if [[ ! -a /usr/lib ]] ; then printf "${C_FAIL}/usr is not mounted. This is not supported.${C_OTHER}\n" fi -if [[ ! $(grep devtmpfs /proc/filesystems) ]] ; then +if ! grep -q devtmpfs /proc/filesystems; then printf "${C_FAIL}Your kernel does not have devtmpfs support. This is not supported.${C_OTHER}\n" fi -- 1.7.9
participants (1)
-
Lukas Fleischer