From a4e770eb3c648f36c33bb8edc54fc7d356d87eff Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Thu, 3 May 2012 17:58:53 -0400 Subject: functions: merge _add_symlink into add_symlink This frontend/backend split is no longer necessary without the notion of a basedir. Signed-off-by: Dave Reisner --- functions | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/functions b/functions index 8ff1d09..9d572fc 100644 --- a/functions +++ b/functions @@ -192,22 +192,6 @@ in_array() { return 1 # Not Found } -_add_symlink() { - # add a symlink to $buildroot - # $1: name on initcpio - # $2: target of $1 - - (( $# == 2 )) || return $EINVAL - if (( ! QUIET )); then - if [[ -L "$BUILDROOT$1" ]]; then - plain "overwriting symlink %s -> %s" "$1" "$2" - else - plain "adding symlink: %s -> %s" "$1" "$2" - fi - fi - ln -sfn "$2" "$BUILDROOT$1" -} - auto_modules() { # Perform auto detection of modules via sysfs. @@ -350,7 +334,15 @@ add_symlink() { (( $# == 2 )) || return 1 add_dir "$(get_dirname "$1")" - _add_symlink "$1" "$2" + + if (( ! QUIET )); then + if [[ -L $BUILDROOT$1 ]]; then + plain "overwriting symlink %s -> %s" "$1" "$2" + else + plain "adding symlink: %s -> %s" "$1" "$2" + fi + fi + ln -sfn "$2" "$BUILDROOT$1" } add_file() { @@ -363,7 +355,7 @@ add_file() { (( $# )) || return 1 # determine source and destination - local src=$1 dest=${2:-$1} mode=$3 + local src=$1 dest=${2:-$1} mode= [[ -f $src ]] || { error "file not found: \`%s'" "$src"; return 1; } @@ -420,7 +412,7 @@ add_binary() { resolved=$(readlink -e "$sodep") dirname=${resolved%/*} add_dir "$dirname" 755 - _add_symlink "$sodep" "$resolved" + add_symlink "$sodep" "$resolved" add_file "$resolved" "$resolved" 755 fi fi -- cgit v1.2.3-24-g4f1b