This commit is contained in:
Andrew Hurley 2022-10-30 16:43:56 +00:00
parent 085d933afc
commit fee08bdd59
1 changed files with 19 additions and 8 deletions

View File

@ -17,7 +17,16 @@ if [[ $? -eq 0 && -n $RE ]]; then
read -p "Enter Admin name: " USERNAME
if [[ -z $USERNAME ]]; then printf "Nothing in username\n"; exit; fi
if [[ -d $DATA/ncdata/$USERNAME ]]; then printf "Files exist for user $USERNAME\n"; exit 1; fi
LOG=""
if [[ -f install.log ]]; then
LOG=$(cat install.log)
ROOTPASS="${LOG#*: }"
printf "Found existing database password\n"
else
ROOTPASS="$(LC_ALL=C </dev/urandom tr -dc A-Za-z0-9 | head -c 10)"
fi
USERPASS="$(LC_ALL=C </dev/urandom tr -dc A-Za-z0-9 | head -c 4)"
printf "Admin Name: $USERNAME\n"
printf "Admin Pass: $USERPASS\n"
@ -27,14 +36,16 @@ if [[ $? -eq 0 && -n $RE ]]; then
if [[ $ENTER != $'\n' ]]; then exit; fi
printf "\n"
if [[ -z $LOG ]]; then
RE=$($P1 nextc-db bash -c "mysqladmin -u root password $ROOTPASS")
if [[ $? -eq 0 ]]; then
printf "Root password changed\n"
printf "ROOTPASS: $ROOTPASS\n" > install.log
else
printf "Error trying to change root password\n"
printf "Error trying to set password\n"
exit 1
fi
fi
RE=$($P1 nextc bash -c "$P2 maintenance:install --database mysql \
--database-host nextc-db --database-name ncdb --database-user root \