diff --git a/README.md b/README.md index 8732a244..1074695c 100644 --- a/README.md +++ b/README.md @@ -370,12 +370,14 @@ Ramdisk elements support the following files in their element directories: * udev.d : udev rules files that will be copied into the ramdisk. -### Whitespace Rules +### Element coding standard ### -- lines should not include trailing whitespace -- there should be no hard tabs in the file +- lines should not include trailing whitespace. +- there should be no hard tabs in the file. - indents are 4 spaces, and all indentation should be some multiple of - them + them. +- `do` and `then` keywords should be on the same line as the if, while or + for conditions. Global image-build variables ---------------------------- diff --git a/bin/disk-image-create b/bin/disk-image-create index 90b5ef9a..03333b46 100755 --- a/bin/disk-image-create +++ b/bin/disk-image-create @@ -26,8 +26,7 @@ export DIB_ENV=$(export | grep ' DIB_.*=') SCRIPTNAME=$(basename $0) SCRIPT_HOME=$(dirname $0) -if [ -d $SCRIPT_HOME/../share/diskimage-builder ] -then +if [ -d $SCRIPT_HOME/../share/diskimage-builder ]; then export _PREFIX=$SCRIPT_HOME/../share/diskimage-builder else export _PREFIX=$SCRIPT_HOME/.. diff --git a/bin/disk-image-get-kernel b/bin/disk-image-get-kernel index 7fa6785f..a4796692 100755 --- a/bin/disk-image-get-kernel +++ b/bin/disk-image-get-kernel @@ -18,8 +18,7 @@ set -e SCRIPTNAME=$(basename $0) SCRIPT_HOME=$(dirname $0) -if [ -d $SCRIPT_HOME/../share/diskimage-builder ] -then +if [ -d $SCRIPT_HOME/../share/diskimage-builder ]; then export _PREFIX=$SCRIPT_HOME/../share/diskimage-builder else export _PREFIX=$SCRIPT_HOME/.. diff --git a/elements/dpkg/cleanup.d/40-unblock-daemons b/elements/dpkg/cleanup.d/40-unblock-daemons index b9712fd3..b60960e7 100755 --- a/elements/dpkg/cleanup.d/40-unblock-daemons +++ b/elements/dpkg/cleanup.d/40-unblock-daemons @@ -7,8 +7,7 @@ set -o pipefail sudo mv $TARGET_ROOT/sbin/start-stop-daemon.REAL $TARGET_ROOT/sbin/start-stop-daemon -if [ -f $TARGET_ROOT/sbin/initctl.REAL ] -then +if [ -f $TARGET_ROOT/sbin/initctl.REAL ]; then sudo mv $TARGET_ROOT/sbin/initctl.REAL $TARGET_ROOT/sbin/initctl fi diff --git a/elements/dpkg/root.d/99-block-daemons b/elements/dpkg/root.d/99-block-daemons index 4663013f..adb673d9 100755 --- a/elements/dpkg/root.d/99-block-daemons +++ b/elements/dpkg/root.d/99-block-daemons @@ -14,8 +14,7 @@ echo "Warning: Fake start-stop-daemon called, doing nothing" EOF sudo chmod 755 $TARGET_ROOT/sbin/start-stop-daemon -if [ -f $TARGET_ROOT/sbin/initctl ] -then +if [ -f $TARGET_ROOT/sbin/initctl ]; then sudo mv $TARGET_ROOT/sbin/initctl $TARGET_ROOT/sbin/initctl.REAL sudo dd of=$TARGET_ROOT/sbin/initctl <> $rc_local else echo "rm \$0" >> $rc_local diff --git a/elements/rhel/pre-install.d/00-rhsm b/elements/rhel/pre-install.d/00-rhsm index 70410c05..db1dd24d 100755 --- a/elements/rhel/pre-install.d/00-rhsm +++ b/elements/rhel/pre-install.d/00-rhsm @@ -5,8 +5,7 @@ set -o pipefail export DIB_RHSM_USER=${DIB_RHSM_USER:-} -if [ -n "$DIB_RHSM_USER" ] && [ -n "$DIB_RHSM_PASSWORD" ] -then +if [ -n "$DIB_RHSM_USER" ] && [ -n "$DIB_RHSM_PASSWORD" ] ; then opts="--force" if [[ -n "$DIB_SAT_KEY" ]]; then opts="$opts --activationkey ${DIB_SAT_KEY}" diff --git a/lib/common-functions b/lib/common-functions index ac66b5a8..c9efe893 100644 --- a/lib/common-functions +++ b/lib/common-functions @@ -275,8 +275,7 @@ function create_base () { sudo touch $TMP_MOUNT_PATH/etc/resolv.conf sudo chmod 777 $TMP_MOUNT_PATH/etc/resolv.conf # use system configured resolv.conf if available to support internal proxy resolving - if [ -e /etc/resolv.conf ] - then + if [ -e /etc/resolv.conf ]; then cat /etc/resolv.conf > $TMP_MOUNT_PATH/etc/resolv.conf else echo nameserver 8.8.8.8 > $TMP_MOUNT_PATH/etc/resolv.conf diff --git a/lib/img-functions b/lib/img-functions index 5be0a93f..08a8ef42 100644 --- a/lib/img-functions +++ b/lib/img-functions @@ -35,7 +35,7 @@ function cleanup () { function ensure_nbd () { NBD=`which qemu-nbd` || true - if [ -z "$NBD" ]; then + if [ -z "$NBD" ]; then echo "qemu-nbd is not found in your PATH" echo "Please install it on your system" exit 1