Compare commits

..

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

View File

@ -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/2fauth_version.txt)" ]] || [[ ! -f /opt/2fauth_version.txt ]]; then if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
msg_info "Updating $APP to ${RELEASE}" msg_info "Updating $APP"
apt-get update &>/dev/null apt-get update &>/dev/null
apt-get -y upgrade &>/dev/null apt-get -y upgrade &>/dev/null
@ -49,12 +49,14 @@ 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"
@ -63,6 +65,7 @@ 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"
@ -73,9 +76,9 @@ function update_script() {
# Last Action # Last Action
echo "${RELEASE}" >/opt/2fauth_version.txt echo "${RELEASE}" >/opt/2fauth_version.txt
msg_ok "Updated $APP to ${RELEASE}" msg_ok "Update Successful"
else else
msg_ok "No update required. ${APP} is already at ${RELEASE}" msg_ok "No update required. ${APP} is already at v${RELEASE}"
fi fi
exit exit
} }