From 88b3dc63a1e0ba42952bc2b6478935590974e4cf Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Thu, 3 May 2012 17:51:20 -0400 Subject: 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 --- functions | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'functions') 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 -- cgit v1.2.3-24-g4f1b