Commit 22fd8180 authored by Natanael Copa's avatar Natanael Copa
Browse files

simplify use of password

parent b2f97315
...@@ -62,7 +62,6 @@ check_openssl() { ...@@ -62,7 +62,6 @@ check_openssl() {
$OPENSSL list-cipher-commands | grep "^$ENCRYPTION$" > /dev/null \ $OPENSSL list-cipher-commands | grep "^$ENCRYPTION$" > /dev/null \
|| die "Cipher $ENCRYPTION is not supported" || die "Cipher $ENCRYPTION is not supported"
vecho "OPENSSL installed, cipher can be used"
} }
gen_current_tdb() { gen_current_tdb() {
...@@ -194,7 +193,7 @@ cmd_package() { ...@@ -194,7 +193,7 @@ cmd_package() {
tmppkg="$tmpdir/$(basename $pkg)" tmppkg="$tmpdir/$(basename $pkg)"
# generate the packages.list # generate the packages.list
vecho "Generating package.list" vecho "Generating $PACKAGES_LIST"
cd "$ROOT" cd "$ROOT"
mkdir -p $(dirname $PACKAGES_LIST) mkdir -p $(dirname $PACKAGES_LIST)
echo "#This file is generated by 'lbu package' (lbu $VERSION)" \ echo "#This file is generated by 'lbu package' (lbu $VERSION)" \
...@@ -213,7 +212,6 @@ cmd_package() { ...@@ -213,7 +212,6 @@ cmd_package() {
$SFIC --add "$CURRENT_TDB" $currentlist $SFIC --add "$CURRENT_TDB" $currentlist
# create tar archive # create tar archive
vecho "Creating tar archive"
[ -f "$EXCLUDE_LIST" ] && excl="-X $EXCLUDE_LIST" [ -f "$EXCLUDE_LIST" ] && excl="-X $EXCLUDE_LIST"
[ -f "$INCLUDE_LIST" ] && incl="-T $INCLUDE_LIST" [ -f "$INCLUDE_LIST" ] && incl="-T $INCLUDE_LIST"
if [ -n "$VERBOSE" ]; then if [ -n "$VERBOSE" ]; then
...@@ -228,22 +226,18 @@ cmd_package() { ...@@ -228,22 +226,18 @@ cmd_package() {
tar $excl $incl -c $currentlist | gzip -c >"$tmppkg" tar $excl $incl -c $currentlist | gzip -c >"$tmppkg"
rc=$? rc=$?
else else
if [ -n "$PASSWORD" ]; then set -- enc "-$ENCRYPTION" -salt
tar $excl $incl -c $currentlist | gzip -c \ [ -n "$PASSWORD" ] && set -- "$@" -pass pass:"$PASSWORD"
| $OPENSSL enc "-$ENCRYPTION" -salt -pass pass:"$PASSWORD" > "$tmppkg" tar $excl $incl -c $currentlist | gzip -c \
rc=$? | $OPENSSL "$@" > "$tmppkg"
else rc=$?
tar $excl $incl -c $currentlist | gzip -c \
| $OPENSSL enc "-$ENCRYPTION" -salt > "$tmppkg"
rc=$?
fi
fi fi
fi fi
# actually commit unless dryrun mode # actually commit unless dryrun mode
if [ $rc -eq 0 ]; then if [ $rc -eq 0 ]; then
[ -z "$DRYRUN" ] && cp "$tmppkg" "$pkg" [ -z "$DRYRUN" ] && cp "$tmppkg" "$pkg"
vecho "Copied apk overlay to destination $pkg" vecho "Created $pkg"
else else
rm -f "$CURRENT_TDB" rm -f "$CURRENT_TDB"
fi fi
...@@ -347,8 +341,10 @@ cmd_commit() { ...@@ -347,8 +341,10 @@ cmd_commit() {
if [ -n "$lines" ] && [ "$lines" != "$outfile" ]; then if [ -n "$lines" ] && [ "$lines" != "$outfile" ]; then
# More then one apkovl, this is a security concern # More then one apkovl, this is a security concern
[ -z "$was_mounted" ] && umount "$mnt" [ -z "$was_mounted" ] && umount "$mnt"
vecho "$lines" eecho "The following apkovl file(s) were found:"
die "Found multiple apkovl files. Please use -d to replace them all." eecho "$lines"
eecho ""
die "Please use -d to replace."
fi fi
fi fi
...@@ -374,7 +370,6 @@ cmd_commit() { ...@@ -374,7 +370,6 @@ cmd_commit() {
# move current to commited. # move current to commited.
[ "$DRYRUN" ] || mv "$CURRENT_TDB" "$COMMITED_TDB" [ "$DRYRUN" ] || mv "$CURRENT_TDB" "$COMMITED_TDB"
vecho "Successfully saved apk overlay files"
} }
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
......
...@@ -26,6 +26,16 @@ vecho() { ...@@ -26,6 +26,16 @@ vecho() {
[ -n "$VERBOSE" ] && echo "$@" [ -n "$VERBOSE" ] && echo "$@"
} }
# echo unless quiet mode
qecho() {
[ -z "$QUIET" ] && echo "$@"
}
# echo to stderr
eecho() {
echo "$@" >&2
}
init_tmpdir() { init_tmpdir() {
local omask=`umask` local omask=`umask`
local __tmpd="/tmp/$PROGRAM-${$}-`date +%s`" local __tmpd="/tmp/$PROGRAM-${$}-`date +%s`"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment