diff options
author | Dave Reisner <d@falconindy.com> | 2011-06-13 15:16:38 +0200 |
---|---|---|
committer | Dave Reisner <d@falconindy.com> | 2011-06-19 23:33:34 +0200 |
commit | f751758256ca9ab3db2b73e157542a2719296603 (patch) | |
tree | 6c44fa49d2c369719eac073915426c92043d9709 | |
parent | 7592c32bda5dc3bc45a98b1ddd91be52963b5be2 (diff) | |
download | mkinitcpio-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-x | mkinitcpio | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -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 |