mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-02-08 00:39:16 +00:00
Compare commits
4 Commits
76f7efaf55
...
5b95ff800c
Author | SHA1 | Date | |
---|---|---|---|
|
5b95ff800c | ||
|
291fe8fe87 | ||
|
9a7c59605f | ||
|
9da7dd4801 |
@ -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 "${APPLICATION}-${RELEASE//v}/" "/opt/${APPLICATION}"
|
mv "2FAuth-${RELEASE//v}/" "/opt/2fauth"
|
||||||
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 "/opt/v${RELEASE}.zip"
|
rm -rf "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/${APP}_version.txt
|
echo "${RELEASE}" >/opt/2fauth_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}"
|
||||||
|
@ -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 "${APPLICATION} Credentials"
|
echo "2FAuth 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"
|
||||||
} >> ~/${APPLICATION}.creds
|
} >> ~/2FAuth.creds
|
||||||
msg_ok "Set up Database"
|
msg_ok "Set up Database"
|
||||||
|
|
||||||
# Setup App
|
# Setup App
|
||||||
msg_info "Setup ${APPLICATION}"
|
msg_info "Setup 2FAuth"
|
||||||
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 "${APPLICATION}-${RELEASE//v}/" /opt/2fauth
|
mv "2FAuth-${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/${app}_version.txt"
|
echo "${RELEASE}" >"/opt/2fauth_version.txt"
|
||||||
msg_ok "Setup ${app}"
|
msg_ok "Setup 2fauth"
|
||||||
|
|
||||||
# Configure Service (NGINX)
|
# Configure Service (NGINX)
|
||||||
msg_info "Configure Service"
|
msg_info "Configure Service"
|
||||||
|
@ -30,5 +30,14 @@
|
|||||||
"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"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user