summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-05-03 23:58:53 +0200
committerDave Reisner <dreisner@archlinux.org>2012-05-12 15:30:32 +0200
commita4e770eb3c648f36c33bb8edc54fc7d356d87eff (patch)
tree2ff5fda2d5f7c5121afb5cd5fc635f4499dba7af
parentfff89b9c2af57f3bcb4b1adf701f596177badebd (diff)
downloadmkinitcpio-a4e770eb3c648f36c33bb8edc54fc7d356d87eff.tar.gz
mkinitcpio-a4e770eb3c648f36c33bb8edc54fc7d356d87eff.tar.xz
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 <dreisner@archlinux.org>
-rw-r--r--functions30
1 files 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