Refactor (#8552)
This commit is contained in:
parent
cc4b944b3b
commit
87ae749eba
@ -27,31 +27,28 @@ function update_script() {
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/projectsend/projectsend/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 check_for_gh_release "projectsend" "projectsend/projectsend"; then
|
||||
msg_info "Stopping Service"
|
||||
systemctl stop apache2
|
||||
msg_ok "Stopped Service"
|
||||
|
||||
msg_info "Updating ${APP} to v${RELEASE}"
|
||||
cd /opt
|
||||
curl -fsSL "https://github.com/projectsend/projectsend/releases/download/r${RELEASE}/projectsend-r${RELEASE}.zip" -o $(basename "https://github.com/projectsend/projectsend/releases/download/r${RELEASE}/projectsend-r${RELEASE}.zip")
|
||||
$STD unzip -o "projectsend-r${RELEASE}.zip" -d projectsend
|
||||
php_ver=$(php -v | head -n 1 | awk '{print $2}')
|
||||
if [[ ! $php_ver == "8.4"* ]]; then
|
||||
PHP_VERSION="8.4" PHP_APACHE="YES" PHP_MODULE="pdo,mysql,gettext,fileinfo" setup_php
|
||||
fi
|
||||
|
||||
mv /opt/projectsend/includes/sys.config.php /opt/sys.config.php
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "projectsend" "projectsend/projectsend" "prebuild" "latest" "/opt/projectsend" "projectsend-r*.zip"
|
||||
mv /opt/sys.config.php /opt/projectsend/includes/sys.config.php
|
||||
chown -R www-data:www-data /opt/projectsend
|
||||
chmod -R 775 /opt/projectsend
|
||||
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 -rf "/opt/projectsend-r${RELEASE}.zip"
|
||||
msg_ok "Cleaned"
|
||||
msg_ok "Updated Successfully"
|
||||
else
|
||||
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
@ -13,14 +13,9 @@ setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt install -y \
|
||||
apache2 \
|
||||
libapache2-mod-php \
|
||||
php8.2-{pdo,mysql,mbstring,gettext,fileinfo,gd,xml,zip}
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
PHP_VERSION="8.4" PHP_APACHE="YES" PHP_MODULE="pdo,mysql,gettext,fileinfo" setup_php
|
||||
setup_mariadb
|
||||
fetch_and_deploy_gh_release "projectsend" "projectsend/projectsend" "prebuild" "latest" "/opt/projectsend" "projectsend-r*.zip"
|
||||
|
||||
msg_info "Setting up MariaDB"
|
||||
DB_NAME=projectsend
|
||||
@ -37,12 +32,7 @@ $STD mariadb -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUS
|
||||
} >>~/projectsend.creds
|
||||
msg_ok "Set up MariaDB"
|
||||
|
||||
msg_info "Installing projectsend"
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/projectsend/projectsend/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
cd /opt
|
||||
curl -fsSL "https://github.com/projectsend/projectsend/releases/download/r${RELEASE}/projectsend-r${RELEASE}.zip" -o "projectsend-r${RELEASE}.zip"
|
||||
mkdir projectsend
|
||||
$STD unzip "projectsend-r${RELEASE}.zip" -d projectsend
|
||||
msg_info "Installing ProjectSend"
|
||||
mv /opt/projectsend/includes/sys.config.sample.php /opt/projectsend/includes/sys.config.php
|
||||
chown -R www-data:www-data /opt/projectsend
|
||||
chmod -R 775 /opt/projectsend
|
||||
@ -55,8 +45,7 @@ sed -i -e "s/^\(memory_limit = \).*/\1 256M/" \
|
||||
-e "s/^\(post_max_size = \).*/\1 256M/" \
|
||||
-e "s/^\(upload_max_filesize = \).*/\1 256M/" \
|
||||
-e "s/^\(max_execution_time = \).*/\1 300/" \
|
||||
/etc/php/8.2/apache2/php.ini
|
||||
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
||||
/etc/php/8.4/apache2/php.ini
|
||||
msg_ok "Installed projectsend"
|
||||
|
||||
msg_info "Creating Service"
|
||||
@ -84,7 +73,6 @@ motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
rm -rf "/opt/projectsend-r${RELEASE}.zip"
|
||||
$STD apt -y autoremove
|
||||
$STD apt -y autoclean
|
||||
$STD apt -y clean
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user