Skip to content

Commit

Permalink
Update xunlei.init
Browse files Browse the repository at this point in the history
  • Loading branch information
0x676e67 committed May 1, 2023
1 parent c0c5d51 commit 06b3d89
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions openwrt/xunlei/files/xunlei.init
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 06b3d89

Please sign in to comment.