From b8800749b5e301bdf76c8aa1509ea5653d9e7c51 Mon Sep 17 00:00:00 2001 From: Loui Chang Date: Mon, 3 Aug 2009 08:00:38 -0400 Subject: Eliminate bashisms so things work in dash. Signed-off-by: Loui Chang Signed-off-by: Aaron Griffin --- functions | 2 +- mkinitcpio | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/functions b/functions index 502d1d9..8ad214a 100644 --- a/functions +++ b/functions @@ -124,7 +124,7 @@ add_file () dest="${2}" else dest="${fil##$BASEDIR}" - if [ "${dest:0:1}" != "/" ]; then + if [ "${dest}" = "${dest#/}" ]; then dest="/${dest}" fi fi diff --git a/mkinitcpio b/mkinitcpio index b37c6ec..ba79882 100755 --- a/mkinitcpio +++ b/mkinitcpio @@ -78,7 +78,7 @@ sighandler() { trap sighandler TERM INT while getopts ':c:k:s:b:g:a:p:m:vH:LMhS:' arg; do - if [ "${OPTARG:0:1}" = "-" ]; then + if [ "${OPTARG#-}" != "${OPTARG}" ]; then echo "error: optional argument to '-${arg}' begins with a '-'" echo " you probably don't want this....aborting." usage @@ -176,14 +176,14 @@ if [ -n "${PRESET}" ]; then fi # append a trailing / if needed -if [ "${BASEDIR:${#BASEDIR}}" == "/" ]; then - BASEDIR="${BASEDIR:0:${#BASEDIR}-1}" +if [ "${BASEDIR}" = "${BASEDIR%/}" ]; then + BASEDIR="${BASEDIR}/" fi MODULEDIR="${BASEDIR}/lib/modules/${KERNELVERSION}" if [ -n "${BASEDIR}" ]; then - if [ "${BASEDIR:0:1}" != "/" ]; then + if [ "${BASEDIR}" = "${BASEDIR#/}" ]; then BASEDIR="$(pwd)/${BASEDIR}" elif [ ! -d "${BASEDIR}" ]; then echo "base directory '${BASEDIR}' does not exist or is not a directory" @@ -264,7 +264,7 @@ for hook in ${HOOKS}; do fi done -if [ "${HAS_MODULES}" == "y" ]; then +if [ "${HAS_MODULES}" = "y" ]; then echo ":: Generating module dependencies" for mod in $(grep "file /lib/modules/${KERNELVERSION}" ${FILELIST} | cut -d' ' -f2); do dir=$(dirname "${mod}") -- cgit v1.2.3-24-g4f1b