Compare commits

...

3 Commits

Author SHA1 Message Date
MickLesk
d499a6b2dd Update gotify.sh 2026-07-20 09:20:54 +02:00
MickLesk
93da47c36c Add config.yml to env migration for Gotify 3.x
During updates, automatically migrate config.yml to the env format required by Gotify 3.x using the built-in migrate-config command. The original config.yml is backed up as config.yml.bak on success, or left in place with a warning on failure.
2026-07-20 09:10:39 +02:00
MickLesk
eb47332388 Update Gotify service for 3.x startup
Adjust the Gotify systemd unit to start the binary with the new `serve` subcommand required by Gotify 3.x, and add update-time migration logic to patch existing installations before reloading systemd.
2026-07-20 09:02:00 +02:00
2 changed files with 25 additions and 1 deletions

View File

@@ -36,6 +36,30 @@ function update_script() {
fetch_and_deploy_gh_release "gotify" "gotify/server" "prebuild" "latest" "/opt/gotify" "gotify-linux-$(arch_resolve).zip"
chmod +x /opt/gotify/gotify-linux-$(arch_resolve)
if [[ ! -f /opt/gotify/gotify-server.env ]]; then
gotify_old_config=""
for f in /opt/gotify/config.yml /etc/gotify/config.yml; do
[[ -f "$f" ]] && gotify_old_config="$f" && break
done
if [[ -n "$gotify_old_config" ]]; then
msg_info "Migrating ${gotify_old_config} to env format (Gotify 3.x)"
if /opt/gotify/gotify-linux-$(arch_resolve) migrate-config "$gotify_old_config" >/opt/gotify/gotify-server.env 2>/dev/null; then
mv "$gotify_old_config" "${gotify_old_config}.bak"
msg_ok "Migrated config to /opt/gotify/gotify-server.env (backup: ${gotify_old_config}.bak)"
else
rm -f /opt/gotify/gotify-server.env
msg_warn "Config migration failed — left ${gotify_old_config} in place, review manually"
fi
fi
fi
if ! grep -qE '^ExecStart=.* serve' /etc/systemd/system/gotify.service 2>/dev/null; then
msg_info "Migrating service to serve subcommand (Gotify 3.x)"
sed -i -E 's|^(ExecStart=/opt/gotify/.*gotify-linux-[^ ]+)$|\1 serve|' /etc/systemd/system/gotify.service
systemctl daemon-reload
msg_ok "Migrated service to serve subcommand"
fi
msg_info "Starting Service"
systemctl start gotify
msg_ok "Started Service"

View File

@@ -27,7 +27,7 @@ After=network.target
Type=simple
User=root
WorkingDirectory=/opt/gotify
ExecStart=/opt/gotify/./gotify-linux-$(arch_resolve)
ExecStart=/opt/gotify/gotify-linux-$(arch_resolve) serve
Restart=always
RestartSec=3