firstboot: генерация пароля без обрыва канала (tr: ошибка записи)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -17,7 +17,7 @@ finish() {
|
||||
urls() { ip -4 -o addr show scope global 2>/dev/null | awk '{split($4,a,"/"); printf " http://%s:8080%s\n", a[1], "'"$1"'"}'; }
|
||||
ACC_DONE=/var/lib/bj/.bj/os-accounts-set
|
||||
ACCOUNTS=""
|
||||
genpw() { tr -dc 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz23456789' < /dev/urandom | head -c 12 | sed 's/\(....\)\(....\)/\1-\2-/'; }
|
||||
genpw() { local p=""; while [ ${#p} -lt 12 ]; do p="$p$(head -c 48 /dev/urandom | tr -dc 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz23456789')"; done; printf '%s-%s-%s' "${p:0:4}" "${p:4:4}" "${p:8:4}"; }
|
||||
askpw() { # $1 — логин, $2 — предложенный пароль; печатает итоговый пароль
|
||||
while true; do
|
||||
printf ' Пароль для %s: %s\n Enter — принять, или введите свой (не короче 10 символов): ' "$1" "$2" > /dev/tty
|
||||
|
||||
Reference in New Issue
Block a user