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