From f751758256ca9ab3db2b73e157542a2719296603 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Mon, 13 Jun 2011 09:16:38 -0400 Subject: mkinitcpio: bashification, part 2/2 mostly consists of syntax changes in the hook parsing loop. Signed-off-by: Dave Reisner --- mkinitcpio | 15 +++++++-------- 1 file 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 -- cgit v1.2.3-24-g4f1b