Compare commits

..

1 commit

Author SHA1 Message Date
Yunheng Liu
83f2d52dc5
Merge 56af2dfe4b into 258b08fff3 2026-03-08 11:53:56 +01:00
3 changed files with 5 additions and 6 deletions

View file

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

View file

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