mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-02-08 00:39:16 +00:00
Compare commits
5 Commits
5b95ff800c
...
efa9f172fc
Author | SHA1 | Date | |
---|---|---|---|
|
efa9f172fc | ||
|
1270071c8c | ||
|
e77cc6a39d | ||
|
cb92223618 | ||
|
16a7377b49 |
11
ct/2fauth.sh
11
ct/2fauth.sh
@ -37,8 +37,8 @@ function update_script() {
|
|||||||
|
|
||||||
# Crawling the new version and checking whether an update is required
|
# Crawling the new version and checking whether an update is required
|
||||||
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) }')
|
||||||
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
|
if [[ "${RELEASE}" != "$(cat /opt/2fauth_version.txt)" ]] || [[ ! -f /opt/2fauth_version.txt ]]; then
|
||||||
msg_info "Updating $APP"
|
msg_info "Updating $APP to ${RELEASE}"
|
||||||
|
|
||||||
apt-get update &>/dev/null
|
apt-get update &>/dev/null
|
||||||
apt-get -y upgrade &>/dev/null
|
apt-get -y upgrade &>/dev/null
|
||||||
@ -49,14 +49,12 @@ function update_script() {
|
|||||||
msg_ok "Backup Created"
|
msg_ok "Backup Created"
|
||||||
|
|
||||||
# Execute Update
|
# Execute Update
|
||||||
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 "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"
|
||||||
@ -65,7 +63,6 @@ function update_script() {
|
|||||||
composer install --no-dev --prefer-source &>/dev/null
|
composer install --no-dev --prefer-source &>/dev/null
|
||||||
|
|
||||||
php artisan 2fauth:install
|
php artisan 2fauth:install
|
||||||
msg_ok "Updated $APP to v${RELEASE}"
|
|
||||||
|
|
||||||
# Cleaning up
|
# Cleaning up
|
||||||
msg_info "Cleaning Up"
|
msg_info "Cleaning Up"
|
||||||
@ -76,9 +73,9 @@ function update_script() {
|
|||||||
|
|
||||||
# Last Action
|
# Last Action
|
||||||
echo "${RELEASE}" >/opt/2fauth_version.txt
|
echo "${RELEASE}" >/opt/2fauth_version.txt
|
||||||
msg_ok "Update Successful"
|
msg_ok "Updated $APP to ${RELEASE}"
|
||||||
else
|
else
|
||||||
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
||||||
fi
|
fi
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user