Fix secret length generation
continuous-integration/drone/push Build is failing Details

This commit is contained in:
decentral1se 2021-05-14 16:07:46 +02:00
parent 2d6a08a671
commit 1b85bf3d37
Signed by: decentral1se
GPG Key ID: 92DAD76BD9567B8A
1 changed files with 10 additions and 14 deletions

24
abra
View File

@ -1633,9 +1633,9 @@ POWERED BY
}
sub_app_secret_generate(){
SECRET="$abra__secret_"
VERSION="$abra__version_"
LENGTH="$abra__length_"
local secret="$abra__secret_"
local version="$abra__version_"
local length="$abra__length_"
if [ "$abra___all" == "true" ]; then
# Note(decentral1se): we need to reset the flag here to avoid the infinite
@ -1646,22 +1646,18 @@ sub_app_secret_generate(){
return
fi
if [[ -n "$LENGTH" ]]; then
if [ -z "$abra__cmd_" ]; then
require_binary pwgen
abra__cmd_="pwgen -s $LENGTH 1"
fi
if [[ -n "$length" ]]; then
require_binary pwgen
abra__cmd_="pwgen -s $length 1"
else
if [ -z "$abra__cmd_" ]; then
require_binary pwqgen
abra__cmd_=pwqgen
fi
require_binary pwqgen
abra__cmd_=pwqgen
fi
PWGEN=${abra__cmd_}
PWGEN=${abra__cmd_}
debug "SECRET: $SECRET, VERSION $VERSION, PW $PWGEN, ALL $abra___all"
if [ -z "$SECRET" ] || [ -z "$VERSION" ] && [ "$abra___all" == "false" ]; then
if [ -z "$secret" ] || [ -z "$version" ] && [ "$abra___all" == "false" ]; then
error "Required arguments missing"
fi