Compare commits

..

No commits in common. "5b95ff800cbad08dd0db49ef6d7bd2b479412428" and "76f7efaf5575d70429f45c4c86f2e6e10311f037" have entirely different histories.

3 changed files with 11 additions and 20 deletions

View File

@ -46,17 +46,17 @@ function update_script() {
# Creating Backup # Creating Backup
msg_info "Creating Backup" msg_info "Creating Backup"
mv "/opt/2fauth" "/opt/2fauth-backup" mv "/opt/2fauth" "/opt/2fauth-backup"
# tar -czf "/opt/2fauth_backup_$(date +%F).tar.gz" "/opt/2fauth"
msg_ok "Backup Created" msg_ok "Backup Created"
# Execute Update # Execute Update
msg_info "Updating $APP to v${RELEASE}" msg_info "Updating $APP to v${RELEASE}"
wget -q "https://github.com/Bubka/2FAuth/archive/refs/tags/${RELEASE}.zip" wget -q "https://github.com/Bubka/2FAuth/archive/refs/tags/${RELEASE}.zip"
unzip -q "${RELEASE}.zip" unzip -q "${RELEASE}.zip"
mv "2FAuth-${RELEASE//v}/" "/opt/2fauth" mv "${APPLICATION}-${RELEASE//v}/" "/opt/${APPLICATION}"
mv "/opt/2fauth-backup/.env" "/opt/2fauth/.env" mv "/opt/2fauth-backup/.env" "/opt/2fauth/.env"
mv "/opt/2fauth-backup/storage" "/opt/2fauth/storage" mv "/opt/2fauth-backup/storage" "/opt/2fauth/storage"
cd "/opt/2fauth" || return cd "/opt/2fauth" || return
msg_ok "Updated $APP to v${RELEASE}"
chown -R www-data: "/opt/2fauth" chown -R www-data: "/opt/2fauth"
chmod -R 755 "/opt/2fauth" chmod -R 755 "/opt/2fauth"
@ -69,13 +69,13 @@ function update_script() {
# Cleaning up # Cleaning up
msg_info "Cleaning Up" msg_info "Cleaning Up"
rm -rf "v${RELEASE}.zip" rm -rf "/opt/v${RELEASE}.zip"
$STD apt-get -y autoremove $STD apt-get -y autoremove
$STD apt-get -y autoclean $STD apt-get -y autoclean
msg_ok "Cleanup Completed" msg_ok "Cleanup Completed"
# Last Action # Last Action
echo "${RELEASE}" >/opt/2fauth_version.txt echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Update Successful" msg_ok "Update Successful"
else else
msg_ok "No update required. ${APP} is already at v${RELEASE}" msg_ok "No update required. ${APP} is already at v${RELEASE}"

View File

@ -35,19 +35,19 @@ $STD mysql -u root -e "CREATE DATABASE $DB_NAME;"
$STD mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED WITH mysql_native_password AS PASSWORD('$DB_PASS');" $STD mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED WITH mysql_native_password AS PASSWORD('$DB_PASS');"
$STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;" $STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
{ {
echo "2FAuth Credentials" echo "${APPLICATION} Credentials"
echo "Database User: $DB_USER" echo "Database User: $DB_USER"
echo "Database Password: $DB_PASS" echo "Database Password: $DB_PASS"
echo "Database Name: $DB_NAME" echo "Database Name: $DB_NAME"
} >> ~/2FAuth.creds } >> ~/${APPLICATION}.creds
msg_ok "Set up Database" msg_ok "Set up Database"
# Setup App # Setup App
msg_info "Setup 2FAuth" msg_info "Setup ${APPLICATION}"
RELEASE=$(curl -s https://api.github.com/repos/Bubka/2FAuth/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') RELEASE=$(curl -s https://api.github.com/repos/Bubka/2FAuth/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
wget -q "https://github.com/Bubka/2FAuth/archive/refs/tags/${RELEASE}.zip" wget -q "https://github.com/Bubka/2FAuth/archive/refs/tags/${RELEASE}.zip"
unzip -q "${RELEASE}.zip" unzip -q "${RELEASE}.zip"
mv "2FAuth-${RELEASE//v}/" /opt/2fauth mv "${APPLICATION}-${RELEASE//v}/" /opt/2fauth
cd "/opt/2fauth" || return cd "/opt/2fauth" || return
cp .env.example .env cp .env.example .env
@ -75,8 +75,8 @@ $STD php artisan config:cache
chown -R www-data: /opt/2fauth chown -R www-data: /opt/2fauth
chmod -R 755 /opt/2fauth chmod -R 755 /opt/2fauth
echo "${RELEASE}" >"/opt/2fauth_version.txt" echo "${RELEASE}" >"/opt/${app}_version.txt"
msg_ok "Setup 2fauth" msg_ok "Setup ${app}"
# Configure Service (NGINX) # Configure Service (NGINX)
msg_info "Configure Service" msg_info "Configure Service"

View File

@ -30,14 +30,5 @@
"username": null, "username": null,
"password": null "password": null
}, },
"notes": [ "notes": []
{
"text": "Database credentials: `cat ~/2FAuth.creds`",
"type": "info"
},
{
"text": "The very first account created is automatically set up as an administrator account.",
"type": "info"
}
]
} }