From c17f3fdb2df60b65233b8659e64107e6bf8d34cd Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Fri, 10 Jun 2011 09:57:25 -0400 Subject: functions: refactor add_symlink We don't need to add the destination directory -- we can assume this will always be added by another function. We also ignore $BASEDIR as we will never be passing in a path that contains a $BASEDIR so we don't want to erroenous trim a path. Signed-off-by: Dave Reisner --- functions | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/functions b/functions index 6ec795e..17c15b5 100644 --- a/functions +++ b/functions @@ -143,18 +143,13 @@ add_symlink() { # $1: pathname of symlink on image # $2: absolute path to target of symlink - local fil dest dir - if [[ -h $1 ]]; then - fil="${1##$BASEDIR}" - dest="${2##$BASEDIR}" - add_dir $(get_dirname "${dest}") - add_dir $(get_dirname "${fil}") - if [[ ! -e "$TMPDIR/root/$dest" ]]; then - (( QUIET )) || plain "adding symlink: $fil -> $dest" - ln -s "$dest" "$TMPDIR/root/$fil" - fi + local file=$1 dest=$2 + + add_dir $(get_dirname "$file") + if [[ ! -e "$TMPDIR/root/$dest" ]]; then + (( QUIET )) || plain "adding symlink: $file -> $dest" + ln -s "$dest" "$TMPDIR/root/$file" fi - #fail quietly } add_file() { -- cgit v1.2.3-24-g4f1b