mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-02-08 08:49:17 +00:00
Compare commits
No commits in common. "5b95ff800cbad08dd0db49ef6d7bd2b479412428" and "76f7efaf5575d70429f45c4c86f2e6e10311f037" have entirely different histories.
5b95ff800c
...
76f7efaf55
@ -46,17 +46,17 @@ function update_script() {
|
||||
# Creating Backup
|
||||
msg_info "Creating Backup"
|
||||
mv "/opt/2fauth" "/opt/2fauth-backup"
|
||||
# tar -czf "/opt/2fauth_backup_$(date +%F).tar.gz" "/opt/2fauth"
|
||||
msg_ok "Backup Created"
|
||||
|
||||
# Execute Update
|
||||
msg_info "Updating $APP to v${RELEASE}"
|
||||
wget -q "https://github.com/Bubka/2FAuth/archive/refs/tags/${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/storage" "/opt/2fauth/storage"
|
||||
cd "/opt/2fauth" || return
|
||||
msg_ok "Updated $APP to v${RELEASE}"
|
||||
|
||||
chown -R www-data: "/opt/2fauth"
|
||||
chmod -R 755 "/opt/2fauth"
|
||||
@ -69,13 +69,13 @@ function update_script() {
|
||||
|
||||
# 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 autoclean
|
||||
msg_ok "Cleanup Completed"
|
||||
|
||||
# Last Action
|
||||
echo "${RELEASE}" >/opt/2fauth_version.txt
|
||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||
msg_ok "Update Successful"
|
||||
else
|
||||
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
||||
|
@ -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 "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
|
||||
{
|
||||
echo "2FAuth Credentials"
|
||||
echo "${APPLICATION} Credentials"
|
||||
echo "Database User: $DB_USER"
|
||||
echo "Database Password: $DB_PASS"
|
||||
echo "Database Name: $DB_NAME"
|
||||
} >> ~/2FAuth.creds
|
||||
} >> ~/${APPLICATION}.creds
|
||||
msg_ok "Set up Database"
|
||||
|
||||
# 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) }')
|
||||
wget -q "https://github.com/Bubka/2FAuth/archive/refs/tags/${RELEASE}.zip"
|
||||
unzip -q "${RELEASE}.zip"
|
||||
mv "2FAuth-${RELEASE//v}/" /opt/2fauth
|
||||
mv "${APPLICATION}-${RELEASE//v}/" /opt/2fauth
|
||||
|
||||
cd "/opt/2fauth" || return
|
||||
cp .env.example .env
|
||||
@ -75,8 +75,8 @@ $STD php artisan config:cache
|
||||
chown -R www-data: /opt/2fauth
|
||||
chmod -R 755 /opt/2fauth
|
||||
|
||||
echo "${RELEASE}" >"/opt/2fauth_version.txt"
|
||||
msg_ok "Setup 2fauth"
|
||||
echo "${RELEASE}" >"/opt/${app}_version.txt"
|
||||
msg_ok "Setup ${app}"
|
||||
|
||||
# Configure Service (NGINX)
|
||||
msg_info "Configure Service"
|
||||
|
@ -30,14 +30,5 @@
|
||||
"username": null,
|
||||
"password": null
|
||||
},
|
||||
"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"
|
||||
}
|
||||
]
|
||||
"notes": []
|
||||
}
|
Loading…
Reference in New Issue
Block a user