From 180ed5359c73b3893f14f81c875768851e409b42 Mon Sep 17 00:00:00 2001 From: Michael Shigorin Date: Wed, 21 Dec 2011 12:14:03 +0200 Subject: [PATCH] "if test ..." replaced by "if [ ... ]" Fixed up the remnants of the early style mix to correspond to the proposed doc/style.txt; the rationale being that if [ ... ]; then ... ... fi is the more readable construct among itself, if test ...; then ... ... fi and [ ... ] && { ... ... } due to the condition being more distinguishable when bracketed and the body more apparent as the one inside "if" and not any other block; the less obvious difference is that the final construct of the latter form is prone to the whole script exit status being non-zero if the condition isn't met. --- features.in/Makefile | 2 +- features.in/syslinux/generate.mk | 2 +- features.in/syslinux/stage1/scripts.d/01-syslinux | 8 ++++---- sub.in/stage1/Makefile | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/features.in/Makefile b/features.in/Makefile index dad9380f..c3c00958 100644 --- a/features.in/Makefile +++ b/features.in/Makefile @@ -108,7 +108,7 @@ $(FEATURES): if [ -s "generate.mk" ]; then $(MAKE) -f generate.mk; fi; \ if type -t git >&/dev/null && \ pushd "$(BUILDDIR)/" >/dev/null; then \ - if test -n "`git status -s`"; then \ + if [ -n "`git status -s`" ]; then \ git add . && \ git commit -qam "$$feat feature generation complete"; \ fi; \ diff --git a/features.in/syslinux/generate.mk b/features.in/syslinux/generate.mk index ede97d12..256f33c3 100644 --- a/features.in/syslinux/generate.mk +++ b/features.in/syslinux/generate.mk @@ -58,7 +58,7 @@ prep: @mkdir -p $(DSTDIR) debug: - @if test -n "$(DEBUG)"; then \ + @if [ -n "$(DEBUG)" ]; then \ echo "** BOOTLOADER: $(BOOTLOADER)"; \ echo "** SYSLINUX_UI: $(SYSLINUX_UI)"; \ echo "** SYSLINUX_CFG: $(SYSLINUX_CFG)"; \ diff --git a/features.in/syslinux/stage1/scripts.d/01-syslinux b/features.in/syslinux/stage1/scripts.d/01-syslinux index f8220906..0ce58286 100755 --- a/features.in/syslinux/stage1/scripts.d/01-syslinux +++ b/features.in/syslinux/stage1/scripts.d/01-syslinux @@ -16,15 +16,15 @@ esac # copy extra files, if any SYSLINUX_FILES="$(cat .in/files.list)" -if test -n "${SYSLINUX_FILES% }"; then +if [ -n "${SYSLINUX_FILES% }" ]; then cp -a $SYSLINUX_FILES . fi # prune module-specific config snippets; skip built-in one SYSLINUX_MODULES="$(cat .in/modules.list)" -if test -n "$SYSLINUX_MODULES"; then +if [ -n "$SYSLINUX_MODULES" ]; then for module in $SYSLINUX_MODULES; do - if test "$modules" == "prompt"; then continue; fi + if [ "$modules" == "prompt" ]; then continue; fi cp -a $MODDIR/$module.c?? . || rm .in/[0-9][0-9]$module.cfg done fi @@ -33,7 +33,7 @@ fi grep -hv '^#' .in/[0-9][0-9]*.cfg > "$BOOTLOADER.cfg" # snippets are not going into the actual image -if test "$DEBUG" != 2; then rm -r .in/; fi +if [ "$DEBUG" != 2 ]; then rm -r .in/; fi # NB: there will be final macro expansion based on actual image sizes # (done by ../../scripts.d/10-propagator-ramdisk) diff --git a/sub.in/stage1/Makefile b/sub.in/stage1/Makefile index 408da5ba..adab7761 100644 --- a/sub.in/stage1/Makefile +++ b/sub.in/stage1/Makefile @@ -41,12 +41,12 @@ CHROOT_PACKAGES = $(STAGE1_PACKAGES) $(SYSTEM_PACKAGES) # NB: we pass tested squashfs options for ../install2/Makefile all: | debug prepare-workdir copy-tree run-scripts $(BUILD_PROPAGATOR) \ copy-$(BOOTLOADER) $(COPY_SQUASHCFG) pack-image $(GLOBAL_CLEAN_WORKDIR) - @if test -s $(OUTDIR)/squashcfg.mk; then \ + @if [ -s $(OUTDIR)/squashcfg.mk ]; then \ cp $(OUTDIR)/squashcfg.mk $(GLOBAL_BUILDDIR)/; \ fi debug: - @if test -n "$(GLOBAL_VERBOSE)"; then \ + @if [ -n "$(GLOBAL_VERBOSE)" ]; then \ echo "** BRANDING: $(BRANDING)"; \ echo "** IMAGE_INIT_LIST: $(IMAGE_INIT_LIST)"; \ echo "** STAGE1_PACKAGES: $(STAGE1_PACKAGES)"; \