summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoui Chang <louipc.ist@gmail.com>2009-08-03 14:00:38 +0200
committerAaron Griffin <aaronmgriffin@gmail.com>2009-08-05 19:29:08 +0200
commitb8800749b5e301bdf76c8aa1509ea5653d9e7c51 (patch)
treed8ac8c845af9af1c351497573a2967a50d5e1a57
parent5258594df2859565a0d2c72a33663162b1cd68b1 (diff)
downloadmkinitcpio-b8800749b5e301bdf76c8aa1509ea5653d9e7c51.tar.gz
mkinitcpio-b8800749b5e301bdf76c8aa1509ea5653d9e7c51.tar.xz
Eliminate bashisms so things work in dash.
Signed-off-by: Loui Chang <louipc.ist@gmail.com> Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
-rw-r--r--functions2
-rwxr-xr-xmkinitcpio10
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}")