* improve DSM package maintenance scripts to avoid things breaking for each DSM update

This commit is contained in:
Reinhard Pointner 2015-02-23 07:02:25 +00:00
parent 628619bf7d
commit 2c90b92625
3 changed files with 42 additions and 8 deletions

View File

@ -4,8 +4,6 @@
mkdir -m 777 "$SYNOPKG_PKGDEST/data"
chown -R admin.users "$SYNOPKG_PKGDEST/data"
# create /bin symlink
ln -s -f "$SYNOPKG_PKGDEST/filebot.sh" /usr/local/bin/filebot
# end
# return successfully
exit 0

View File

@ -1,6 +1,2 @@
#!/bin/sh
# remove /bin symlink
rm -f /usr/local/bin/filebot
exit 0

View File

@ -1,2 +1,42 @@
#!/bin/sh
exit 0
# symlink to /bin on START and unlink on STOP
FILEBOT_BINARY="/usr/syno/bin/filebot"
case "$1" in
start)
# When the user clicks the button "Run" to run the package, after the package is installed, or when the DiskStation is turned on.
ln -s "$SYNOPKG_PKGDEST/filebot.sh" "$FILEBOT_BINARY"
exit 0
;;
stop)
# When the user clicks the button "Stop" to stop the running package, before the package is uninstalled, or when the DiskStation is turned off.
rm -f "$FILEBOT_BINARY"
exit 0
;;
status)
# When Package Center is opened to check package status, the Center will send a request to ask the status of the package with this parameter.
if [ -e "$FILEBOT_BINARY" ]; then
# 0: package is running
exit 0
else
# 3: package is not running
exit 1
fi
;;
log)
LOGFILE="$SYNOPKG_PKGDEST/sysinfo.log"
"$SYNOPKG_PKGDEST/filebot.sh" -script fn:sysinfo 2>&1 > "$LOGFILE"
echo $LOGFILE
exit 0
;;
*)
echo "start-stop-status called with unknown argument \`$1'" >&2
exit 1
;;
esac