summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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}")