summaryrefslogtreecommitdiffstats
path: root/functions
diff options
context:
space:
mode:
authorDave Reisner <d@falconindy.com>2011-06-10 15:57:25 +0200
committerDave Reisner <d@falconindy.com>2011-06-19 23:33:34 +0200
commitc17f3fdb2df60b65233b8659e64107e6bf8d34cd (patch)
treea4c598c93d02670141c57801b25640f20f66b32c /functions
parent3c381d35f551844a7452d77c566a6f88108eb385 (diff)
downloadmkinitcpio-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--functions17
1 files 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() {