diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2007-10-18 08:07:34 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2007-10-18 08:07:34 +0000 |
commit | 22fd8180313c40b313e62941348db03e8592afab (patch) | |
tree | b74f7151ead8665568d14f556d0eea7f2530d407 | |
parent | b2f97315c17db0cde26b9e070ee73fdb8e57290c (diff) | |
download | alpine-conf-22fd8180313c40b313e62941348db03e8592afab.zip |
simplify use of password
-rw-r--r-- | lbu | 27 | ||||
-rwxr-xr-x | libalpine.sh | 10 |
2 files changed, 21 insertions, 16 deletions
@@ -62,7 +62,6 @@ check_openssl() { $OPENSSL list-cipher-commands | grep "^$ENCRYPTION$" > /dev/null \ || die "Cipher $ENCRYPTION is not supported" - vecho "OPENSSL installed, cipher can be used" } gen_current_tdb() { @@ -194,7 +193,7 @@ cmd_package() { tmppkg="$tmpdir/$(basename $pkg)" # generate the packages.list - vecho "Generating package.list" + vecho "Generating $PACKAGES_LIST" cd "$ROOT" mkdir -p $(dirname $PACKAGES_LIST) echo "#This file is generated by 'lbu package' (lbu $VERSION)" \ @@ -213,7 +212,6 @@ cmd_package() { $SFIC --add "$CURRENT_TDB" $currentlist # create tar archive - vecho "Creating tar archive" [ -f "$EXCLUDE_LIST" ] && excl="-X $EXCLUDE_LIST" [ -f "$INCLUDE_LIST" ] && incl="-T $INCLUDE_LIST" if [ -n "$VERBOSE" ]; then @@ -228,22 +226,18 @@ cmd_package() { tar $excl $incl -c $currentlist | gzip -c >"$tmppkg" rc=$? else - if [ -n "$PASSWORD" ]; then - tar $excl $incl -c $currentlist | gzip -c \ - | $OPENSSL enc "-$ENCRYPTION" -salt -pass pass:"$PASSWORD" > "$tmppkg" - rc=$? - else - tar $excl $incl -c $currentlist | gzip -c \ - | $OPENSSL enc "-$ENCRYPTION" -salt > "$tmppkg" - rc=$? - fi + set -- enc "-$ENCRYPTION" -salt + [ -n "$PASSWORD" ] && set -- "$@" -pass pass:"$PASSWORD" + tar $excl $incl -c $currentlist | gzip -c \ + | $OPENSSL "$@" > "$tmppkg" + rc=$? fi fi # actually commit unless dryrun mode if [ $rc -eq 0 ]; then [ -z "$DRYRUN" ] && cp "$tmppkg" "$pkg" - vecho "Copied apk overlay to destination $pkg" + vecho "Created $pkg" else rm -f "$CURRENT_TDB" fi @@ -347,8 +341,10 @@ cmd_commit() { if [ -n "$lines" ] && [ "$lines" != "$outfile" ]; then # More then one apkovl, this is a security concern [ -z "$was_mounted" ] && umount "$mnt" - vecho "$lines" - die "Found multiple apkovl files. Please use -d to replace them all." + eecho "The following apkovl file(s) were found:" + eecho "$lines" + eecho "" + die "Please use -d to replace." fi fi @@ -374,7 +370,6 @@ cmd_commit() { # move current to commited. [ "$DRYRUN" ] || mv "$CURRENT_TDB" "$COMMITED_TDB" - vecho "Successfully saved apk overlay files" } #--------------------------------------------------------------------------- diff --git a/libalpine.sh b/libalpine.sh index 776031a..ce1f2de 100755 --- a/libalpine.sh +++ b/libalpine.sh @@ -26,6 +26,16 @@ vecho() { [ -n "$VERBOSE" ] && echo "$@" } +# echo unless quiet mode +qecho() { + [ -z "$QUIET" ] && echo "$@" +} + +# echo to stderr +eecho() { + echo "$@" >&2 +} + init_tmpdir() { local omask=`umask` local __tmpd="/tmp/$PROGRAM-${$}-`date +%s`" |