summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-05-03 23:51:20 +0200
committerDave Reisner <dreisner@archlinux.org>2012-05-12 15:30:32 +0200
commit88b3dc63a1e0ba42952bc2b6478935590974e4cf (patch)
tree224a0a51de53c22ddbf87abcf01b2ee5fb44afbe
parent41a290ce22844ac6b1d021b04df5f7659547cc56 (diff)
downloadmkinitcpio-88b3dc63a1e0ba42952bc2b6478935590974e4cf.tar.gz
mkinitcpio-88b3dc63a1e0ba42952bc2b6478935590974e4cf.tar.xz
function: merge _add_dir into add_dir
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--functions26
1 files changed, 9 insertions, 17 deletions
diff --git a/functions b/functions
index 2576180..924fd13 100644
--- a/functions
+++ b/functions
@@ -210,18 +210,6 @@ _add_file() {
command install -Dm$3 "$2" "$BUILDROOT$1"
}
-_add_dir() {
- # add a directory (with parents) to $BUILDROOT
- # $1: pathname on initcpio
- # $2: mode
-
- (( $# == 2 )) || [[ "$1" == /?* ]] || return 1 # bad args
- [[ -e "$BUILDROOT$1" ]] && return 0 # file exists
-
- (( QUIET )) || plain "adding dir: %s" "$1"
- command install -dm$2 "$BUILDROOT$1"
-}
-
_add_symlink() {
# add a symlink to $buildroot
# $1: name on initcpio
@@ -358,14 +346,18 @@ add_full_dir() {
}
add_dir() {
- # Add a directory to the initcpio image.
- # $1: absolute path of directory on image
+ # add a directory (with parents) to $BUILDROOT
+ # $1: pathname on initcpio
+ # $2: mode (optional)
- (( ! $# )) && return 1
+ { (( ! $# )) || [[ $1 != /?* ]]; } && return 1
local path=$1 mode=${2:-755}
- _add_dir "$path" "$mode"
+ [[ -e $BUILDROOT$1 ]] && return 0 # file exists
+
+ (( QUIET )) || plain "adding dir: %s" "$path"
+ command install -dm$mode "$BUILDROOT$path"
}
add_symlink() {
@@ -439,7 +431,7 @@ add_binary() {
else
resolved=$(readlink -e "$sodep")
dirname=${resolved%/*}
- _add_dir "$dirname" 755
+ add_dir "$dirname" 755
_add_symlink "$sodep" "$resolved"
_add_file "$resolved" "$resolved" 755
fi