My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions

Issue 37 attachment: setup.sh (3.3 KB)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/sh

install()
{
/share/Apps/AppInit/appinit.cgi stop transmission
/share/Apps/AppInit/appinit.cgi webserver_disable
wait

count=0
while [ $(pgrep transmission-daemon) ] && [[ $count -lt 60 ]]; do
echo 'Waiting for transmission stop'
sleep 1;
count=$(( count + 1 ));
done
count=0
while [ $(pgrep -f php5server) ] && [[ $count -lt 60 ]]; do
echo 'Waiting for php5server stop'
sleep 1;
count=$(( count + 1 ));
done

chmod -R 777 /share/Apps/TorrentExpander/
chown nmt:nmt /share/Apps/TorrentExpander/bin/torrentexpander_settings.ini

if [ -f "/usr/local/bin/opkg" ]; then
if [ ! -f "/usr/local/bin/unzip" ]; then
opkg install unzip;
wait;
fi
if [ ! -f "/usr/local/bin/unrar" ]; then
opkg install unrar;
wait;
fi
if [ ! -f "/usr/local/bin/wget" ]; then
opkg install wget;
wait;
fi
if [ ! -f "/usr/local/bin/busybox" ]; then
opkg install busybox;
wait;
fi
fi

if [ ! -e /share/Download/Expanded ]; then
mkdir /share/Download/Expanded -m 777
chown nmt:nmt /share/Download/Expanded
fi

if [ ! -e /share/Video/Movies ]; then
mkdir /share/Video/Movies -m 777
chown nmt:nmt /share/Video/Movies
fi

if [ ! -e /share/Video/Series ]; then
mkdir /share/Video/Series -m 777
chown nmt:nmt /share/Video/Series
fi

if [ -f "/share/Apps/Transmission/config/settings.json" ]; then
echo 'Editing config file'
cat /share/Apps/Transmission/config/settings.json | sed 's/^\( *\)\"script-torrent-done-enabled\"\: .*$/\1\"script-torrent-done-enabled\"\: true\,/g' | sed 's/^\( *\)\"script-torrent-done-filename\"\: .*$/\1\"script-torrent-done-filename\"\: \"\/share\/Apps\/TorrentExpander\/bin\/torrentexpander.sh \$TR_TORRENT_DIR\/\$TR_TORRENT_NAME\"\,/g' > /share/Apps/Transmission/config/settings.json
chmod 666 /share/Apps/Transmission/config/settings.json
chown nmt.root /share/Apps/Transmission/config/settings.json
ls -al /share/Apps/Transmission/config/settings.json
fi

/share/Apps/AppInit/appinit.cgi start transmission
/share/Apps/AppInit/appinit.cgi webserver_enable
wait
ls -al /share/Apps/Transmission/config/settings.json
}

uninstall()
{
/share/Apps/AppInit/appinit.cgi stop transmission
/share/Apps/AppInit/appinit.cgi webserver_disable
wait

count=0
while [ $(pgrep transmission-daemon) ] && [[ $count -lt 60 ]]; do
echo 'Waiting for transmission stop'
sleep 1;
count=$(( count + 1 ));
done
count=0
while [ $(pgrep -f php5server) ] && [[ $count -lt 60 ]]; do
echo 'Waiting for php5server stop'
sleep 1;
count=$(( count + 1 ));
done

if [ -f "/share/Apps/Transmission/config/settings.json" ]; then
echo 'Editing config file'
cat /share/Apps/Transmission/config/settings.json | sed 's/^\( *\)\"script-torrent-done-enabled\"\: .*$/\1\"script-torrent-done-enabled\"\: false\,/g' | sed 's/^\( *\)\"script-torrent-done-filename\"\: .*$/\1\"script-torrent-done-filename\"\: \"\",/g' > /share/Apps/Transmission/config/settings.json
chmod 666 /share/Apps/Transmission/config/settings.json
chown nmt.root /share/Apps/Transmission/config/settings.json
ls -al /share/Apps/Transmission/config/settings.json
fi

/share/Apps/AppInit/appinit.cgi start transmission
/share/Apps/AppInit/appinit.cgi webserver_enable
wait
ls -al /share/Apps/Transmission/config/settings.json
}


case "$1" in
install)
install
;;

uninstall)
uninstall
;;
esac
Powered by Google Project Hosting