[pass] [PATCH] Busybox support: no -v option for mkdir

Matthieu Weber mweber at free.fr
Fri Apr 18 20:38:00 CEST 2014


---
 src/password-store.sh |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/password-store.sh b/src/password-store.sh
index ddedebd..ae51717 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -123,6 +123,8 @@ reencrypt_path() {
 # BEGIN platform definable
 #
 
+[[ $(readlink $(which mkdir)) = "busybox" ]] && MKDIR="mkdir" || MKDIR="mkdir -v"
+
 clip() {
 	# This base64 business is a disgusting hack to deal with newline inconsistancies
 	# in shell. There must be a better way to deal with this, but because I'm a dolt,
@@ -265,7 +267,7 @@ cmd_init() {
 		fi
 	fi
 
-	mkdir -v -p "$PREFIX/$id_path"
+	$MKDIR -p "$PREFIX/$id_path"
 	local gpg_id="$PREFIX/$id_path/.gpg-id"
 	printf "%s\n" "$@" > "$gpg_id"
 	local id_print="$(printf "%s, " "$@")"
@@ -388,7 +390,7 @@ cmd_insert() {
 
 	[[ $force -eq 0 && -e $passfile ]] && yesno "An entry already exists for $path. Overwrite it?"
 
-	mkdir -p -v "$PREFIX/$(dirname "$path")"
+	$MKDIR -p "$PREFIX/$(dirname "$path")"
 	set_gpg_recipients "$(dirname "$path")"
 
 	if [[ $multiline -eq 1 ]]; then
@@ -425,7 +427,7 @@ cmd_edit() {
 	fi
 
 	local path="$1"
-	mkdir -p -v "$PREFIX/$(dirname "$path")"
+	$MKDIR -p "$PREFIX/$(dirname "$path")"
 	set_gpg_recipients "$(dirname "$path")"
 	local passfile="$PREFIX/$path.gpg"
 	local template="$PROGRAM.XXXXXXXXXXXXX"
@@ -474,7 +476,7 @@ cmd_generate() {
 		echo "pass-length \"$length\" must be a number."
 		exit 1
 	fi
-	mkdir -p -v "$PREFIX/$(dirname "$path")"
+	$MKDIR -p "$PREFIX/$(dirname "$path")"
 	set_gpg_recipients "$(dirname "$path")"
 	local passfile="$PREFIX/$path.gpg"
 
@@ -563,7 +565,7 @@ cmd_copy_move() {
 		fi
 	fi
 
-	mkdir -p -v "${new_path%/*}"
+	$MKDIR -p "${new_path%/*}"
 	[[ -d $old_path || -d $new_path || $new_path =~ /$ ]] || new_path="${new_path}.gpg"
 
 	local interactive="-i"
-- 
1.7.10.4



More information about the Password-Store mailing list