Refactor (#7096)
This commit is contained in:
parent
1fce2de5c1
commit
07394b9a7d
@ -29,30 +29,25 @@ function update_script() {
|
||||
exit
|
||||
fi
|
||||
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/Pf2eToolsOrg/Pf2eTools/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f "/opt/${APP}_version.txt" ]]; then
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/Pf2eToolsOrg/Pf2eTools/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
if [[ "${RELEASE}" != "$(cat ~/.pf2etools 2>/dev/null)" ]] || [[ ! -f ~/.pf2etools ]]; then
|
||||
msg_info "Updating System"
|
||||
$STD apt-get update
|
||||
$STD apt-get -y upgrade
|
||||
msg_ok "Updated System"
|
||||
|
||||
rm -rf /opt/Pf2eTools
|
||||
fetch_and_deploy_gh_release "pf2etools" "Pf2eToolsOrg/Pf2eTools" "tarball" "latest" "/opt/Pf2eTools"
|
||||
|
||||
msg_info "Updating ${APP}"
|
||||
cd /opt
|
||||
curl -fsSL "https://github.com/Pf2eToolsOrg/Pf2eTools/archive/refs/tags/${RELEASE}.zip" -o $(basename "https://github.com/Pf2eToolsOrg/Pf2eTools/archive/refs/tags/${RELEASE}.zip")
|
||||
$STD unzip ${RELEASE}.zip
|
||||
rm -rf "/opt/${APP}"
|
||||
mv ${APP}-${RELEASE:1} /opt/${APP}
|
||||
cd /opt/Pf2eTools
|
||||
$STD npm install
|
||||
$STD npm run build
|
||||
chown -R www-data: "/opt/${APP}"
|
||||
chmod -R 755 "/opt/${APP}"
|
||||
echo "${RELEASE}" >"/opt/${APP}_version.txt"
|
||||
msg_ok "Updated ${APP}"
|
||||
|
||||
msg_info "Cleaning Up"
|
||||
rm -rf /opt/${RELEASE}.zip
|
||||
msg_ok "Cleanup Completed"
|
||||
msg_ok "Updated successfully"
|
||||
else
|
||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
||||
fi
|
||||
|
@ -21,18 +21,13 @@ $STD apt-get install -y \
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
NODE_VERSION="22" setup_nodejs
|
||||
fetch_and_deploy_gh_release "pf2etools" "Pf2eToolsOrg/Pf2eTools" "tarball" "latest" "/opt/Pf2eTools"
|
||||
|
||||
msg_info "Setup Pf2eTools"
|
||||
cd /opt
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/Pf2eToolsOrg/Pf2eTools/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||
curl -fsSL "https://github.com/Pf2eToolsOrg/Pf2eTools/archive/refs/tags/${RELEASE}.zip" -o "${RELEASE}.zip"
|
||||
$STD unzip "${RELEASE}.zip"
|
||||
mv "Pf2eTools-${RELEASE:1}" /opt/Pf2eTools
|
||||
msg_info "Configuring Pf2eTools"
|
||||
cd /opt/Pf2eTools
|
||||
$STD npm install
|
||||
$STD npm run build
|
||||
echo "${RELEASE}" >/opt/Pf2eTools_version.txt
|
||||
msg_ok "Set up Pf2eTools"
|
||||
msg_ok "Configured Pf2eTools"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >>/etc/apache2/apache2.conf
|
||||
@ -49,7 +44,6 @@ chmod -R 755 "/opt/Pf2eTools"
|
||||
msg_ok "Created Service"
|
||||
|
||||
msg_info "Cleaning up"
|
||||
rm -rf /opt/${RELEASE}.zip
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
||||
|
Loading…
x
Reference in New Issue
Block a user