diff --git a/openwrt/xunlei/files/xunlei.init b/openwrt/xunlei/files/xunlei.init index fbd0654..f1b9c52 100755 --- a/openwrt/xunlei/files/xunlei.init +++ b/openwrt/xunlei/files/xunlei.init @@ -17,13 +17,23 @@ start_service() { config_foreach get_config xunlei [ $enabled -ne 1 ] && return 1 - if [ ! -d /usr/share/xunlei/target/var ];then + if [ ! -d "/usr/share/xunlei/target/var" ];then id=$(cat /proc/sys/kernel/random/uuid | cut -c1-7) echo "unique=\"synology_${id}_720+\"" > /usr/share/xunlei/target/host/etc/synoinfo.conf fi - [ ! -d /var/packages/pan-xunlei-com ] && ln -s /usr/share/xunlei /var/packages/pan-xunlei-com - [ ! -f /etc/synoinfo.conf ] && ln -s /usr/share/xunlei/target/host/etc/synoinfo.conf /etc/synoinfo.conf - [ ! -f /usr/syno/synoman/webman/modules/authenticate.cgi ] && ln -s /usr/share/xunlei/target/host/usr/syno/synoman/webman/modules/authenticate.cgi /usr/syno/synoman/webman/modules/authenticate.cgi + + if [ -f /etc/synoinfo.conf ];then + rm /etc/synoinfo.conf + fi + + if [ -f /usr/syno/synoman/webman/modules/authenticate.cgi ];then + rm /usr/syno/synoman/webman/modules/authenticate.cgi + fi + + rm -rf /var/packages/pan-xunlei-com + ln -s /usr/share/xunlei /var/packages/pan-xunlei-com + ln -s /usr/share/xunlei/target/host/etc/synoinfo.conf /etc/synoinfo.conf + ln -s /usr/share/xunlei/target/host/usr/syno/synoman/webman/modules/authenticate.cgi /usr/syno/synoman/webman/modules/authenticate.cgi args="--host $host --port $port --config-path $config_path --download-path $download_path" procd_open_instance procd_set_param command $PROG launch $args @@ -37,12 +47,6 @@ service_triggers() { procd_add_reload_trigger "xunlei" } -stop_service() { - [ -f /etc/synoinfo.conf ] && rm /etc/synoinfo.conf - [ -f /usr/syno/synoman/webman/modules/authenticate.cgi ] && rm /usr/syno/synoman/webman/modules/authenticate.cgi - [ -d /var/packages/pan-xunlei-com ] && rm /var/packages/pan-xunlei-com -} - reload_service() { stop sleep 3