Advertisement
Guest User

Untitled

a guest
Jun 10th, 2017
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.12 KB | None | 0 0
  1. #!/bin/bash
  2. # set variables for easy access
  3. $username = "rtorrent"
  4. $password = "rtor"
  5. $s3bucketname = "s3-conf-bootscripts"
  6. echo "+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+="
  7. echo "=     Adding webmin repository   +"
  8. echo "+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+="
  9. sleep 2
  10. echo "deb http://download.webmin.com/download/repository sarge contrib" >> /etc/apt/sources.list
  11. cd /root
  12. wget http://www.webmin.com/jcameron-key.asc
  13. apt-key add jcameron-key.asc
  14.  
  15. #       General updates and cleanup
  16. echo "+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+="
  17. echo "=     General updates and cleanup    +"
  18. echo "+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+="
  19. sleep 1
  20. apt update -y
  21. apt dist-upgrade -y
  22. apt autoremove -y
  23.  
  24. #       install necessities and dependencies
  25. echo "+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+="
  26. echo "=      Installing this shit       +"
  27. echo "+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+="
  28. sleep 1
  29. apt install apache2 vim-nox screen vnstat webmin munin-node build-essential subversion autoconf g++ gcc ntp curl comerr-dev pkg-config cfv libtool libssl-dev libncurses5-dev ncurses-term libsigc++-2.0-dev libcppunit-dev libcurl3 libcurl4-openssl-dev git apt-transport-https apache2-utils libapache2-mod-php -y
  30. vnstat -u
  31.  
  32. #       XML-RPC install
  33. echo "+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"
  34. echo "=     installing XML-RPC      ="
  35. echo "+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"
  36. sleep 2
  37. svn co -q https://svn.code.sf.net/p/xmlrpc-c/code/stable /tmp/xmlrpc-c
  38. cd /tmp/xmlrpc-c
  39. ./configure --disable-libwww-client --disable-wininet-client --disable-abyss-server --disable-cgi-server
  40. make -j4
  41. sudo make install
  42.  
  43. #       Libtorrent install
  44. echo "+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"
  45. echo "=     installing libtorrent     ="
  46. echo "+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"
  47. sleep 2
  48. cd /tmp
  49. curl http://rtorrent.net/downloads/libtorrent-0.13.6.tar.gz | tar xz
  50. cd libtorrent-0.13.6
  51. ./autogen.sh
  52. ./configure
  53. make -j4
  54. sudo make install
  55.  
  56. #       Setting up user/rtorrent environment
  57. echo "+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+="
  58. echo "=     Setting up rtorrent environment        +"
  59. echo "+     Downloading and installing rtorrent    ="
  60. echo "=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"
  61. sleep 2
  62. cd /tmp
  63. curl http://rtorrent.net/downloads/rtorrent-0.9.6.tar.gz | tar xzcd rtorrent-0.9.6
  64. ./autogen.sh
  65. ./configure --with-xmlrpc-c
  66. make -j4
  67. sudo make install
  68. sudo ldconfig
  69.  
  70. #       Creating user
  71. echo "+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+="
  72. echo "=     Setting up rtorrent environment        +"
  73. echo "+         Creating rtorrent user             ="
  74. echo "=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"
  75. useradd -m -p $(perl -e 'print crypt($ARGV[0], "password")' $password) $username
  76.  
  77. echo "+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+="
  78. echo "=     Setting up rtorrent environment        +"
  79. echo "+     Setting up folders                     ="
  80. echo "=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"
  81. sleep 1
  82. cd /home/rtorrent
  83. mkdir -p .session
  84. mkdir -p watch/{tv,films,games,apps,music}
  85. mkdir -p downloads/{_completed,tv,films,games,apps,music}
  86. mkdir -p downloads/_completed/{tv,films,games,apps,music}
  87. chown -R rtorrent:rtorrent /home/rtorrent/
  88.  
  89. #       add script to set rtorrent to start on boot - maybe do irssi as well?
  90. echo "+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+="
  91. echo "=     Setting up rtorrent environment        +"
  92. echo "+     Making rtorrent start on boot          ="
  93. echo "=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"
  94. sleep 1
  95. aws s3 cp s3://$s3bucketname/rtorrent-conf/.rtorrent.rc /home/rtorrent/.rtorrent.rc
  96. aws s3 cp s3://$s3bucketname/linux-conf/rtorrent_init.sh /etc/init.d/rtorrent
  97. chmod +x /etc/init.d/rtorrent
  98. update-rc.d rtorrent defaults 99
  99.  
  100. #       installing rutorrent
  101. echo "+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+="
  102. echo "=     Setting up rtorrent environment        +"
  103. echo "+             Setting up apache              ="
  104. echo "=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"
  105. sleep 1
  106. a2enmod auth_digest ssl reqtimeout
  107. #TODO   back up apache2 config file, adapt and upload somewhere to be echo'ed into /etc/apache2/apache2.conf
  108. echo "+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+="
  109. echo "=     Setting up rtorrent environment        +"
  110. echo "+     Downloading config files for apache2   ="
  111. echo "=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"
  112. aws s3 cp s3://$s3bucketname/apache-conf/apache2.conf /etc/apache2/apache2.conf
  113. aws s3 cp s3://$s3bucketname/apache-conf/.htpasswd /etc/apache2/.htpasswd
  114. aws s3 cp s3://$s3bucketname/apache-conf/sites-available/rtorrent.conf /etc/apache2/sites-available/rtorrent.conf
  115. a2dissite 000-default
  116. a2ensite rtorrent
  117. service apache2 restart
  118.  
  119. cd /var/www/html
  120. git clone https://github.com/Novik/ruTorrent.git rutorrent
  121. rm -r rutorrent/plugins
  122. svn checkout https://github.com/Novik/ruTorrent/trunk/plugins rutorrent/plugins
  123.  
  124.  
  125. # TODO   set the config files straight
  126. aws s3 cp s3://$s3bucketname/rtorrent-config/rutorrent/config.php /var/www/html/rutorrent/conf/config.php
  127. # TODO figure out where autotools saves its configuration and back this up.
  128.  
  129. chown -R www-data:www-data /var/www/
  130. chmod -R 0755 /var/www/
  131. # TODO figure out where autotools saves its configuration and back this up.
  132. reboot now
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement