Change remaining #!/bin/sh to use bash.
Add a warning to the git-hook about using
sh in shebangs. Using bash allows scripts to
freely use bash-isms and lowers the risks
of bugs on Debian based platforms.
Also, change remaining callers to use bash
rather than sh.
Signed-off-by: Timothy Day <timday@amazon.com>
Change-Id: I10f3e8f71435c38cfc1650dd13168d7ed5d3b31f
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49479
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: jsimmons <jsimmons@infradead.org>
-#!/bin/sh
+#!/bin/bash
DEFAULT_VERSION=2.15.53
LVF=LUSTRE-VERSION-FILE
-#!/bin/sh
-
-# NOTE: Please avoid bashisms (bash specific syntax) in this script
-
+#!/bin/bash
set -e
pw="$PWD"
for dir in libcfs lnet lustre snmp ; do
# Example End --
mod_files=($(awk '/modified:.*\.sh|new:.*\.sh/ { print $3 }' $1))
for cur_file in ${mod_files[@]}; do
+ # Shebangs should prefer bash over regular sh. This allows
+ # scripts to freely use bash-isms and lowers the risks of
+ # failures on Debian based platforms. Output a small warning
+ # if #!/bin/sh is found.
+ echo "#" $(grep -Hn "#\!/bin/sh" "$cur_file" && \
+ echo " : Please don't use sh in shebangs.") >> "$1"
+
# Get start/end range of lines that needs to be reported
# range presently not used will come in handy when dealing with
# warnings reported by shellcheck
speclist="$pkg.spec $pkg-kmod.spec $pkg-dkms.spec"
fi
- sh autogen.sh || return 255
+ bash autogen.sh || return 255
if ! ./configure --with-linux=${LINUX} --with-linux-obj=${LINUXOBJ:-$LINUX} \
${spldir:+--with-spl="${spldir}"} 2>&1 ||
PACKAGE_VERSION="@UPVERSION@"
# We need to run autogen.sh between builds, see Ubuntu bug #952817
-MAKE="sh autogen.sh && ./configure --with-linux=$kernel_source_dir --with-linux-obj=$kernel_source_dir --disable-server --disable-quilt --disable-dependency-tracking --disable-doc --disable-utils --disable-iokit --disable-snmp --disable-tests --enable-quota --with-kmp-moddir=updates && make"
+MAKE="bash autogen.sh && ./configure --with-linux=$kernel_source_dir --with-linux-obj=$kernel_source_dir --disable-server --disable-quilt --disable-dependency-tracking --disable-doc --disable-utils --disable-iokit --disable-snmp --disable-tests --enable-quota --with-kmp-moddir=updates && make"
CLEAN="make distclean || true"
AUTOINSTALL="yes"
-#!/bin/sh
+#!/bin/bash
set -e
-#!/bin/sh
+#!/bin/bash
set -e
-#!/bin/sh
+#!/bin/bash
DEPMOD_DIR="/etc/depmod.d"
LUSTRE_DEPMOD_FILE="${DEPMOD_DIR}/lustre.conf"
-#!/bin/sh
+#!/bin/bash
DEPMOD_DIR="/etc/depmod.d"
LUSTRE_DEPMOD_FILE="${DEPMOD_DIR}/lustre.conf"
# If DEPMOD_DIR is empty, we also created it, thus remove it.
[ ! "$(ls -A ${DEPMOD_DIR} 2>/dev/null)" ] && { rm -rf ${DEPMOD_DIR}; }
-depmod -a
\ No newline at end of file
+depmod -a
cp /usr/share/misc/config.sub ldiskfs/config.sub; \
cp /usr/share/misc/config.guess config.guess; \
cp /usr/share/misc/config.guess ldiskfs/config.guess; \
- sh build/autogen.sh; \
+ bash build/autogen.sh; \
fi; \
touch $@
-#!/bin/sh
+#!/bin/bash
lnds=$(echo k{sock,qsw,{open,i,v,o2,c}ib,ra,ptl,mx}lnd)
kernel and utilities from https://downloads.whamcloud.com/
To build:
- sh autogen.sh
+ bash autogen.sh
./configure --with-linux=/usr/src/lustre_patched_kernel_tree
make
-#!/bin/sh
+#!/bin/bash
#
# License: GNU General Public License (GPL)v2
# Description: Manages Lustre server on a shared storage
-#!/bin/sh
+#!/bin/bash
#
#
# LNet OCF RA
-#!/bin/sh
+#!/bin/bash
#
#
# HealthLUSTRE OCF RA
-#!/bin/sh
+#!/bin/bash
PROG=$0
-#!/bin/sh
+#!/bin/bash
# flags of IB devices which present
HFI=0
-#!/bin/sh
+#!/bin/bash
# Given one or more Lustre objects, create a mon configuration file
# naming the mon watches based on the Lustre object names
done
echo "Mon config completed - new mon config is $TMPMONCFG"
-exit 0
\ No newline at end of file
+exit 0
-#!/bin/sh
+#!/bin/bash
# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
# Purpose:
-#!/bin/sh
+#!/bin/bash
[ -z "$SIZE" ] && SIZE=5g
[ -z "$COUNT" ] && COUNT=100
[ -z "$VERIFY" ] && VERIFY="-+d"
-#!/bin/sh
+#!/bin/bash
PATH=`dirname $0`/../utils:$PATH
llobdstat $1 1 | while read LINE; do
-#!/bin/sh
+#!/bin/bash
DELAY=1
null() {
:
[ ! -f "$sbin_mount" ] && touch "$sbin_mount"
if [ ! -s "$sbin_mount" -a -w "$sbin_mount" ]; then
cat <<- EOF > "$sbin_mount"
- #!/bin/sh
+ #!/bin/bash
#STUB MARK
echo "This $sbin_mount just a mountpoint." 1>&2
echo "It is never supposed to be run." 1>&2