From ee74400626cbd557e23b27d0f300c7c4c71cecc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slavi=C5=A1a=20Are=C5=BEina?= <58952836+tremor021@users.noreply.github.com> Date: Fri, 15 Aug 2025 12:56:46 +0200 Subject: [PATCH] Refactor (#6869) --- ct/wavelog.sh | 19 +++++++++---------- frontend/public/json/wavelog.json | 2 +- install/wavelog-install.sh | 24 ++++-------------------- 3 files changed, 14 insertions(+), 31 deletions(-) diff --git a/ct/wavelog.sh b/ct/wavelog.sh index a99d224986..01777f9344 100644 --- a/ct/wavelog.sh +++ b/ct/wavelog.sh @@ -27,23 +27,26 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi - RELEASE=$(curl -fsSL https://api.github.com/repos/wavelog/wavelog/releases/latest | grep "tag_name" | cut -d '"' -f 4) - if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then + + RELEASE=$(curl -fsSL https://api.github.com/repos/wavelog/wavelog/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}') + if [[ ! -f ~/.wavelog ]] || [[ "${RELEASE}" != "$(cat ~/.wavelog)" ]]; then msg_info "Stopping Services" systemctl stop apache2 msg_ok "Services Stopped" - msg_info "Updating ${APP} to ${RELEASE}" + msg_info "Creating backup" cp /opt/wavelog/application/config/config.php /opt/config.php cp /opt/wavelog/application/config/database.php /opt/database.php cp -r /opt/wavelog/userdata /opt/userdata if [[ -f /opt/wavelog/assets/js/sections/custom.js ]]; then cp /opt/wavelog/assets/js/sections/custom.js /opt/custom.js fi - curl -fsSL "https://github.com/wavelog/wavelog/archive/refs/tags/${RELEASE}.zip" -o $(basename "https://github.com/wavelog/wavelog/archive/refs/tags/${RELEASE}.zip") - $STD unzip ${RELEASE}.zip + msg_ok "Backup created" + rm -rf /opt/wavelog - mv wavelog-${RELEASE}/ /opt/wavelog + fetch_and_deploy_gh_release "wavelog" "wavelog/wavelog" "tarball" + + msg_info "Updating ${APP} to ${RELEASE}" rm -rf /opt/wavelog/install mv /opt/config.php /opt/wavelog/application/config/config.php mv /opt/database.php /opt/wavelog/application/config/database.php @@ -55,16 +58,12 @@ function update_script() { chown -R www-data:www-data /opt/wavelog/ find /opt/wavelog/ -type d -exec chmod 755 {} \; find /opt/wavelog/ -type f -exec chmod 664 {} \; - echo "${RELEASE}" >/opt/${APP}_version.txt msg_ok "Updated ${APP}" msg_info "Starting Services" systemctl start apache2 msg_ok "Started Services" - msg_info "Cleaning Up" - rm -rf ${RELEASE}.zip - msg_ok "Cleaned" msg_ok "Updated Successfully" else msg_ok "No update required. ${APP} is already at ${RELEASE}" diff --git a/frontend/public/json/wavelog.json b/frontend/public/json/wavelog.json index ba2232ae98..b9796efcee 100644 --- a/frontend/public/json/wavelog.json +++ b/frontend/public/json/wavelog.json @@ -12,7 +12,7 @@ "documentation": "https://github.com/wavelog/wavelog/wiki", "website": "https://www.wavelog.org/", "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/wavelog.webp", - "config_path": "", + "config_path": "/opt/wavelog/application/config/config.php", "description": "Wavelog is a self-hosted PHP application that allows you to log your amateur radio contacts anywhere. All you need is a web browser and active internet connection.", "install_methods": [ { diff --git a/install/wavelog-install.sh b/install/wavelog-install.sh index b1c54150dc..1eedb2f52f 100644 --- a/install/wavelog-install.sh +++ b/install/wavelog-install.sh @@ -13,13 +13,9 @@ setting_up_container network_check update_os -msg_info "Installing Dependencies" -$STD apt-get install -y \ - libapache2-mod-php \ - php8.2-{curl,mbstring,mysql,xml,zip,gd} -msg_ok "Installed Dependencies" - +PHP_VERSION="8.3" PHP_MODULE="mysql" PHP_APACHE="YES" PHP_MAX_EXECUTION_TIME="600" setup_php setup_mariadb +fetch_and_deploy_gh_release "wavelog" "wavelog/wavelog" "tarball" msg_info "Setting up Database" DB_NAME=wavelog @@ -36,22 +32,11 @@ $STD mariadb -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUS } >>~/wavelog.creds msg_ok "Set up database" -msg_info "Setting up PHP" -sed -i '/max_execution_time/s/= .*/= 600/' /etc/php/8.2/apache2/php.ini -sed -i '/memory_limit/s/= .*/= 256M/' /etc/php/8.2/apache2/php.ini -sed -i '/upload_max_filesize/s/= .*/= 8M/' /etc/php/8.2/apache2/php.ini -msg_ok "Set up PHP" - -msg_info "Installing Wavelog" -RELEASE=$(curl -fsSL https://api.github.com/repos/wavelog/wavelog/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') -curl -fsSL "https://github.com/wavelog/wavelog/archive/refs/tags/${RELEASE}.zip" -o "${RELEASE}.zip" -$STD unzip ${RELEASE}.zip -mv wavelog-${RELEASE}/ /opt/wavelog +msg_info "Configuring Wavelog" chown -R www-data:www-data /opt/wavelog/ find /opt/wavelog/ -type d -exec chmod 755 {} \; find /opt/wavelog/ -type f -exec chmod 664 {} \; -echo "${RELEASE}" >/opt/${APPLICATION}_version.txt -msg_ok "Installed Wavelog" +msg_ok "Configured Wavelog" msg_info "Creating Service" cat </etc/apache2/sites-available/wavelog.conf @@ -78,7 +63,6 @@ motd_ssh customize msg_info "Cleaning up" -rm -f ${RELEASE}.zip $STD apt-get -y autoremove $STD apt-get -y autoclean msg_ok "Cleaned"