firstboot: генерация пароля без обрыва канала (tr: ошибка записи)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
zuevav
2026-09-24 14:12:24 +03:00
parent f37f02c35e
commit 2350fdf5aa
+1 -1
View File
@@ -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"'"}'; } 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 ACC_DONE=/var/lib/bj/.bj/os-accounts-set
ACCOUNTS="" 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 — предложенный пароль; печатает итоговый пароль askpw() { # $1 — логин, $2 — предложенный пароль; печатает итоговый пароль
while true; do while true; do
printf ' Пароль для %s: %s\n Enter — принять, или введите свой (не короче 10 символов): ' "$1" "$2" > /dev/tty printf ' Пароль для %s: %s\n Enter — принять, или введите свой (не короче 10 символов): ' "$1" "$2" > /dev/tty