From 363685d3d31162da2350297f569e50118d29ac52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slavi=C5=A1a=20Are=C5=BEina?= <58952836+tremor021@users.noreply.github.com> Date: Sat, 16 Aug 2025 22:40:14 +0200 Subject: [PATCH] Refactor (#6900) --- ct/wallos.sh | 20 +++++++++----------- install/wallos-install.sh | 14 ++------------ 2 files changed, 11 insertions(+), 23 deletions(-) diff --git a/ct/wallos.sh b/ct/wallos.sh index 57fb27f21..4166494a7 100644 --- a/ct/wallos.sh +++ b/ct/wallos.sh @@ -27,17 +27,19 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi + RELEASE=$(curl -fsSL https://api.github.com/repos/ellite/Wallos/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') - if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then - msg_info "Updating ${APP} to ${RELEASE}" - cd /opt - curl -fsSL "https://github.com/ellite/Wallos/archive/refs/tags/v${RELEASE}.zip" -o $(basename "https://github.com/ellite/Wallos/archive/refs/tags/v${RELEASE}.zip") + if [[ ! -f ~/.wallos ]] || [[ "${RELEASE}" != "$(cat ~/.wallos)" ]]; then + msg_info "Creating backup" mkdir -p /opt/logos mv /opt/wallos/db/wallos.db /opt/wallos.db mv /opt/wallos/images/uploads/logos /opt/logos/ - $STD unzip v${RELEASE}.zip + msg_ok "Backup created" + rm -rf /opt/wallos - mv Wallos-${RELEASE} /opt/wallos + fetch_and_deploy_gh_release "wallos" "ellite/Wallos" "tarball" + + msg_info "Configuring ${APP}" rm -rf /opt/wallos/db/wallos.empty.db mv /opt/wallos.db /opt/wallos/db/wallos.db mv /opt/logos/* /opt/wallos/images/uploads/logos @@ -48,16 +50,12 @@ function update_script() { chmod -R 755 /opt/wallos mkdir -p /var/log/cron $STD curl http://localhost/endpoints/db/migrate.php - echo "${RELEASE}" >/opt/${APP}_version.txt - msg_ok "Updated ${APP}" + msg_ok "Configured ${APP}" msg_info "Reload Apache2" systemctl reload apache2 msg_ok "Apache2 Reloaded" - msg_info "Cleaning Up" - rm -R /opt/v${RELEASE}.zip - msg_ok "Cleaned" msg_ok "Updated Successfully" else msg_ok "No update required. ${APP} is already at ${RELEASE}" diff --git a/install/wallos-install.sh b/install/wallos-install.sh index 19b8aa82a..a3d175153 100644 --- a/install/wallos-install.sh +++ b/install/wallos-install.sh @@ -14,19 +14,10 @@ setting_up_container network_check update_os -msg_info "Installing Dependencies" -$STD apt-get install -y \ - apache2 \ - libapache2-mod-php \ - php8.2-{mbstring,gd,curl,intl,imagick,bz2,sqlite3,zip,xml} -msg_ok "Installed Dependencies" +PHP_VERSION="8.4" PHP_APACHE="YES" PHP_MODULE="imagick,bz2,sqlite3" setup_php +fetch_and_deploy_gh_release "wallos" "ellite/Wallos" "tarball" msg_info "Installing Wallos (Patience)" -cd /opt -RELEASE=$(curl -fsSL https://api.github.com/repos/ellite/Wallos/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') -curl -fsSL "https://github.com/ellite/Wallos/archive/refs/tags/v${RELEASE}.zip" -o "v${RELEASE}.zip" -$STD unzip v${RELEASE}.zip -mv Wallos-${RELEASE} /opt/wallos cd /opt/wallos mv /opt/wallos/db/wallos.empty.db /opt/wallos/db/wallos.db chown -R www-data:www-data /opt/wallos @@ -73,7 +64,6 @@ motd_ssh customize msg_info "Cleaning up" -rm -rf /opt/v${RELEASE}.zip $STD apt-get -y autoremove $STD apt-get -y autoclean msg_ok "Cleaned"