update gen_random_string for all three scripts

This commit is contained in:
Kookiejarz 2026-03-08 20:08:36 -04:00
parent 56af2dfe4b
commit 4348140a78
No known key found for this signature in database
GPG key ID: 4014DA977709E11F
3 changed files with 6 additions and 5 deletions

View file

@ -105,7 +105,6 @@ install_base() {
gen_random_string() {
local length="$1"
# openssl output base64, no need /dev/urandom + tr
openssl rand -base64 $(( length * 2 )) \
| tr -dc 'a-zA-Z0-9' \
| head -c "$length"

View file

@ -100,8 +100,9 @@ is_port_in_use() {
gen_random_string() {
local length="$1"
local random_string=$(LC_ALL=C tr -dc 'a-zA-Z0-9' </dev/urandom | fold -w "$length" | head -n 1)
echo "$random_string"
openssl rand -base64 $(( length * 2 )) \
| tr -dc 'a-zA-Z0-9' \
| head -c "$length"
}
install_base() {

View file

@ -243,8 +243,9 @@ reset_user() {
gen_random_string() {
local length="$1"
local random_string=$(LC_ALL=C tr -dc 'a-zA-Z0-9' </dev/urandom | fold -w "$length" | head -n 1)
echo "$random_string"
openssl rand -base64 $(( length * 2 )) \
| tr -dc 'a-zA-Z0-9' \
| head -c "$length"
}
reset_webbasepath() {