Don't regenerate password if it already exists

This commit is contained in:
DeathByDenim 2022-02-21 08:14:03 -05:00
parent 8feec867bf
commit 93623fe0a6
1 changed files with 7 additions and 3 deletions

View File

@ -29,12 +29,16 @@ export lix_version="0.9.41"
export systemuser="onfoss"
export letsencryptemail="jarno@jarno.ca"
export systempassword="$(< /dev/urandom tr -dc a-z | head -c${1:-8};echo;)"
# Store the randomly generated password. This is used for the web interface
# as well as for admin access for the game servers
echo "$systempassword" > /etc/gameserverpassword
chmod go= /etc/gameserverpassword
if [ -f /etc/gameserverpassword ]; then
export systempassword=$(cat /etc/gameserverpassword)
else
export systempassword="$(< /dev/urandom tr -dc a-z | head -c${1:-8};echo;)"
echo "$systempassword" > /etc/gameserverpassword
chmod go= /etc/gameserverpassword
fi
# Install what we need
apt update -y && apt full-upgrade -y