diff --git a/lib.sh b/lib.sh index 4701ca1df6..772c394c6f 100644 --- a/lib.sh +++ b/lib.sh @@ -18,6 +18,18 @@ RORDIR=/opt/es/ NC_APPS_PATH=$NCPATH/apps VMLOGS=/var/log/nextcloud +# Helper function for generating random passwords +gen_passwd() { + local length=$1 + local charset="$2" + local password="" + while [ ${#password} -lt "$length" ] + do + password=$(echo "$password""$(head -c 100 /dev/urandom | LC_ALL=C tr -dc "$charset")" | fold -w "$length" | head -n 1) + done + echo "$password" +} + # Ubuntu OS DISTRO=$(lsb_release -sd | cut -d ' ' -f 2) KEYBOARD_LAYOUT=$(localectl status | grep "Layout" | awk '{print $3}') @@ -1164,18 +1176,6 @@ do done } -# Helper function for generating random passwords -gen_passwd() { - local length=$1 - local charset="$2" - local password="" - while [ ${#password} -lt "$length" ] - do - password=$(echo "$password""$(head -c 100 /dev/urandom | LC_ALL=C tr -dc "$charset")" | fold -w "$length" | head -n 1) - done - echo "$password" -} - ## bash colors # Reset Color_Off='\e[0m' # Text Reset