HEX
Server: Apache/2.4.63 (Unix)
System: Linux TOMS-220NAS 4.4.302+ #86009 SMP Wed Nov 26 18:19:17 CST 2025 x86_64
User: flavio87 (1026)
PHP: 8.3.27
Disabled: NONE
Upload Files
File: //usr/syno/lib/systemd/scripts/syno_bundle_firmware_upgrade_notify.sh
#!/bin/sh
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.

notificationSource='/var/lib/drive-bundle/notification-source'
launchSource='/var/lib/drive-bundle/launch-summary-source'
postHandleResult='/var/lib/drive-bundle/post-handle-result'
if [ -f "${postHandleResult}" ]; then
	if /usr/syno/sbin/synofwupgrade --post-handle-result; then
		/bin/rm "${postHandleResult}"
	else
		/bin/logger --tag "$(/bin/basename "$0")" --priority user.warn "Failed to do firmware upgrade post handle result"
		/bin/rm "${notificationSource}" "${launchSource}" "${postHandleResult}"
	fi
fi

if [ ! -f "${notificationSource}" ]; then
	exit 0
fi

if [ "yes" = "$(/usr/syno/sbin/synohacore --is_ha_running)" ] && [ "yes" != "$(/usr/syno/bin/synogetkeyvalue /etc.defaults/synoinfo.conf support_xa)" ]; then
	exit 0
fi

if [ "yes" = "$(/usr/syno/bin/synogetkeyvalue /etc.defaults/synoinfo.conf support_hyper_converged)" ]; then
	exit 0
fi

resp=$(/usr/syno/bin/synowebapi --exec 'api=SYNO.Core.Storage.Disk.FWUpgrade' 'method=get_summary' 'source="notification"' 2> /dev/null)
if [ "true" != "$(/bin/echo "${resp}" | /bin/jq .success)" ] || [ "true" != "$(/bin/echo "${resp}" | /bin/jq .data.success)" ]; then
	exit 0
fi

summaryJson="$(/bin/echo "${resp}" | /bin/jq -c .data)"
param="{\"summaryList\": [${summaryJson}], \"ui_state\": \"single_summary\"}"
resp=$(/usr/syno/bin/synowebapi --exec 'api=SYNO.Core.Storage.Disk.FWUpgrade' 'method=send_notification' "ui_json=${param}" 2> /dev/null)
if [ "true" = "$(/bin/echo "$resp" | /bin/jq .success)" ]; then
	/usr/syno/bin/synowebapi --exec 'api=SYNO.Core.Storage.Disk.FWUpgrade' 'method=cancel_send_notification' > /dev/null 2>&1
fi
exit 0