From aa81d26d08b04f9012044cc774fddae7e44d2bc4 Mon Sep 17 00:00:00 2001 From: decentral1se Date: Mon, 5 Jul 2021 23:55:23 +0200 Subject: [PATCH] Use pwgen/pwqgen if installed Closes https://git.autonomic.zone/coop-cloud/abra/issues/197. --- abra | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/abra b/abra index f8e42f0..fad7edf 100755 --- a/abra +++ b/abra @@ -656,10 +656,20 @@ checkout_main_or_master() { } pwgen_native() { + if type pwgen > /dev/null 2>&1; then + pwgen -s "$length" 1 + return + fi + tr -dc 'a-zA-Z0-9' < /dev/urandom | head -c "$1" } pwqgen_native() { + if type pwqgen > /dev/null 2>&1; then + pwqgen + return + fi + shuf -n 3 /usr/share/dict/words | tr -dc 'a-zA-Z0-9' | tr -d '\n' }