mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-09-11 01:44:38 +00:00
Refactor (#6869)
This commit is contained in:
parent
032709e107
commit
ee74400626
3 changed files with 14 additions and 31 deletions
|
@ -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}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue