diff --git a/ct/homebox.sh b/ct/homebox.sh index edbf48387..16f5f1504 100644 --- a/ct/homebox.sh +++ b/ct/homebox.sh @@ -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}" \ No newline at end of file +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:7745${CL}" diff --git a/frontend/public/json/homebox.json b/frontend/public/json/homebox.json index e1163aadd..795b8e452 100644 --- a/frontend/public/json/homebox.json +++ b/frontend/public/json/homebox.json @@ -9,10 +9,10 @@ "updateable": true, "privileged": false, "interface_port": 7745, - "documentation": null, + "documentation": "https://homebox.software/en/quick-start.html", "website": "https://homebox.software/en/", "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/homebox.webp", - "config_path": "/opt/.env", + "config_path": "/opt/homebox/.env", "description": "HomeBox is a simple, home-focused inventory management software. It allows users to organize and track household items by adding, updating, or deleting them. Features include optional details like warranty info, CSV import/export, custom labels, locations, and multi-tenant support for sharing with others. It\u2019s designed to be fast, easy to use, and portable.", "install_methods": [ { @@ -31,10 +31,5 @@ "username": null, "password": null }, - "notes": [ - { - "text": ".env file location: `/opt/.env`", - "type": "info" - } - ] + "notes": [] } diff --git a/install/homebox-install.sh b/install/homebox-install.sh index ba42195ab..3cc60813f 100644 --- a/install/homebox-install.sh +++ b/install/homebox-install.sh @@ -14,18 +14,17 @@ setting_up_container network_check update_os -msg_info "Installing Homebox" -RELEASE=$(curl -fsSL https://api.github.com/repos/sysadminsmedia/homebox/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') -curl -fsSL "https://github.com/sysadminsmedia/homebox/releases/download/${RELEASE}/homebox_Linux_x86_64.tar.gz" | tar -xzf - -C /opt -chmod +x /opt/homebox -cat </opt/.env +fetch_and_deploy_gh_release "homebox" "sysadminsmedia/homebox" "prebuild" "latest" "/opt/homebox" "homebox_Linux_x86_64.tar.gz" + +msg_info "Configuring Homebox" +chmod +x /opt/homebox/homebox +cat </opt/homebox/.env # For possible environment variables check here: https://homebox.software/en/configure-homebox HBOX_MODE=production HBOX_WEB_PORT=7745 HBOX_WEB_HOST=0.0.0.0 EOF -echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt" -msg_ok "Installed Homebox" +msg_ok "Configured Homebox" msg_info "Creating Service" cat </etc/systemd/system/homebox.service @@ -34,9 +33,9 @@ Description=Start Homebox Service After=network.target [Service] -WorkingDirectory=/opt -ExecStart=/opt/homebox -EnvironmentFile=/opt/.env +WorkingDirectory=/opt/homebox +ExecStart=/opt/homebox/homebox +EnvironmentFile=/opt/homebox/.env Restart=on-failure [Install]