This commit is contained in:
Slaviša Arežina 2025-08-22 20:17:32 +02:00 committed by GitHub
parent c207d65b1b
commit e72f248918
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 19 deletions

View File

@ -27,29 +27,25 @@ function update_script() {
msg_error "No ${APP} Installation Found!"
exit
fi
RELEASE=$(curl -fsSL https://api.github.com/repos/phpipam/phpipam/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
if [[ ! -f ~/.phpipam ]] || [[ "${RELEASE}" != "$(cat ~/.phpipam 2>/dev/null)" ]]; then
msg_info "Stopping Service"
systemctl stop apache2
msg_ok "Stopped Service"
msg_info "Updating ${APP} to v${RELEASE}"
cd /opt
mv /opt/phpipam/ /opt/phpipam-backup
curl -fsSL "https://github.com/phpipam/phpipam/releases/download/v${RELEASE}/phpipam-v${RELEASE}.zip" -o $(basename "https://github.com/phpipam/phpipam/releases/download/v${RELEASE}/phpipam-v${RELEASE}.zip")
$STD unzip "phpipam-v${RELEASE}.zip"
fetch_and_deploy_gh_release "phpipam" "phpipam/phpipam" "prebuild" "latest" "/opt/phpipam" "phpipam-v*.zip"
cp /opt/phpipam-backup/config.php /opt/phpipam
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated $APP to v${RELEASE}"
msg_info "Starting Service"
systemctl start apache2
msg_ok "Started Service"
msg_info "Cleaning up"
rm -r "/opt/phpipam-v${RELEASE}.zip"
rm -r /opt/phpipam-backup
msg_ok "Cleaned"
msg_ok "Updated Successfully"
else
msg_ok "No update required. ${APP} is already at v${RELEASE}"

View File

@ -14,13 +14,10 @@ network_check
update_os
msg_info "Installing Dependencies"
$STD apt-get install -y \
apache2 \
libapache2-mod-php \
php8.2 php8.2-{fpm,curl,cli,mysql,gd,intl,imap,apcu,pspell,tidy,xmlrpc,mbstring,gmp,xml,ldap,common,snmp} \
php-pear
$STD apt-get install -y php-pear
msg_ok "Installed Dependencies"
PHP_VERSION="8.2" PHP_APACHE="YES" PHP_FPM="YES" PHP_MODULE="mysql,imap,apcu,pspell,tidy,xmlrpc,gmp,ldap,common,snmp" setup_php
setup_mariadb
msg_info "Setting up MariaDB"
@ -38,11 +35,9 @@ $STD mariadb -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUS
} >>~/phpipam.creds
msg_ok "Set up MariaDB"
fetch_and_deploy_gh_release "phpipam" "phpipam/phpipam" "prebuild" "latest" "/opt/phpipam" "phpipam-v*.zip"
msg_info "Installing phpIPAM"
RELEASE=$(curl -fsSL https://api.github.com/repos/phpipam/phpipam/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
cd /opt
curl -fsSL "https://github.com/phpipam/phpipam/releases/download/v${RELEASE}/phpipam-v${RELEASE}.zip" -o "phpipam-v${RELEASE}.zip"
$STD unzip "phpipam-v${RELEASE}.zip"
$STD mariadb -u root "${DB_NAME}" </opt/phpipam/db/SCHEMA.sql
cp /opt/phpipam/config.dist.php /opt/phpipam/config.php
sed -i -e "s/\(\$disable_installer = \).*/\1true;/" \
@ -51,7 +46,6 @@ sed -i -e "s/\(\$disable_installer = \).*/\1true;/" \
-e "s/\(\$db\['name'\] = \).*/\1'$DB_NAME';/" \
/opt/phpipam/config.php
sed -i '/max_execution_time/s/= .*/= 600/' /etc/php/8.2/apache2/php.ini
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
msg_ok "Installed phpIPAM"
msg_info "Creating Service"
@ -79,7 +73,6 @@ motd_ssh
customize
msg_info "Cleaning up"
rm -rf "/opt/phpipam-v${RELEASE}.zip"
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"