Support pwqgen/pwgen checking

Closes #66.
This commit is contained in:
Luke Murphy 2020-12-31 18:10:13 +01:00
parent 5da9f26076
commit 44d3ac3a1c
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
1 changed files with 14 additions and 0 deletions

14
abra
View File

@ -306,6 +306,18 @@ fi
###### Safety checks
require_pwqgen() {
if ! type pwqgen > /dev/null 2>&1; then
error "pwqgen program is not installed"
fi
}
require_pwgen() {
if ! type pwgen > /dev/null 2>&1; then
error "pwgen program is not installed"
fi
}
require_abra_dir() {
mkdir -p "$ABRA_DIR"
}
@ -819,8 +831,10 @@ sub_app_secret_generate(){
LENGTH="$abra__length_"
if [[ "$SECRET" == *"password"* ]]; then
require_pwqgen
PWGEN="${abra__cmd_:-pwqgen}"
else
require_pwgen
PWGEN=${abra__cmd_:-pwgen -s "$LENGTH" 1}
fi