原帖:http://forum.synology.com/enu/viewtopic.php?f=38&t=21990
这个脚本是ARM NAS通用的,细节代码可能需要修改。
- #!/bin/sh
- LIGHTTPDCONF=/opt/etc/lighttpd/lighttpd.conf
- RTORRENTCONF=/opt/etc/rtorrent.conf
- mkdir -p /volume1/@tmp
- cd /volume1/@tmp/
- # IPKG
- echo -e "\033[1mInstalling IPKG\033[0m"
- wget http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/syno-mvkw-bootstrap_1.2-7_arm.xsh
- sh syno-mvkw-bootstrap_1.2-7_arm.xsh &
- sleep 20
- ipkg update
- # Lighttpd
- echo -e "\033[1mInstalling Lighttpd\033[0m"
- ipkg install lighttpd php-fcgi
- echo 'server.event-handler = "poll"' >> ${LIGHTTPDCONF}
- echo 'server.modules += ("mod_auth","mod_cgi","mod_scgi")' >> ${LIGHTTPDCONF}
- echo '
- scgi.server = ("/RPC2" =>
- ("127.0.0.1" =>
- ("host" => "127.0.0.1",
- "port" => 5050,
- "check-local" => "disable")
- )
- )
- ' >> ${LIGHTTPDCONF}
- # rtorrent
- echo -e "\033[1mInstalling RTorrent\033[0m"
- ipkg install rtorrent screen
- ipkg remove xmlrpc-c
- mkdir -p /opt/share/torrent/session/
- echo 'scgi_port = 127.0.0.1:5050' >> ${RTORRENTCONF}
- echo '#!/bin/sh
- NAME=rtorrent
- CONFIG=/opt/etc/rtorrent.conf
- LOGFILE=/opt/var/log/rtorrentInit.log
- TORRENTFILE=/opt/bin/rtorrent
- OPTIONS="-n -o import=$CONFIG"
- getsession() {
- session=`sed -n "/session\s*=/s/^\s*session\s*=\s*//p" $CONFIG`
- echo $session
- }
- case "$1" in
- start)
- screen -list|grep -sq $NAME && exit 0
- session=`getsession`
- [ -e $session/rtorrent.lock ] && rm -rf $session/rtorrent.lock
- /opt/bin/screen -dmS $NAME $TORRENTFILE $OPTIONS 2>$LOGFILE
- ;;
- stop)
- session=`getsession`
- ! [ -e $session/rtorrent.lock ] && exit 0
- pid=`sed "s/[^0-9]//g" $session/rtorrent.lock`
- ps|grep -v grep|grep -sq $pid.*rtorrent && kill $pid
- ;;
- restart)
- $0 stop
- sleep 2
- $0 start
- ;;
- status)
- screen -list|grep -s $NAME
- ;;
- *)
- echo $"Usage: \$0 {start|stop|status|restart}"
- exit 1
- esac
- exit 0
- ' > /opt/etc/init.d/S99rtorrent
- # xmlrpc-c
- echo -e "\033[1mInstalling xmlrpc-c\033[0m"
- ipkg install gcc binutils optware-devel libcurl-dev
- svn co http://xmlrpc-c.svn.sourceforge.net/svnroot/xmlrpc-c/stable xmlrpc-c
- cd xmlrpc-c
- ./configure --prefix=/opt
- make ARCH=arm
- make install
- # ruTorrent 3.0
- echo -e "\033[1mInstalling ruTorrent\033[0m"
- cd /opt/share/www
- svn co http://rutorrent.googlecode.com/svn/trunk/rutorrent/
- cd rutorrent
- rm -r plugins
- svn co http://rutorrent.googlecode.com/svn/trunk/plugins/
- cd plugins
- rm -r darkpal rpc
- cd ..
- sed -i 's/scgi_port\s*=\s*5000/scgi_port = 5050/' conf/config.php
- echo -e "\033[1mAutoinstall complete\033[0m"
- reboot
复制代码
|