File: //var/packages/WebStation/scripts/postuninst
#!/bin/sh
CONFIG_PATH="/usr/syno/etc/packages/WebStation"
PHP_CONFIG_DIRS="php56 php70"
if [ "$SYNOPKG_PKG_STATUS" != UPGRADE ]; then
if [ "$pkgwizard_remove_setting" = "true" ]; then
rm -rf "$CONFIG_PATH/"
else
for dir in ${PHP_CONFIG_DIRS}; do
if [ -d "${CONFIG_PATH}/${dir}" ]; then
/usr/bin/rm -r "${CONFIG_PATH:?}/${dir:?}"
fi
done
fi
if [ -L /usr/local/etc/suphp ]; then
/usr/bin/rm -r /usr/local/etc/suphp
fi
if [ -f /usr/syno/numanod/conf/conf_webstation_php ]; then
/usr/bin/rm /usr/syno/numanod/conf/conf_webstation_php
fi
fi
service=$(/usr/bin/find /etc/systemd/system/pkgctl-WebStation.service.wants/ -name "pkg-WebStation-*" -printf "%f\n")
/usr/syno/bin/synosystemctl disable $service
serviceTemplate=$(/usr/bin/find /usr/local/lib/systemd/system/ -name "pkg-WebStation-*@*")
/usr/bin/rm $serviceTemplate
remove_list=server.webstation.conf,server.webstation-vhost.conf
files=$(/usr/bin/find /usr/local/etc/nginx/sites-enabled/ -printf "%f\n"|grep ^webservice_portal_.*)
if [ $? -eq 0 ]; then
for f in $files ; do
remove_list="$remove_list,$f"
done
fi
/usr/syno/bin/synow3tool --unreg-nginx-sites="$remove_list"
remove_list=.location.webstation.conf
files=$(/usr/bin/find /usr/local/etc/nginx/conf.d/ -printf "%f\n" |grep \
-e "^\.service.*\.conf$" \
-e "^www\.webservice_portal_.*\.conf$" \
-e "^\.webstation\.error_page\.*\.conf$")
if [ $? -eq 0 ]; then
for f in $files ; do
remove_list="$remove_list,$f"
done
fi
/usr/syno/bin/synow3tool --unreg-nginx-confd=$remove_list
/usr/syno/bin/synohtmlhandler hdpack --unreg /var/packages/WebStation/var/shortcut/images
/usr/bin/rm /usr/syno/synoman/webman/3rdparty/WebService
exit 0