diff options
author | Dave Reisner <d@falconindy.com> | 2011-06-10 15:57:25 +0200 |
---|---|---|
committer | Dave Reisner <d@falconindy.com> | 2011-06-19 23:33:34 +0200 |
commit | c17f3fdb2df60b65233b8659e64107e6bf8d34cd (patch) | |
tree | a4c598c93d02670141c57801b25640f20f66b32c /functions | |
parent | 3c381d35f551844a7452d77c566a6f88108eb385 (diff) | |
download | mkinitcpio-c17f3fdb2df60b65233b8659e64107e6bf8d34cd.tar.gz mkinitcpio-c17f3fdb2df60b65233b8659e64107e6bf8d34cd.tar.xz |
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 <d@falconindy.com>
Diffstat (limited to 'functions')
-rw-r--r-- | functions | 17 |
1 files changed, 6 insertions, 11 deletions
@@ -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() { |