Drop pwgen/pwqgen requirements
All checks were successful
continuous-integration/drone/push Build is passing

Closes https://git.autonomic.zone/coop-cloud/abra/issues/167.
This commit is contained in:
2021-07-04 23:06:20 +02:00
parent 283eb21e29
commit e9fb9e56ad
3 changed files with 15 additions and 10 deletions

16
abra
View File

@ -652,6 +652,14 @@ checkout_main_or_master() {
git checkout main > /dev/null 2>&1 || git checkout master > /dev/null 2>&1
}
pwgen_native() {
tr -dc 'a-zA-Z0-9' < /dev/urandom | head -c "$1"
}
pwqgen_native() {
shuf -n 3 /usr/share/dict/words | tr -dc 'a-zA-Z0-9' | tr -d '\n'
}
# FIXME 3wc: update or remove
if [ -z "$ABRA_ENV" ] && [ -f .env ] && type direnv > /dev/null 2>&1 && ! direnv status | grep -q 'Found RC allowed true'; then
error "direnv is blocked, run direnv allow"
@ -1706,11 +1714,9 @@ sub_app_secret_generate(){
fi
if [[ -n "$length" ]]; then
require_binary pwgen
abra__cmd_="pwgen -s $length 1"
abra__cmd_="pwgen_native $length"
else
require_binary pwqgen
abra__cmd_=pwqgen
abra__cmd_=pwqgen_native
fi
PWGEN=${abra__cmd_}
@ -1720,7 +1726,7 @@ sub_app_secret_generate(){
error "Required arguments missing"
fi
PW=$($PWGEN|tr -d "\n")
PW=$($PWGEN)
success "Password: $PW"