Refactor: HomeBox (#6338)

* Refactor

* Refactor

* Update
This commit is contained in:
Slaviša Arežina 2025-07-29 15:06:52 +02:00 committed by GitHub
parent 815720b59e
commit ab6f2dd24f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 32 deletions

View file

@ -22,26 +22,24 @@ function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -f /opt/homebox ]]; then
if [[ ! -d /opt/homebox ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
RELEASE=$(curl -fsSL https://api.github.com/repos/sysadminsmedia/homebox/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
if [[ -x /opt/homebox ]]; then
sed -i 's|/opt\b|/opt/homebox|g' /etc/systemd/system/homebox.service
sed -i 's|^ExecStart=/opt/homebox$|ExecStart=/opt/homebox/homebox|' /etc/systemd/system/homebox.service
fi
RELEASE=$(curl -fsSL https://api.github.com/repos/sysadminsmedia/homebox/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
if [[ "${RELEASE}" != "$(cat ~/.homebox 2>/dev/null)" ]] || [[ ! -f ~/.homebox ]]; then
msg_info "Stopping ${APP}"
systemctl stop homebox
msg_ok "${APP} Stopped"
msg_info "Updating ${APP} to ${RELEASE}"
cd /opt
rm -rf homebox_bak
rm -rf /tmp/homebox.tar.gz
mv homebox homebox_bak
curl -fsSL "https://github.com/sysadminsmedia/homebox/releases/download/${RELEASE}/homebox_Linux_x86_64.tar.gz" -o "/tmp/homebox.tar.gz"
tar -xzf /tmp/homebox.tar.gz -C /opt
chmod +x /opt/homebox
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated Homebox"
fetch_and_deploy_gh_release "homebox" "sysadminsmedia/homebox" "prebuild" "latest" "/opt/homebox" "homebox_Linux_x86_64.tar.gz"
chmod +x /opt/homebox/homebox
[ -f /opt/.env ] && mv /opt/.env /opt/homebox/.env
msg_info "Starting ${APP}"
systemctl start homebox
@ -61,4 +59,4 @@ description
msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:7745${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:7745${CL}"