#!/bin/sh
DDNSHOME="/usr/syno/synoman/webman/3rdparty/ddnsupdater"
DSMMAJOR=`/bin/get_key_value /etc.defaults/VERSION majorversion`
DSMBUILD=`/bin/get_key_value /etc.defaults/VERSION buildnumber`
/var/packages/ddnsupdater/scripts/start-stop-status stop
/bin/sleep 1
if [ -h /usr/syno/synoman/webman/help/ger/DDNSupdater ] ; then
    /bin/mv /usr/syno/synoman/webman/3rdparty/ddnsupdater/helptoc.conf /tmp/helptoc.conf
    /usr/bin/php -n -d safe_mode_exec_dir=/usr/syno/bin /usr/syno/synoman/webman/modules/Indexer/indexer.php -d /tmp/helptoc.conf &
    /usr/bin/find /usr/syno/synoman/webman/help/ -type l -name "DDNSupdater" | while read langname; do
         /bin/rm -f "${langname}"
    done
fi
if [ ${DSMMAJOR} -ge 4 ] ; then
    /usr/syno/bin/pkgindexer_del ${DDNSHOME}/helptoc.conf ${DDNSHOME}/indexdb/helpindexdb
fi
if [ ${DSMBUILD} -ge 3750 ] ; then
     /bin/rm -f /usr/local/etc/syslog-ng/patterndb.d/ddclient_syslogclient.conf
     /bin/rm -f /usr/local/etc/syslog-ng/patterndb.d/ddclient_inet.conf
     /bin/rm -f /usr/local/etc/syslog-ng/patterndb.d/ddclient.conf
     /bin/rm -f /usr/local/etc/logrotate.d/ddclient_rotate.conf
fi
if [ ${DSMBUILD} -ge 4418 ] ; then
     /sbin/initctl restart syslog-ng
     /usr/bin/logrotate /etc/logrotate.conf
elif [ ${DSMBUILD} -ge 3750 ] ; then
     /usr/syno/etc/rc.d/S22syslogng.sh restart
     /usr/sbin/logrotate /etc/logrotate.conf
fi
exit 0
