summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <d@falconindy.com>2011-06-13 15:16:38 +0200
committerDave Reisner <d@falconindy.com>2011-06-19 23:33:34 +0200
commitf751758256ca9ab3db2b73e157542a2719296603 (patch)
tree6c44fa49d2c369719eac073915426c92043d9709
parent7592c32bda5dc3bc45a98b1ddd91be52963b5be2 (diff)
downloadmkinitcpio-f751758256ca9ab3db2b73e157542a2719296603.tar.gz
mkinitcpio-f751758256ca9ab3db2b73e157542a2719296603.tar.xz
mkinitcpio: bashification, part 2/2
mostly consists of syntax changes in the hook parsing loop. Signed-off-by: Dave Reisner <d@falconindy.com>
-rwxr-xr-xmkinitcpio15
1 files changed, 7 insertions, 8 deletions
diff --git a/mkinitcpio b/mkinitcpio
index 6db23e9..1f4792c 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -256,15 +256,14 @@ for hook in ${HOOKS}; do
in_array "$hook" "${SKIPHOOKS[@]}" && continue
unset MODULES BINARIES FILES SCRIPT
build () { error "$hook: no build function..."; }
- # Deprecation check
- # A hook is considered deprecated if it is a symlink
- # within $INSTDIR.
- if [[ -h "${INSTDIR}/${hook}" ]]; then
- newhook="$(readlink -ne "${INSTDIR}/${hook}")"
- if [ -n "${newhook}" -a "${INSTDIR}/$(get_basename ${newhook})" -ef "${newhook}" ]; then
- newhook="$(get_basename ${newhook})"
+
+ # A hook is considered deprecated if it is a symlink within $INSTDIR.
+ if [[ -L "$INSTDIR/$hook" ]]; then
+ newhook=$(readlink -e "$INSTDIR/$hook")
+ if [[ $newhook && "$INSTDIR/${newhook##*/}" -ef "$newhook" ]]; then
+ newhook=${newhook##*/}
warning "Hook '%s' is deprecated. Replace it with '%s' in your config" "$hook" "$newhook"
- hook="${newhook}"
+ hook=$newhook
fi
fi
if [[ -r "${INSTDIR}/${hook}" ]]; then