Advertisement
Guest User

quickbox-setup

a guest
Jan 13th, 2017
440
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 52.88 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # [QuickBox Installation Script]
  4. #
  5. # GitHub:   https://lab.quickbox.io/QuickBox/QuickBox
  6. # Author:   QuickBox.IO
  7. # URL:      https://plaza.quickbox.io
  8. #
  9. # QuickBox Copyright (C) 2016 QuickBox.io
  10. # Licensed under GNU General Public License v3.0 GPL-3 (in short)
  11. #
  12. #   You may copy, distribute and modify the software as long as you track
  13. #   changes/dates in source files. Any modifications to our software
  14. #   including (via compiler) GPL-licensed code must also be made available
  15. #   under the GPL along with build & install instructions.
  16. #
  17. #################################################################################
  18. #Script Console Colors
  19. black=$(tput setaf 0); red=$(tput setaf 1); green=$(tput setaf 2); yellow=$(tput setaf 3);
  20. blue=$(tput setaf 4); magenta=$(tput setaf 5); cyan=$(tput setaf 6); white=$(tput setaf 7);
  21. on_red=$(tput setab 1); on_green=$(tput setab 2); on_yellow=$(tput setab 3); on_blue=$(tput setab 4);
  22. on_magenta=$(tput setab 5); on_cyan=$(tput setab 6); on_white=$(tput setab 7); bold=$(tput bold);
  23. dim=$(tput dim); underline=$(tput smul); reset_underline=$(tput rmul); standout=$(tput smso);
  24. reset_standout=$(tput rmso); normal=$(tput sgr0); alert=${white}${on_red}; title=${standout};
  25. sub_title=${bold}${yellow}; repo_title=${black}${on_green}; message_title=${white}${on_magenta}
  26. #################################################################################
  27. function _string() { perl -le 'print map {(a..z,A..Z,0..9)[rand 62] } 0..pop' 15 ; }
  28. #################################################################################
  29.  
  30. function _bashrc() {
  31.   cp ${local_setup}templates/bashrc.template /root/.bashrc
  32.   profile="/root/.profile"
  33.   if [ ! -f $profile ]; then
  34.     cp ${local_setup}templates/profile.template /root/.profile
  35.   fi
  36. }
  37.  
  38. # intro function (1)
  39. function _intro() {
  40.   DISTRO=$(lsb_release -is)
  41.   RELEASE=$(lsb_release -rs)
  42.   CODENAME=$(lsb_release -cs)
  43.   SETNAME=$(lsb_release -rc)
  44.   echo
  45.   echo
  46.   echo "[${repo_title}QuickBox${normal}] ${title} QuickBox Seedbox Installation ${normal}  "
  47.   echo
  48.   echo "   ${title}              Heads Up!              ${normal} "
  49.   echo "   ${message_title}  QuickBox works with the following  ${normal} "
  50.   echo "   ${message_title}  Ubuntu 15.10 | 16.04 | 16.10       ${normal} "
  51.   echo "   ${message_title}  Devuan 8                           ${normal} "
  52.   echo
  53.   echo
  54.   echo "${green}Checking distribution ...${normal}"
  55.   if [ ! -x  /usr/bin/lsb_release ]; then
  56.     echo "It looks like you are running $DISTRO, which is not supported by QuickBox."
  57.     echo "Exiting..."
  58.     exit 1
  59.   fi
  60.   echo "$(lsb_release -a)"
  61.   echo
  62.   if [[ ! "$DISTRO" =~ ("Ubuntu"|"Devuan") ]]; then
  63.     echo "$DISTRO: ${alert} It looks like you are running $DISTRO, which is not supported by QuickBox ${normal} "
  64.     echo 'Exiting...'
  65.     exit 1
  66.   elif [[ ! "$CODENAME" =~ ("yakkety"|"xenial"|"wily"|"jessie") ]]; then
  67.     echo "Oh drats! You do not appear to be running a supported $DISTRO release."
  68.     echo "${bold}$SETNAME${normal}"
  69.     echo 'Exiting...'
  70.     exit 1
  71.   fi
  72. }
  73.  
  74. # check if root function (2)
  75. function _checkroot() {
  76.   if [[ $EUID != 0 ]]; then
  77.     echo 'This script must be run with root privileges.'
  78.     echo 'Exiting...'
  79.     exit 1
  80.   fi
  81.   echo "${green}Congrats! You're running as root. Let's continue${normal} ... "
  82.   echo
  83. }
  84.  
  85. function _checkkernel() {
  86.   grsec=$(uname -a | grep -i grs)
  87.   if [[ -n $grsec ]]; then
  88.     echo -e "Your server is currently running with kernel version: $(uname -r)"
  89.     echo -e "Kernels with ${bold}grsec${normal} are not supported"
  90.     echo -ne "${bold}${yellow}Would you like QuickBox to install the distribution kernel?${normal} (Default: ${green}${bold}Y${normal}) "; read input
  91.       case $input in
  92.         [yY] | [yY][Ee][Ss] | "" ) kernel=yes; echo "Your distribution's default kernel will be installed. A reboot will be ${bold}required${normal}."  ;;
  93.         [nN] | [nN][Oo] ) echo "Installer will not continue. Exiting ... "; exit 0 ;;
  94.       *) kernel=yes; echo "Your distribution's default kernel will be installed. A reboot will be ${bold}required${normal}."  ;;
  95.       esac
  96.       if [[ $kernel == yes ]]; then
  97.         if [[ $DISTRO == Ubuntu ]]; then
  98.           apt-get install -q -y linux-image-generic >>"${OUTTO}" 2>&1
  99.         elif [[ $DISTRO == Devuan ]]; then
  100.           arch=$(uname -m)
  101.           if [[ $arch =~ ("i686"|"i386") ]]; then
  102.             apt-get install -q -y linux-image-686 >>"${OUTTO}" 2>&1
  103.           elif [[ $arch == x86_64 ]]; then
  104.             apt-get install -q -y linux-image-amd64 >>"${OUTTO}" 2>&1
  105.           fi
  106.         fi
  107.         mv /etc/grub.d/06_OVHkernel /etc/grub.d/25_OVHkernel
  108.         update-grub >>"${OUTTO}" 2>&1
  109.       fi
  110.   fi
  111. }
  112.  
  113. # check if create log function (3)
  114. function _logcheck() {
  115.   echo -ne "${bold}${yellow}Do you wish to write to a log file?${normal} (Default: ${green}${bold}Y${normal}) "; read input
  116.     case $input in
  117.       [yY] | [yY][Ee][Ss] | "" ) OUTTO="/root/quickbox.$PPID.log";echo "${bold}Output is being sent to /root/quickbox.${magenta}$PPID${normal}${bold}.log${normal}" ;;
  118.       [nN] | [nN][Oo] ) OUTTO="/dev/null 2>&1";echo "${cyan}NO output will be logged${normal}" ;;
  119.     *) OUTTO="/root/quickbox.$PPID.log";echo "${bold}Output is being sent to /root/quickbox.${magenta}$PPID${normal}${bold}.log${normal}" ;;
  120.     esac
  121.   if [[ ! -d /root/tmp ]]; then
  122.     sed -i 's/noexec,//g' /etc/fstab
  123.     mount -o remount /tmp >>"${OUTTO}" 2>&1
  124.   fi
  125. }
  126.  
  127. # setting system hostname function (7)
  128. function _hostname() {
  129. echo -ne "Please enter a hostname for this server (${bold}Hit ${standout}${green}ENTER${normal} to make no changes${normal}): " ; read input
  130. if [[ -z $input ]]; then
  131.         echo "No hostname supplied, no changes made!!"
  132. else
  133.         hostname ${input}
  134.         echo "${input}">/etc/hostname
  135.         echo "Hostname set to ${input}"
  136. fi
  137. echo
  138. }
  139.  
  140. ################################################################################
  141. #              RESERVED FOR LETS ENCRYPT SSL INSTALL FUNCTION                  #
  142. ################################################################################
  143.  
  144. function _askquota() {
  145.   echo -ne "${bold}${yellow}Do you wish to use user quotas?${normal} (Default: ${green}${bold}Y${normal}) "; read input
  146.     case $input in
  147.       [yY] | [yY][Ee][Ss] | "" ) quota="yes";echo "${bold}Quotas will be installed${normal}" ;;
  148.       [nN] | [nN][Oo] ) quota="no";echo "${cyan}Quotas will not be installed${normal}" ;;
  149.     *) quota="yes";echo "${bold}Quotas will be installed${normal}" ;;
  150.     esac
  151. }
  152.  
  153. function _ask10g() {
  154.   echo -ne "${bold}${yellow}Is this a 10 gigabit server?${normal} (Default: ${green}${bold}N${normal}) "; read input
  155.     case $input in
  156.       [yY] | [yY][Ee][Ss] )   if [[ -d /install ]]; then cd /; else mkdir /install; fi;touch /install/.10g.lock;echo "${bold}The devs are officially jealous${normal}" ;;
  157.       [nN] | [nN][Oo] | "" ) echo "${cyan}Who can afford that stuff anyway?${normal}" ;;
  158.     *)  echo "${cyan}Who can afford that stuff anyway?${normal}"  ;;
  159.     esac
  160. }
  161.  
  162. # primary partition question
  163. function _askpartition() {
  164.   if [[ $quota == yes ]]; then
  165.   echo
  166.   echo "##################################################################################"
  167.   echo "#${bold} By default the QuickBox script will initiate a build using ${green}/${normal} ${bold}as the${normal}"
  168.   echo "#${bold} primary partition for mounting quotas.${normal}"
  169.   echo "#"
  170.   echo "#${bold} Some providers, such as OVH and SYS force ${green}/home${normal} ${bold}as the primary mount ${normal}"
  171.   echo "#${bold} on their server setups. So if you have an OVH or SYS server and have not"
  172.   echo "#${bold} modified your partitions, it is safe to choose option ${yellow}2)${normal} ${bold}below.${normal}"
  173.   echo "#"
  174.   echo "#${bold} If you are not sure:${normal}"
  175.   echo "#${bold} I have listed out your current partitions below. Your mountpoint will be"
  176.   echo "#${bold} listed as ${green}/home${normal} ${bold}or ${green}/${normal}${bold}. ${normal}"
  177.   echo "#"
  178.   echo "#${bold} Typically, the partition with the most space assigned is your default.${normal}"
  179.   echo "##################################################################################"
  180.   echo
  181.   lsblk
  182.   echo
  183.   echo -e "${bold}${yellow}1)${normal} / - ${green}root mount${normal}"
  184.   echo -e "${bold}${yellow}2)${normal} /home - ${green}home mount${normal}"
  185.   echo -ne "${bold}${yellow}What is your mount point for user quotas?${normal} (Default ${green}1${normal}): "; read version
  186.   case $version in
  187.     1 | "") primaryroot=root  ;;
  188.     2) primaryroot=home  ;;
  189.     *) primaryroot=root ;;
  190.   esac
  191.   echo "Using ${green}$primaryroot mount${normal} for quotas"
  192.   echo
  193. fi
  194. }
  195.  
  196. function _askcontinue() {
  197.   echo
  198.   echo "Press ${standout}${green}ENTER${normal} when you're ready to begin or ${standout}${red}Ctrl+Z${normal} to cancel" ;read input
  199.   echo
  200. }
  201.  
  202. # This function blocks an insecure port 1900 that may lead to
  203. # DDoS masked attacks. Only remove this function if you absolutely
  204. # need port 1900. In most cases, this is a junk port.
  205. function _ssdpblock() {
  206.   iptables -I INPUT 1 -p udp -m udp --dport 1900 -j DROP
  207. }
  208.  
  209. # setting locale function (6)
  210. function _locale() {
  211. echo 'LANGUAGE="en_US.UTF-8"' >> /etc/default/locale
  212. echo 'LC_ALL="en_US.UTF-8"' >> /etc/default/locale
  213. echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
  214.   if [[ -e /usr/sbin/locale-gen ]]; then locale-gen >>"${OUTTO}" 2>&1
  215.   else
  216.     apt-get -y update >>"${OUTTO}" 2>&1
  217.     apt-get install locales -y >>"${OUTTO}" 2>&1
  218.     locale-gen >>"${OUTTO}" 2>&1
  219.     export LANG="en_US.UTF-8"
  220.     export LC_ALL="en_US.UTF-8"
  221.     export LANGUAGE="en_US.UTF-8"
  222.   fi
  223. }
  224.  
  225. function _askservices() {
  226.   DISTRO=$(lsb_release -is)
  227.   RELEASE=$(lsb_release -rs)
  228.   CODENAME=$(lsb_release -cs)
  229.   SETNAME=$(lsb_release -rc)
  230.   echo "You are running $DISTRO $CODENAME"
  231.   echo "This distribution has support for systemd services. "
  232.   echo "Would you like to enable? (recommended) (Default: ${green}${bold}Y${normal})"; read input
  233.     case $input in
  234.       [yY] | [yY][Ee][Ss] | "" ) cron="no";echo "${bold}Using systemd for process management${normal}" ;;
  235.       [nN] | [nN][Oo] ) cron="yes";echo "${cyan}Cron will manage your processes${normal}" ;;
  236.     *) cron="no";echo "${bold}Using systemd for process management${normal}" ;;
  237.     esac
  238.   echo
  239. }
  240.  
  241. # ask what rtorrent version (8)
  242. function _askrtorrent() {
  243.   echo -e "1) rtorrent ${green}0.9.6${normal}"
  244.   echo -e "2) rtorrent ${green}0.9.4${normal}"
  245.   echo -e "3) rtorrent ${green}0.9.3${normal}"
  246.   echo -ne "${bold}${yellow}What version of rtorrent do you want?${normal} (Default ${green}1${normal}): "; read version
  247.   case $version in
  248.     1 | "") RTVERSION=0.9.6;LTORRENT=0.13.6  ;;
  249.     2) RTVERSION=0.9.4;LTORRENT=0.13.4  ;;
  250.     3) RTVERSION=0.9.3;LTORRENT=0.13.3 ;;
  251.     *) RTVERSION=0.9.6;LTORRENT=0.13.6 ;;
  252.   esac
  253.   echo "We will be using rtorrent-${green}$RTVERSION${normal}/libtorrent-${green}$LTORRENT${normal}"
  254.   echo
  255. }
  256. # ask deluge version (if wanted) (8.1)
  257. function _askdeluge() {
  258.   echo -e "1) Deluge ${green}repo${normal} (fastest)"
  259.   echo -e "2) Deluge with ${green}libtorrent 1.0.9 (stable)${normal}"
  260.   echo -e "3) Deluge with ${green}libtorrent 1.1.1 (dev)${normal}"
  261.   echo -e "4) Do not install Deluge"
  262.   echo -ne "${bold}${yellow}What version of Deluge do you want?${normal} (Default ${green}1${normal}): "; read version
  263.   case $version in
  264.     1 | "") DELUGE=REPO  ;;
  265.     2) DELUGE=1.0.9  ;;
  266.     3) DELUGE=1.1.1 ;;
  267.     4) DELUGE=NO ;;
  268.     *) DELUGE=REPO ;;
  269.   esac
  270.   echo "We will be using Deluge with Libtorrent ${DELUGE}"
  271.   echo
  272. }
  273.  
  274. # adduser function (9)
  275. function _adduser() {
  276.   theshell="/bin/bash";
  277.   echo "${bold}${yellow}Add a Master Account user to sudoers${normal}";
  278.   echo -n "Username: "; read user
  279.   username=$(echo "$user"|sed 's/.*/\L&/')
  280.   useradd "${username}" -m -G www-data -s "${theshell}"
  281.   echo -n "Password: (hit enter to generate a password) "; read 'password'
  282.   if [[ ! -z "${password}" ]]; then
  283.     echo "setting password to ${password}"
  284.     passwd=${password}
  285.     echo "${username}:${passwd}" | chpasswd >>"${OUTTO}" 2>&1
  286.     (echo -n "${username}:${REALM}:" && echo -n "${username}:${REALM}:${passwd}" | md5sum | awk '{print $1}' ) >> "${HTPASSWD}"
  287.   else
  288.     echo "setting password to ${genpass}"
  289.     passwd=${genpass}
  290.     echo "${username}:${passwd}" | chpasswd >>"${OUTTO}" 2>&1
  291.     (echo -n "${username}:${REALM}:" && echo -n "${username}:${REALM}:${passwd}" | md5sum | awk '{print $1}' ) >> "${HTPASSWD}"
  292.   fi
  293.   printf "${username}:${passwd}" > /root/"$username".info.db
  294.   echo
  295. }
  296.  
  297. # install ffmpeg question (10)
  298. function _askffmpeg() {
  299.   echo -ne "${bold}${yellow}Would you like to install ffmpeg? (Used for screenshots)${normal} [${green}y${normal}]es or [n]o: "; read responce
  300.   case $responce in
  301.     [yY] | [yY][Ee][Ss] | "" ) ffmpeg=yes ;;
  302.     [nN] | [nN][Oo] ) ffmpeg=no ;;
  303.     *) ffmpeg=yes ;;
  304.   esac
  305.   echo
  306. }
  307.  
  308. # ban public trackers [iptables option] (11)
  309. function _denyhosts() {
  310.   echo -ne "${bold}${yellow}Block Public Trackers?${normal}: [${green}y${normal}]es or [n]o: "; read responce
  311.   case $responce in
  312.     [yY] | [yY][Ee][Ss] | "")
  313.  
  314.   echo "[ ${red}-  Blocking public trackers  -${normal} ]"
  315.   cp ${local_setup}templates/trackers.template /etc/trackers
  316.   cp ${local_setup}templates/denypublic.template /etc/cron.daily/denypublic
  317.   chmod +x /etc/cron.daily/denypublic
  318.   cat ${local_setup}templates/hostsTrackers.template >> /etc/hosts
  319.     ;;
  320.  
  321.     [nN] | [nN][Oo] ) echo "[ ${green}+  Allowing public trackers  +${normal} ]"
  322.     ;;
  323.   esac
  324. }
  325.  
  326. # package and repo addition (silently add php7) _add respo sources_ (12)
  327. function _repos() {
  328.   apt-get install -y software-properties-common >>"${OUTTO}" 2>&1
  329.   apt-get -y install lsb-release sudo >>"${OUTTO}" 2>&1
  330.   if [[ $DISTRO == Ubuntu ]]; then
  331.     LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php -y >>"${OUTTO}" 2>&1;
  332.   fi
  333.  
  334.   if [[ $DISTRO == Devuan ]]; then
  335.     echo "deb http://packages.dotdeb.org $(lsb_release -sc) all" > /etc/apt/sources.list.d/dotdeb-php7-$(lsb_release -sc).list
  336.     echo "deb-src http://packages.dotdeb.org $(lsb_release -sc) all" >> /etc/apt/sources.list.d/dotdeb-php7-$(lsb_release -sc).list
  337.     wget -q https://www.dotdeb.org/dotdeb.gpg
  338.     sudo apt-key add dotdeb.gpg >> /dev/null 2>&1
  339.   fi
  340.  
  341. }
  342.  
  343. # package and repo addition (13) _update and upgrade_
  344. function _updates() {
  345.   if [[ $DISTRO == Devuan ]]; then
  346.     cp ${local_setup}templates/apt.sources/devuan.template /etc/apt/sources.list
  347.     sed -i "s/RELEASE/${CODENAME}/g" /etc/apt/sources.list
  348.     apt-get --yes --force-yes update >>"${OUTTO}" 2>&1
  349.     yes '' | apt-get install --force-yes build-essential debian-archive-keyring devuan-keyring \
  350.                              python-software-properties >>"${OUTTO}" 2>&1
  351.     apt-get --yes --force-yes install deb-multimedia-keyring >>"${OUTTO}" 2>&1
  352.   else
  353.     cp ${local_setup}templates/apt.sources/ubuntu.template /etc/apt/sources.list
  354.     sed -i "s/RELEASE/${CODENAME}/g" /etc/apt/sources.list
  355.     apt-get -y update >>"${OUTTO}" 2>&1
  356.     apt-get -y -f install build-essential debian-archive-keyring devuan-keyring \
  357.                              python-software-properties >>"${OUTTO}" 2>&1
  358.     #apt-get -y -f --allow-unauthenticated install deb-multimedia-keyring >>"${OUTTO}" 2>&1
  359.   fi
  360.  
  361.   if [[ $DISTRO == Devuan ]]; then
  362.     export DEBIAN_FRONTEND=noninteractive
  363.     yes '' | apt-get update >>"${OUTTO}" 2>&1
  364.     apt-get -y purge samba samba-common >>"${OUTTO}" 2>&1
  365.     yes '' | apt-get upgrade >>"${OUTTO}" 2>&1
  366.   else
  367.     export DEBIAN_FRONTEND=noninteractive
  368.     apt-get -y update >>"${OUTTO}" 2>&1
  369.     apt-get -y purge samba samba-common >>"${OUTTO}" 2>&1
  370.     apt-get -y upgrade >>"${OUTTO}" 2>&1
  371.   fi
  372.  
  373.   if [[ -e /etc/ssh/sshd_config ]]; then
  374.     echo "Port 4747" /etc/ssh/sshd_config >> /dev/null 2>&1
  375.     sed -i 's/Port 22/Port 4747/g' /etc/ssh/sshd_config
  376.     #sed -i 's/SendEnv LANG LC_*/#SendEnv LANG LC_*/g' /etc/ssh/ssh_config
  377.     #sed -i 's/AcceptEnv LANG LC_*/#AcceptEnv LANG LC_*/g' /etc/ssh/sshd_config
  378.     service ssh restart >>"${OUTTO}" 2>&1
  379.   fi
  380.  
  381.   # Create the service lock file directory
  382.   if [[ -d /install ]]; then cd /; else mkdir /install; fi
  383.   if [[ -d /root/tmp ]]; then cd && rm -r tmp; fi
  384.  
  385. }
  386.  
  387. # package and repo addition (14) _install softwares and packages_
  388. function _depends() {
  389.   if [[ $DISTRO == Devuan ]]; then
  390.     yes '' | apt-get install --force-yes fail2ban bc ed sudo screen zip irssi unzip nano bwm-ng htop iotop \
  391.                      dos2unix subversion dstat automake make mktorrent libtool libcppunit-dev libssl-dev \
  392.                      pkg-config libxml2-dev libcurl3 libcurl4-openssl-dev libsigc++-2.0-dev \
  393.                      apache2-utils autoconf cron curl libapache2-mod-fastcgi libapache2-mod-geoip \
  394.                      libxslt-dev libncurses5-dev yasm pcregrep apache2 php-net-socket libapache2-mod-php7.0 \
  395.                      php7.0-dev php7.0-geoip libgeoip-dev php7.0 php7.0-fpm php7.0-mbstring php7.0-mysql \
  396.                      php7.0-curl php7.0-memcached memcached php7.0-gd php7.0-json php7.0-mcrypt php7.0-opcache \
  397.                      php7.0-xml python3-lxml python-lxml fontconfig comerr-dev ca-certificates libfontconfig1-dev \
  398.                      libdbd-mysql-perl libdbi-perl libfontconfig1 rar unrar mediainfo ifstat \
  399.                      ttf-mscorefonts-installer checkinstall dtach cfv libarchive-zip-perl \
  400.                      libnet-ssleay-perl openjdk-8-jre-headless openjdk-8-jre openjdk-8-jdk libxslt1-dev \
  401.                      libxslt1.1 libxml2 libffi-dev python-pip python-dev libhtml-parser-perl libxml-libxml-perl \
  402.                      libjson-perl libjson-xs-perl libxml-libxslt-perl libapache2-mod-scgi \
  403.                      vnstat vnstati openvpn >>"${OUTTO}" 2>&1
  404.   elif [[ $DISTRO == Ubuntu ]]; then
  405.     apt-get -y -f --allow-unauthenticated install build-essential debian-archive-keyring fail2ban bc sudo \
  406.                      screen zip irssi unzip nano bwm-ng htop iotop git \
  407.                      dos2unix subversion dstat automake make mktorrent libtool libcppunit-dev libssl-dev \
  408.                      pkg-config libxml2-dev libcurl3 libcurl4-openssl-dev libsigc++-2.0-dev \
  409.                      apache2-utils autoconf cron curl libapache2-mod-fastcgi libapache2-mod-geoip \
  410.                      libxslt-dev libncurses5-dev yasm pcregrep apache2 php-net-socket \
  411.                      libdbd-mysql-perl libdbi-perl php7.0 php7.0-fpm php7.0-mbstring php7.0-mysql \
  412.                      php7.0-curl php-memcached memcached php7.0-gd php7.0-json php7.0-mcrypt php7.0-opcache \
  413.                      php7.0-xml php7.0-zip fontconfig comerr-dev ca-certificates libfontconfig1-dev \
  414.                      php7.0-geoip libfontconfig1 rar unrar mediainfo ifstat libapache2-mod-php7.0 \
  415.                      python3-lxml python-lxml ttf-mscorefonts-installer checkinstall dtach cfv libarchive-zip-perl \
  416.                      libnet-ssleay-perl openjdk-8-jre-headless openjdk-8-jre openjdk-8-jdk libxslt1-dev \
  417.                      libxslt1.1 libxml2 libffi-dev python-pip python-dev libhtml-parser-perl libxml-libxml-perl \
  418.                      libjson-perl libjson-xs-perl libxml-libxslt-perl libapache2-mod-scgi \
  419.                      vnstat vnstati openvpn >>"${OUTTO}" 2>&1
  420.   fi
  421. }
  422.  
  423. function _syscommands() {
  424.   mkdir -p /usr/local/bin/quickbox
  425.   cp -r ${local_packages}/. /usr/local/bin/quickbox
  426.   dos2unix $(find /usr/local/bin/quickbox -type f) >>"${OUTTO}" 2>&1;
  427.   chmod +x $(find /usr/local/bin/quickbox -type f) >>"${OUTTO}" 2>&1;
  428.   cp /usr/local/bin/quickbox/system/reload /usr/bin/reload
  429. }
  430.  
  431. function _skel() {
  432.   if [[ -d /etc/skel ]]; then rm -r /etc/skel;fi
  433.   mkdir /etc/skel
  434.   cp -r ${local_setup}templates/skel/. /etc/skel
  435.   tar xzf ${local_setup}sources/rarlinux-x64-5.3.0.tar.gz -C ./
  436.   cp ./rar/*rar /usr/bin
  437.   cp ./rar/*rar /usr/sbin
  438.   rm -rf rarlinux*.tar.gz
  439.   rm -rf ./rar
  440.   wget -q http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
  441.   gunzip GeoLiteCity.dat.gz>>"${OUTTO}" 2>&1
  442.   mkdir -p /usr/share/GeoIP>>"${OUTTO}" 2>&1
  443.   rm -rf GeoLiteCity.dat.gz
  444.   mv GeoLiteCity.dat /usr/share/GeoIP/GeoIPCity.dat>>"${OUTTO}" 2>&1
  445.   (echo y;echo o conf prerequisites_policy follow;echo o conf commit)>/dev/null 2>&1|cpan Digest::SHA1 >>"${OUTTO}" 2>&1
  446.   (echo y;echo o conf prerequisites_policy follow;echo o conf commit)>/dev/null 2>&1|cpan Digest::SHA >>"${OUTTO}" 2>&1
  447.   if [[ $DELUGE != NO ]]; then
  448.     mkdir -p /etc/skel/.config/deluge/plugins/
  449.     cd /etc/skel/.config/deluge/plugins/
  450.     wget -q https://github.com/ratanakvlun/deluge-ltconfig/releases/download/v0.2.5.0/ltConfig-0.2.5.0-py2.7.egg
  451.   fi
  452. }
  453.  
  454. function _qmount() {
  455.   # Setup mount points for Quotas
  456.   if [[ $quota == yes ]]; then
  457.     if [[ $DISTRO == Ubuntu ]]; then
  458.       if [[ ${primaryroot} == "root" ]]; then
  459.         sed -ie '/\/ / s/defaults/usrjquota=aquota.user,jqfmt=vfsv1,defaults/' /etc/fstab
  460.         sed -i 's/errors=remount-ro/usrjquota=aquota.user,jqfmt=vfsv1,errors=remount-ro/g' /etc/fstab
  461.         apt-get install -y linux-image-extra-virtual quota >>"${OUTTO}" 2>&1
  462.         mount -o remount / || mount -o remount /home >>"${OUTTO}" 2>&1
  463.         quotacheck -auMF vfsv1 >>"${OUTTO}" 2>&1
  464.         quotaon -uv / >>"${OUTTO}" 2>&1
  465.         service quota start >>"${OUTTO}" 2>&1
  466.       else
  467.         sed -ie '/\/home/ s/defaults/usrjquota=aquota.user,jqfmt=vfsv1,defaults/' /etc/fstab
  468.         sed -i 's/errors=remount-ro/usrjquota=aquota.user,jqfmt=vfsv1,errors=remount-ro/g' /etc/fstab
  469.         apt-get install -y linux-image-extra-virtual quota >>"${OUTTO}" 2>&1
  470.         mount -o remount /home >>"${OUTTO}" 2>&1
  471.         quotacheck -auMF vfsv1 >>"${OUTTO}" 2>&1
  472.         quotaon -uv /home >>"${OUTTO}" 2>&1
  473.         service quota start >>"${OUTTO}" 2>&1
  474.       fi
  475.     elif [[ $DISTRO == Devuan ]]; then
  476.       if [[ ${primaryroot} == "root" ]]; then
  477.         sed -ie '/\/ / s/defaults/usrjquota=aquota.user,jqfmt=vfsv1,defaults/' /etc/fstab
  478.         sed -i 's/errors=remount-ro/usrjquota=aquota.user,jqfmt=vfsv1,errors=remount-ro/g' /etc/fstab
  479.         apt-get install -y quota >>"${OUTTO}" 2>&1
  480.         mount -o remount / || mount -o remount /home >>"${OUTTO}" 2>&1
  481.         quotacheck -auMF vfsv1 >>"${OUTTO}" 2>&1
  482.         quotaon -uv / >>"${OUTTO}" 2>&1
  483.         service quota start >>"${OUTTO}" 2>&1
  484.       else
  485.         sed -ie '/\/home/ s/defaults/usrjquota=aquota.user,jqfmt=vfsv1,defaults/' /etc/fstab
  486.         sed -i 's/errors=remount-ro/usrjquota=aquota.user,jqfmt=vfsv1,errors=remount-ro/g' /etc/fstab
  487.         apt-get install -y quota >>"${OUTTO}" 2>&1
  488.         mount -o remount /home >>"${OUTTO}" 2>&1
  489.         quotacheck -auMF vfsv1 >>"${OUTTO}" 2>&1
  490.         quotaon -uv /home >>"${OUTTO}" 2>&1
  491.         service quota start >>"${OUTTO}" 2>&1
  492.       fi
  493.     fi
  494.     touch /install/.quota.lock
  495.   fi
  496. }
  497.  
  498. function _lshell() {
  499. # Setup LShell configuration file
  500.   apt-get -y install lshell >> /dev/null 2>&1
  501.   cp ${local_setup}templates/lshell.conf.template /etc/lshell.conf
  502. }
  503.  
  504. # build function for ffmpeg (17)
  505. function _ffmpeg() {
  506.   if [[ ${ffmpeg} == "yes" ]]; then
  507.     MAXCPUS=$(echo "$(nproc) / 2"|bc)
  508.     if [[ $DISTRO == Ubuntu ]]; then
  509.       apt-get -y install x265 >>"${OUTTO}" 2>&1
  510.     elif [[ $DISTRO == Devuan ]]; then
  511.       apt-get -y install -t jessie-backports x265 >>"${OUTTO}" 2>&1
  512.     fi
  513.     mkdir /root/tmp
  514.     cd /root/tmp
  515.     if [[ -d /root/tmp/ffmpeg ]]; then rm -rf ffmpeg;fi
  516.     git clone --depth 1 https://github.com/FFmpeg/FFmpeg.git ffmpeg >>"${OUTTO}" 2>&1
  517.     git clone git://github.com/yasm/yasm.git ffmpeg/yasm >>"${OUTTO}" 2>&1
  518.     git clone https://github.com/yixia/x264.git ffmpeg/x264 >>"${OUTTO}" 2>&1
  519.     ############################################################################
  520.     ## x265 needs to be manually compiled - there is no non-interactive option.
  521.     #git clone https://github.com/videolan/x265.git ffmpeg/x265 >>"${OUTTO}" 2>&1
  522.     ############################################################################
  523.     ####---- Github Mirror source ----####
  524.     #git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg >>"${OUTTO}" 2>&1
  525.     ############################################################################
  526.     cd ffmpeg/yasm
  527.     ./autogen.sh >>"${OUTTO}" 2>&1
  528.     ./configure >>"${OUTTO}" 2>&1
  529.     make >>"${OUTTO}" 2>&1
  530.     make install >>"${OUTTO}" 2>&1
  531.     cd ../x264
  532.     ./configure --enable-static --enable-shared >>"${OUTTO}" 2>&1
  533.     make >>"${OUTTO}" 2>&1
  534.     make install >>"${OUTTO}" 2>&1
  535.     ldconfig >>"${OUTTO}" 2>&1
  536.     ############################################################################
  537.     ## x265 needs to be manually compiled - there is no non-interactive option.
  538.     #cd ../x265/build/linux
  539.     #./make-Makefiles.bash >>"${OUTTO}" 2>&1
  540.     #make >>"${OUTTO}" 2>&1
  541.     #make install >>"${OUTTO}" 2>&1
  542.     #ldconfig >>"${OUTTO}" 2>&1
  543.     ############################################################################
  544.     cd /root/tmp/ffmpeg
  545.     export FC_CONFIG_DIR=/etc/fonts
  546.     export FC_CONFIG_FILE=/etc/fonts/fonts.conf
  547.     ./configure --enable-libfreetype --enable-filter=drawtext --enable-fontconfig --disable-asm --enable-libx264 --enable-gpl >>"${OUTTO}" 2>&1
  548.     make -j${MAXCPUS} >>"${OUTTO}" 2>&1
  549.     make install >>"${OUTTO}" 2>&1
  550.     cp /usr/local/bin/ffmpeg /usr/bin >>"${OUTTO}" 2>&1
  551.     cp /usr/local/bin/ffprobe /usr/bin >>"${OUTTO}" 2>&1
  552.     rm -rf /root/tmp/ffmpeg >>"${OUTTO}" 2>&1
  553.   fi
  554. }
  555.  
  556. # function to enable sudo for www-data function (18)
  557. function _apachesudo() {
  558.   rm /etc/sudoers
  559.   cp ${local_setup}templates/sudoers.template /etc/sudoers
  560.   #if [[ $sudoers == "yes" ]]; then
  561.     awk -v username=${username} '/^root/ && !x {print username    " ALL=(ALL:ALL) NOPASSWD: ALL"; x=1} 1' /etc/sudoers > /tmp/sudoers;mv /tmp/sudoers /etc
  562.     echo -n "${username}" > /etc/apache2/master.txt
  563.   #fi
  564.   cd
  565. }
  566.  
  567. # xmlrpc-c function (19)
  568. function _xmlrpc() {
  569.   if [[ -d /root/tmp ]]; then rm -r tmp;fi
  570.   mkdir /root/tmp && cd /root/tmp
  571.   if [[ -d /root/tmp/xmlrpc-c ]]; then rm -rf xmlrpc-c;fi
  572.   cp -r ${local_setup}sources/xmlrpc-c_1-33-12/ .
  573.   cd xmlrpc-c_1-33-12
  574.   chmod +x configure
  575.   ./configure --prefix=/usr --disable-cplusplus >>"${OUTTO}" 2>&1
  576.   make >>"${OUTTO}" 2>&1
  577.   chmod +x install-sh
  578.   make install >>"${OUTTO}" 2>&1
  579. }
  580.  
  581. # libtorent function (20)
  582. function _libtorrent() {
  583.   if [[ -d /root/tmp ]]; then rm -r tmp;fi
  584.   mkdir /root/tmp && cd /root/tmp
  585.   MAXCPUS=$(echo "$(nproc) / 2"|bc)
  586.   rm -rf xmlrpc-c  >>"${OUTTO}" 2>&1
  587.   if [[ -e /root/tmp/libtorrent-${LTORRENT}.tar.gz ]]; then rm -rf libtorrent-${LTORRENT}.tar.gz;fi
  588.   cp ${local_setup}sources/libtorrent-${LTORRENT}.tar.gz .
  589.   tar -xzvf libtorrent-${LTORRENT}.tar.gz >>"${OUTTO}" 2>&1
  590.   cd libtorrent-${LTORRENT}
  591.   ./autogen.sh >>"${OUTTO}" 2>&1
  592.   ./configure --prefix=/usr >>"${OUTTO}" 2>&1
  593.   make -j${MAXCPUS} >>"${OUTTO}" 2>&1
  594.   make install >>"${OUTTO}" 2>&1
  595. }
  596.  
  597. # rtorrent function (21)
  598. function _rtorrent() {
  599.   if [[ -d /root/tmp ]]; then rm -r tmp;fi
  600.   mkdir /root/tmp && cd /root/tmp
  601.   MAXCPUS=$(echo "$(nproc) / 2"|bc)
  602.   rm -rf libtorrent-${LTORRENT}* >>"${OUTTO}" 2>&1
  603.   if [[ -e /root/tmp/libtorrent-${LTORRENT}.tar.gz ]]; then rm -rf libtorrent-${LTORRENT}.tar.gz;fi
  604.   cp ${local_setup}sources/rtorrent-${RTVERSION}.tar.gz .
  605.   tar -xzvf rtorrent-${RTVERSION}.tar.gz >>"${OUTTO}" 2>&1
  606.   cd rtorrent-${RTVERSION}
  607.   ./autogen.sh >>"${OUTTO}" 2>&1
  608.   ./configure --prefix=/usr --with-xmlrpc-c >>"${OUTTO}" 2>&1
  609.   make -j${MAXCPUS} >>"${OUTTO}" 2>&1
  610.   make install >>"${OUTTO}" 2>&1
  611.   cd /root/tmp
  612.   ldconfig >>"${OUTTO}" 2>&1
  613.   rm -rf /root/tmp/rtorrent-${RTVERSION}* >>"${OUTTO}" 2>&1
  614.   touch /install/.rtorrent.lock
  615. }
  616.  
  617. # deluge function (xx)
  618. function _deluge() {
  619.   if [[ $DELUGE == REPO ]]; then
  620.     apt-get -q -y update >>"${OUTTO}" 2>&1
  621.     apt-get -q -y install deluged deluge-web >>"${OUTTO}" 2>&1
  622.     systemctl stop deluged
  623.     update-rc.d deluged remove
  624.     rm /etc/init.d/deluged
  625.   elif [[ $DELUGE == 1.0.9 ]] || [[ $DELUGE == 1.1.1 ]]; then
  626.     if [[ $DELUGE == 1.0.9 ]]; then
  627.       LTRC=RC_1_0
  628.     elif [[ $DELUGE == 1.1.1 ]]; then
  629.       LTRC=RC_1_1
  630.     fi
  631.   apt-get -qy update >/dev/null 2>&1
  632.   LIST='build-essential checkinstall libboost-system-dev libboost-python-dev libssl-dev libgeoip-dev libboost-chrono-dev libboost-random-dev
  633.  python python-twisted python-openssl python-setuptools intltool python-xdg python-chardet geoip-database python-notify python-pygame
  634.  python-glade2 librsvg2-common xdg-utils python-mako'
  635.   for depend in $LIST; do
  636.     apt-get -qq -y install $depend >>"${OUTTO}" 2>&1
  637.   done
  638.   git clone -b ${LTRC} https://github.com/arvidn/libtorrent.git >>"${OUTTO}" 2>&1
  639.   git clone -b 1.3-stable git://deluge-torrent.org/deluge.git >>"${OUTTO}" 2>&1
  640.   cd libtorrent
  641.   ./autotool.sh >>"${OUTTO}" 2>&1
  642.   ./configure --enable-python-binding --with-lib-geoip --with-libiconv >>"${OUTTO}" 2>&1 >>"${OUTTO}" 2>&1
  643.   make -j$(nproc) >>"${OUTTO}" 2>&1
  644.   checkinstall -y --pkgversion=${DELUGE} >>"${OUTTO}" 2>&1
  645.   ldconfig
  646.   cd ..
  647.   cd deluge
  648.   python setup.py build >>"${OUTTO}" 2>&1
  649.   python setup.py install --install-layout=deb >>"${OUTTO}" 2>&1
  650.   python setup.py install_data >>"${OUTTO}" 2>&1
  651.   cd ..
  652.   rm -r {deluge,libtorrent}
  653. fi
  654.   if [[ $DELUGE != NO ]]; then
  655.   n=$RANDOM
  656.   DPORT=$((n%59000+10024))
  657.   DWSALT=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
  658.   DWP=$(python ${local_packages}/system/deluge.Userpass.py ${passwd} ${DWSALT})
  659.   DUDID=$(python ${local_packages}/system/deluge.addHost.py)
  660.   # -- Secondary awk command -- #
  661.   #DPORT=$(awk -v min=59000 -v max=69024 'BEGIN{srand(); print int(min+rand()*(max-min+1))}')
  662.   DWPORT=$(shuf -i 10001-11000 -n 1)
  663.   mkdir -p /home/${username}/.config/deluge/plugins
  664.   if [[ ! -f /home/${username}/.config/deluge/plugins/ltConfig-0.2.5.0-py2.7.egg ]]; then
  665.     cd /home/${username}/.config/deluge/plugins/
  666.     wget -q https://github.com/ratanakvlun/deluge-ltconfig/releases/download/v0.2.5.0/ltConfig-0.2.5.0-py2.7.egg
  667.   fi
  668.   chmod 755 /home/${username}/.config
  669.   chmod 755 /home/${username}/.config/deluge
  670.   cp ${local_setup}templates/core.conf.template /home/${username}/.config/deluge/core.conf
  671.   cp ${local_setup}templates/web.conf.template /home/${username}/.config/deluge/web.conf
  672.   cp ${local_setup}templates/hostlist.conf.1.2.template /home/${username}/.config/deluge/hostlist.conf.1.2
  673.   sed -i "s/USERNAME/${username}/g" /home/${username}/.config/deluge/core.conf
  674.   sed -i "s/DPORT/${DPORT}/g" /home/${username}/.config/deluge/core.conf
  675.   sed -i "s/XX/${ip}/g" /home/${username}/.config/deluge/core.conf
  676.   sed -i "s/DWPORT/${DWPORT}/g" /home/${username}/.config/deluge/web.conf
  677.   sed -i "s/DWSALT/${DWSALT}/g" /home/${username}/.config/deluge/web.conf
  678.   sed -i "s/DWP/${DWP}/g" /home/${username}/.config/deluge/web.conf
  679.   sed -i "s/DUDID/${DUDID}/g" /home/${username}/.config/deluge/hostlist.conf.1.2
  680.   sed -i "s/DPORT/${DPORT}/g" /home/${username}/.config/deluge/hostlist.conf.1.2
  681.   sed -i "s/USERNAME/${username}/g" /home/${username}/.config/deluge/hostlist.conf.1.2
  682.   sed -i "s/PASSWD/${passwd}/g" /home/${username}/.config/deluge/hostlist.conf.1.2
  683.   echo "${username}:${passwd}:10" > /home/${username}/.config/deluge/auth
  684.   chmod 600 /home/${username}/.config/deluge/auth
  685.   chown -R ${username}.${username} /home/${username}/.config/
  686.   mkdir /home/${username}/dwatch
  687.   chown ${username}: /home/${username}/dwatch
  688.   mkdir -p /home/${username}/torrents/deluge
  689.   chown ${username}: /home/${username}/torrents/deluge
  690.   touch /install/.deluge.lock
  691. fi
  692. }
  693. # scgi enable function (22-nixed)
  694. # function _scgi() { ln -s /etc/apache2/mods-available/scgi.load /etc/apache2/mods-enabled/scgi.load >>"${OUTTO}" 2>&1 ; }
  695.  
  696. # function to install rutorrent (22)
  697. function _rutorrent() {
  698.   cd /srv
  699.   if [[ -d /srv/rutorrent ]]; then rm -rf rutorrent;fi
  700.   mkdir rutorrent
  701.   cp -r ${local_rutorrent}/. rutorrent
  702. }
  703.  
  704. function _rutorrent-plugins() {
  705.   cd /srv/rutorrent
  706.   if [[ -d /srv/rutorrent/plugins ]]; then rm -rf plugins;fi
  707.   mkdir plugins
  708.   cp -R ${local_rplugins}/. plugins
  709. }
  710.  
  711. # function to install dashboard (23)
  712. function _dashboard() {
  713.   cd && mkdir -p /srv/rutorrent/home
  714.   cp -r ${local_dashboard}/. /srv/rutorrent/home
  715.   touch /srv/rutorrent/home/db/output.log
  716. }
  717.  
  718. # function to configure apache (24)
  719. function _apacheconf() {
  720.   cp ${local_setup}templates/aliases-seedbox.conf.template /etc/apache2/sites-enabled/aliases-seedbox.conf
  721.   sed -i "s/USERNAME/${username}/g" /etc/apache2/sites-enabled/aliases-seedbox.conf
  722.   a2enmod auth_digest >>"${OUTTO}" 2>&1
  723.   a2enmod ssl >>"${OUTTO}" 2>&1
  724.   a2enmod scgi >>"${OUTTO}" 2>&1
  725.   a2enmod rewrite >>"${OUTTO}" 2>&1
  726.   mv /etc/apache2/sites-enabled/000-default.conf /etc/apache2/ >>"${OUTTO}" 2>&1
  727.   cp ${local_setup}templates/default-ssl.conf.template /etc/apache2/sites-enabled/default-ssl.conf
  728.   sed -i "s/USERNAME/${username}/g" /etc/apache2/sites-enabled/default-ssl.conf
  729.   sed -i "s/\"REALM\"/\"${REALM}\"/g" /etc/apache2/sites-enabled/default-ssl.conf
  730.   sed -i "s/HTPASSWD/\/etc\/htpasswd/g" /etc/apache2/sites-enabled/default-ssl.conf
  731.   sed -i "s/PORT/${PORT}/g" /etc/apache2/sites-enabled/default-ssl.conf
  732.   cp ${local_setup}templates/fileshare.conf.template /etc/apache2/sites-enabled/fileshare.conf
  733.     sed -i.bak -e "s/post_max_size = 8M/post_max_size = 64M/" \
  734.                -e "s/upload_max_filesize = 2M/upload_max_filesize = 92M/" \
  735.                -e "s/expose_php = On/expose_php = Off/" \
  736.                -e "s/128M/768M/" \
  737.                -e "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" \
  738.                -e "s/;opcache.enable=0/opcache.enable=1/" \
  739.                -e "s/;opcache.memory_consumption=64/opcache.memory_consumption=128/" \
  740.                -e "s/;opcache.max_accelerated_files=2000/opcache.max_accelerated_files=4000/" \
  741.                -e "s/;opcache.revalidate_freq=2/opcache.revalidate_freq=240/" /etc/php/7.0/fpm/php.ini
  742.     sed -i.bak -e "s/post_max_size = 8M/post_max_size = 64M/" \
  743.                -e "s/upload_max_filesize = 2M/upload_max_filesize = 92M/" \
  744.                -e "s/expose_php = On/expose_php = Off/" \
  745.                -e "s/memory_limit = 128M/memory_limit = 768M/" \
  746.                -e "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" \
  747.                -e "s/;opcache.enable=0/opcache.enable=1/" \
  748.                -e "s/;opcache.memory_consumption=64/opcache.memory_consumption=128/" \
  749.                -e "s/;opcache.max_accelerated_files=2000/opcache.max_accelerated_files=4000/" \
  750.                -e "s/;opcache.revalidate_freq=2/opcache.revalidate_freq=240/" /etc/php/7.0/apache2/php.ini
  751.  
  752.     # ensure opcache module is activated
  753.     phpenmod -v 7.0 opcache >>"${OUTTO}" 2>&1
  754.  
  755.     # these modules are purely experimental
  756.     #a2enmod proxy_fcgi >>"${OUTTO}" 2>&1
  757.     #a2dismod mpm_prefork >>"${OUTTO}" 2>&1
  758.     #a2enmod mpm_worker >>"${OUTTO}" 2>&1
  759.  
  760.     # ensure fastcgi module is activated
  761.     a2enmod actions >>"${OUTTO}" 2>&1
  762.     a2enmod fastcgi >>"${OUTTO}" 2>&1
  763.     a2enmod proxy_fcgi setenvif >>"${OUTTO}" 2>&1
  764.     a2enconf php7.0-fpm >>"${OUTTO}" 2>&1
  765.  
  766.  
  767.     #sed -i 's/memory_limit = 128M/memory_limit = 768M/g' /etc/php/7.0/apache2/php.ini
  768. }
  769.  
  770. # function to configure first user config (25)
  771. function _rconf() {
  772.   cp ${local_setup}templates/rtorrent.rc.template /home/${username}/.rtorrent.rc
  773.   mkdir -p /home/${username}/torrents/rtorrent
  774.   chown -R ${username}: /home/${username}/torrents
  775.   sed -i "s/USERNAME/${username}/g" /home/${username}/.rtorrent.rc
  776.   sed -i "s/XXX/${PORT}/g" /home/${username}/.rtorrent.rc
  777.   sed -i "s/YYY/${PORTEND}/g" /home/${username}/.rtorrent.rc
  778.   if [[ -f /install/.10g.lock ]]; then
  779.     sed -i "s/hrottle.max_peers.normal.set = 100/hrottle.max_peers.normal.set = 300/g" /home/${username}/.rtorrent.rc
  780.     sed -i "s/throttle.max_uploads.global.set = 100/throttle.max_uploads.global.set = 300/g" /home/${username}/.rtorrent.rc
  781.   fi
  782. }
  783.  
  784. # function to set proper diskspace plugin (26)
  785. function _plugins() {
  786.   cd "${rutorrent}plugins/"
  787.   if [[ ${primaryroot} == "root" ]]; then
  788.     rm -r ${rutorrent}plugins/diskspaceh
  789.   else
  790.     rm -r ${rutorrent}plugins/diskspace
  791.   fi
  792.  
  793.   cp /srv/rutorrent/home/fileshare/.htaccess /srv/rutorrent/plugins/fileshare/
  794.   cd /srv/rutorrent/home/fileshare/
  795.   rm -rf share.php
  796.   ln -s ../../plugins/fileshare/share.php
  797.   cp ${local_setup}templates/rutorrent/plugins/fileshare/conf.php.template /srv/rutorrent/plugins/fileshare/conf.php
  798.  
  799.   sed -i 's/homeDirectory/topDirectory/g' /srv/rutorrent/plugins/filemanager/flm.class.php
  800.   sed -i 's/homeDirectory/topDirectory/g' /srv/rutorrent/plugins/filemanager/settings.js.php
  801.   sed -i 's/showhidden: true,/showhidden: false,/g' "${rutorrent}plugins/filemanager/init.js"
  802.   chown -R www-data.www-data "${rutorrent}"
  803.   cd ${rutorrent}plugins/theme/themes/
  804.   git clone https://lab.quickbox.io/Swizards/club-Swizards club-Swizards >>"${OUTTO}" 2>&1
  805.   chown -R www-data:www-data club-Swizards
  806.   cd ${rutorrent}plugins
  807.   perl -pi -e "s/\$defaultTheme \= \"\"\;/\$defaultTheme \= \"club-Swizards\"\;/g" ${rutorrent}plugins/theme/conf.php
  808.   rm -rf ${rutorrent}plugins/tracklabels/labels/nlb.png
  809.  
  810.   # Needed for fileupload
  811.   # wget http://ftp.nl.debian.org/debian/pool/main/p/plowshare/plowshare4_2.1.3-1_all.deb -O plowshare4.deb >>"${OUTTO}" 2>&1
  812.   # wget http://ftp.nl.debian.org/debian/pool/main/p/plowshare/plowshare_2.1.3-1_all.deb -O plowshare.deb >>"${OUTTO}" 2>&1
  813.   apt-get -y install plowshare >>"${OUTTO}" 2>&1
  814.   dpkg -i plowshare*.deb >>"${OUTTO}" 2>&1
  815.   rm -rf plowshare*.deb >>"${OUTTO}" 2>&1
  816.   cd /root
  817.   mkdir -p /root/bin
  818.   git clone https://github.com/mcrapet/plowshare.git ~/.plowshare-source >>"${OUTTO}" 2>&1
  819.   cd ~/.plowshare-source >>"${OUTTO}" 2>&1
  820.   make install PREFIX=$HOME >>"${OUTTO}" 2>&1
  821.   cd && rm -rf .plowshare-source >>"${OUTTO}" 2>&1
  822.   apt-get -f install >>"${OUTTO}" 2>&1
  823.  
  824.   mkdir -p /srv/rutorrent/conf/users/"${username}"/plugins/fileupload/
  825.   chmod 775 /srv/rutorrent/plugins/fileupload/scripts/upload
  826.   cp /srv/rutorrent/plugins/fileupload/conf.php /srv/rutorrent/conf/users/"${username}"/plugins/fileupload/conf.php
  827.   chown -R www-data: /srv/rutorrent/conf/users/"${username}"
  828.  
  829.   # Set proper permissions to filemanager so it may execute commands
  830.   find /srv/rutorrent/plugins/filemanager/scripts -type f -exec chmod 755 {} \;
  831. }
  832.  
  833. # function autodl to install autodl irssi scripts (27)
  834. function _autodl() {
  835.   mkdir -p "/home/${username}/.irssi/scripts/autorun/" >>"${OUTTO}" 2>&1
  836.   cd "/home/${username}/.irssi/scripts/"
  837.   wget -qO autodl-irssi.zip https://github.com/autodl-community/autodl-irssi/releases/download/community-v1.62/autodl-irssi-community-v1.62.zip
  838.   unzip -o autodl-irssi.zip >>"${OUTTO}" 2>&1
  839.   rm autodl-irssi.zip
  840.   cp autodl-irssi.pl autorun/
  841.   mkdir -p "/home/${username}/.autodl" >>"${OUTTO}" 2>&1
  842.   touch "/home/${username}/.autodl/autodl.cfg"
  843.   chown ${username}: /home/${username}/.autodl/autodl.cfg
  844.   touch /install/.autodlirssi.lock
  845.  
  846. cat >"/home/${username}/.autodl/autodl2.cfg"<<ADC
  847. [options]
  848. gui-server-port = ${AUTODLPORT}
  849. gui-server-password = ${AUTODLPASSWORD}
  850. ADC
  851.  
  852.   chown -R "${username}.${username}" "/home/${username}/.irssi/"
  853.   chown -R "${username}.${username}" "/home/${username}"
  854. }
  855.  
  856. # function to make dirs for first user (28)
  857. function _makedirs() {
  858.   #mkdir /home/"${username}"/{torrents,.sessions,watch} >>"${OUTTO}" 2>&1
  859.   cp -r /etc/skel/. /home/"${username}"
  860.   chown -r "${username}".www-data /home/"${username}" >>"${OUTTO}" 2>&1 #/{torrents,.sessions,watch,.rtorrent.rc} >>"${OUTTO}" 2>&1
  861.   usermod -a -G www-data "${username}" >>"${OUTTO}" 2>&1
  862.   usermod -a -G "${username}" www-data >>"${OUTTO}" 2>&1
  863. }
  864.  
  865. # function to make crontab .statup file (29)
  866. #function _cronfile() {
  867. #  cp ${local_setup}templates/startup.template /home/${username}/.startup
  868. #  chmod 775 /home/${username}/.startup
  869. #  if [[ $DELUGE != NO ]]; then
  870. #  sed -i 's/DELUGEWEB_CLIENT=no/DELUGEWEB_CLIENT=yes/g' /home/${username}/.startup
  871. #  sed -i 's/DELUGED_CLIENT=no/DELUGED_CLIENT=yes/g' /home/${username}/.startup
  872. #fi
  873. #}
  874.  
  875. # function to configure first user config.php (30)
  876. function _ruconf() {
  877.   mkdir -p ${rutorrent}conf/users/${username}/
  878.  
  879.   cp ${local_setup}templates/rutorrent.users.config.template ${rutorrent}conf/users/${username}/config.php
  880.  
  881.   chown -R www-data.www-data "${rutorrent}conf/users/" >>"${OUTTO}" 2>&1
  882.   if [[ ${primaryroot} == "root" ]]; then
  883.     sed -i "/diskuser/c\$diskuser = \"\/\";" /srv/rutorrent/conf/users/${username}/config.php
  884.   else
  885.     sed -i "/diskuser/c\$diskuser = \"\/home\";" /srv/rutorrent/conf/users/${username}/config.php
  886.   fi
  887.   sed -i "/quotaUser/c\$quotaUser = \"${username}\";" /srv/rutorrent/conf/users/${username}/config.php
  888.   sed -i "s/USERNAME/${username}/g" /srv/rutorrent/conf/users/${username}/config.php
  889.   sed -i "s/XXX/${PORT}/g" /srv/rutorrent/conf/users/${username}/config.php
  890.   sed -i "s/YYY/${AUTODLPORT}/g" /srv/rutorrent/conf/users/${username}/config.php
  891.   sed -i "s/ZZZ/\"${AUTODLPASSWORD}\"/g" /srv/rutorrent/conf/users/${username}/config.php
  892. }
  893.  
  894. # function to install pure-ftpd (31)
  895. function _installftpd() {
  896.   apt-get purge -y vsftpd pure-ftpd >>"${OUTTO}" 2>&1
  897.   apt-get autoremove >>"${OUTTO}" 2>&1
  898.   apt-get install -y vsftpd >>"${OUTTO}" 2>&1
  899. }
  900.  
  901. # function to configure pure-ftpd (32)
  902. function _ftpdconfig() {
  903.   cp ${local_setup}templates/openssl.cnf.template /root/.openssl.cnf
  904.  
  905.   openssl req -config /root/.openssl.cnf -x509 -nodes -days 365 -newkey rsa:1024 -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem >/dev/null 2>&1
  906.  
  907.   cp ${local_setup}templates/vsftpd.conf.template /etc/vsftpd.conf
  908.   echo "" > /etc/vsftpd.chroot_list
  909. }
  910.  
  911. # The following function makes necessary changes to Network and TZ settings needed for
  912. # the proper functionality of the QuickBox Dashboard.
  913. function _quickstats() {
  914.   # Dynamically adjust to use the servers active network adapter
  915.   printf "${IFACE}" > /srv/rutorrent/home/db/interface.txt
  916.   printf "${username}" > /srv/rutorrent/home/db/master.txt
  917.   # Use server timezone
  918.   cd /usr/share/zoneinfo
  919.   find * -type f -exec sh -c "diff -q /etc/localtime '{}' > /dev/null && echo {}" \; > ~/tz.txt
  920.   cd ~
  921.   LOCALE=en_GB.UTF-8
  922.   LANG=lang_en
  923.   sed -i "s/LOCALE/${locale}/g" /srv/rutorrent/home/inc/localize.php
  924.   sed -i "s/LANG/${lang}/g" /srv/rutorrent/home/inc/localize.php
  925.   #echo "  date_default_timezone_set('$(cat tz.txt)');" >> /srv/rutorrent/home/widgets/config.php
  926.   #echo "" >> /srv/rutorrent/home/widgets/config.php
  927.   #echo "?>" >> /srv/rutorrent/home/widgets/config.php
  928.   if [[ ${primaryroot} == "home" ]]; then
  929.     cd /srv/rutorrent/home/widgets && rm disk_data.php
  930.     mv disk_datah.php disk_data.php
  931.     chown -R www-data:www-data /srv/rutorrent/home/widgets
  932.   else
  933.     rm /srv/rutorrent/home/widgets/disk_datah.php
  934.   fi
  935. }
  936.  
  937. function _quickconsole() {
  938.   PUBLICIP=$(ip route get 8.8.8.8 | awk 'NR==1 {print $NF}')
  939.  
  940. cat >/etc/profile<<EOF
  941. echo " Welcome Back !"
  942. echo "    * Dashboard:  https://${PUBLICIP}"
  943. echo "    * Support:    https://plaza.quickbox.io"
  944. echo "    * Roadmap:    https://quickbox.io/roadmap"
  945. echo "    * Donate:     https://quickbox.io/donate"
  946. echo ""
  947. EOF
  948.  
  949.   apt-get -y install shellinabox >>"${OUTTO}" 2>&1;
  950.  
  951.   cp ${local_setup}templates/sysd/shellinabox.template /etc/systemd/system/shellinabox.service
  952.   cp ${local_setup}templates/quickconsole/00_QuickConsole.css.template /etc/shellinabox/options-enabled/00_QuickConsole.css
  953.   cp ${local_setup}templates/web-console.conf.template /etc/apache2/sites-enabled/${username}.console.conf
  954.  
  955.   sed -i "s/PUBLICIP/${PUBLICIP}/g" /etc/apache2/sites-enabled/${username}.console.conf
  956.   sed -i "s/USER/${username}/g" /etc/apache2/sites-enabled/${username}.console.conf
  957.  
  958.   chmod +x /etc/shellinabox/options-enabled/00_QuickConsole.css
  959.   chmod 777 /etc/shellinabox/options-enabled/00_QuickConsole.css
  960.  
  961.   systemctl enable shellinabox.service >/dev/null 2>&1
  962.   systemctl stop shellinabox.service >/dev/null 2>&1
  963.   systemctl daemon-reload >/dev/null 2>&1
  964.   systemctl start shellinabox.service >/dev/null 2>&1
  965.  
  966. }
  967.  
  968. # seedbox boot for first user (35)
  969. function _boot() {
  970.   #if [[ $cron == yes ]]; then
  971.   #  touch /install/.cron.lock
  972.   #  command1="*/1 * * * * /home/${username}/.startup >/dev/null 2>&1"
  973.   #  cat <(fgrep -iv "${command1}" <(sh -c 'sudo -u ${username} crontab -l' >/dev/null 2>&1)) <(echo "${command1}") | sudo -u ${username} crontab -
  974.   #elif [[ $cron == no ]]; then
  975.   cp ${local_setup}templates/sysd/rtorrent.template /etc/systemd/system/rtorrent@.service >/dev/null 2>&1
  976.   cp ${local_setup}templates/sysd/autodlirssi.template /etc/systemd/system/irssi@.service >/dev/null 2>&1
  977.   cp ${local_setup}templates/sysd/deluged.template /etc/systemd/system/deluged@.service >/dev/null 2>&1
  978.   cp ${local_setup}templates/sysd/deluge-web.template /etc/systemd/system/deluge-web@.service >/dev/null 2>&1
  979.   systemctl enable {rtorrent,irssi,deluged,deluge-web}@${username} >/dev/null 2>&1
  980.   systemctl start {rtorrent,irssi,deluged,deluge-web}@${username} >/dev/null 2>&1
  981.   #fi
  982.  
  983.   echo "*/1 * * * * root bash /usr/local/bin/quickbox/system/set_interface" > /etc/cron.d/set_interface
  984. }
  985.  
  986. # function to set permissions on first user (36)
  987. function _perms() {
  988.   chown -R ${username}.${username} /home/${username}/ >>"${OUTTO}" 2>&1
  989.   sudo -u ${username} chmod 755 /home/${username}/ >>"${OUTTO}" 2>&1
  990.   chmod +x /etc/cron.daily/denypublic >/dev/null 2>&1
  991.   chmod 777 /home/${username}/.sessions >/dev/null 2>&1
  992.   chown -R chown -R www-data:www-data /srv/rutorrent/home >/dev/null 2>&1
  993. }
  994.  
  995.  
  996. ################################################################################
  997. #   //BEGIN UNUSED FUNCTIONS//
  998. ################################################################################
  999. # ask for bash or lshell function ()
  1000. # Heads Up: lshell is disabled for the initial user on install as your first user
  1001. # should not be limited in shell. Additional created users are automagically
  1002. # added to a limited shell environment.
  1003. function _askshell() {
  1004.   #echo -ne "${yellow}Set user shell to lshell?${normal} (Default: ${red}N${normal}): "; read responce
  1005.   #case $responce in
  1006.   #  [yY] | [yY][Ee][Ss] ) theshell="/usr/bin/lshell" ;;
  1007.   #  [nN] | [nN][Oo] | "" ) theshell="/bin/bash" ;;
  1008.   #  *) theshell="yes" ;;
  1009.   #esac
  1010.   echo -ne "${bold}${yellow}Add user to /etc/sudoers${normal} [${green}y${normal}]es or [n]o: "; read answer
  1011.   case $answer in
  1012.     [yY] | [yY][Ee][Ss] | "" ) sudoers="yes" ;;
  1013.     [nN] | [nN][Oo] ) sudoers="no" ;;
  1014.     *) sudoers="yes" ;;
  1015.   esac
  1016. }
  1017.  
  1018. # function to create ssl cert for pure-ftpd ()
  1019. function _pureftpcert() {
  1020.   /bin/true
  1021. }
  1022. ################################################################################
  1023. #   //END UNUSED FUNCTIONS//
  1024. ################################################################################
  1025.  
  1026. # function to show finished data (37)
  1027. function _finished() {
  1028.   ip=$(ip route get 8.8.8.8 | awk 'NR==1 {print $NF}')
  1029.   echo
  1030.   echo
  1031.   echo -e " ${black}${on_green}    [quickbox] Seedbox & GUI Installation Completed    ${normal} "
  1032.   echo -e "        ${standout}    INSTALLATION COMPLETED in ${FIN}/min    ${normal}             "
  1033.   echo;echo
  1034.   echo "  Valid Commands:  "
  1035.   echo '  -------------------'
  1036.   echo
  1037.   echo -e " ${green}createSeedboxUser${normal} - creates a shelled seedbox user"
  1038.   echo -e " ${green}deleteSeedboxUser${normal} - deletes a created seedbox user and their directories"
  1039.   echo -e " ${green}changeUserpass${normal} - change users SSH/FTP/ruTorrent password"
  1040.   echo -e " ${green}setdisk${normal} - set your disk quota for any given user"
  1041.   echo -e " ${green}showspace${normal} - shows the amount of space used by all users on the server"
  1042.   echo -e " ${green}reload${normal} - restarts your seedbox services, i.e; rtorrent & irssi"
  1043.   echo -e " ${green}upgradeBTSync${normal} - upgrades btsync when new version is available"
  1044.   echo -e " ${green}upgradePlex${normal} - upgrades Plex when new version is available"
  1045.   echo;echo;echo
  1046.   echo '################################################################################################'
  1047.   echo "#   Seedbox can be found at https://${username}:${passwd}@${ip} "
  1048.   echo "#   ${cyan}(Also works for FTP:5757/SSH:4747)${normal}"
  1049.   echo "#   If you need to restart rtorrent/irssi, you can type 'reload'"
  1050.   echo "#   https://${username}:${passwd}@${ip} (Also works for FTP:5757/SSH:4747)" > ${username}.info
  1051.   echo "#   Reloading: ${green}sshd${normal}, ${green}apache${normal}, ${green}memcached${normal}, ${green}php7.0${normal}, ${green}vsftpd${normal} and ${green}fail2ban${normal}"
  1052.   echo '################################################################################################'
  1053.   echo
  1054.  
  1055. cat >/root/information.info<<EOF
  1056.   Seedbox can be found at https://${username}:${passwd}@${ip} (Also works for FTP:5757/SSH:4747)
  1057.   If you need to restart rtorrent/irssi, you can type 'reload'
  1058.   https://${username}:${passwd}@${ip} (Also works for FTP:5757/SSH:4747)
  1059. EOF
  1060.   rm -rf "$0" >>"${OUTTO}" 2>&1
  1061.     for i in ssh apache2 php7.0-fpm vsftpd fail2ban quota memcached cron; do
  1062.       service $i restart >>"${OUTTO}" 2>&1
  1063.       systemctl enable $i >>"${OUTTO}" 2>&1
  1064.     done
  1065.   rm -rf /root/tmp/
  1066.   echo -ne "  Do you wish to reboot (recommended!): (Default ${green}Y${normal})"; read reboot
  1067.   case $reboot in
  1068.     [yY] | [yY][Ee][Ss] | "") reboot                 ;;
  1069.     [nN] | [nN][Oo] ) echo "  ${cyan}Skipping reboot${normal} ... " ;;
  1070.   esac
  1071. }
  1072.  
  1073. clear
  1074.  
  1075. spinner() {
  1076.     local pid=$1
  1077.     local delay=0.25
  1078.     local spinstr='|/-\'
  1079.     while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do
  1080.         local temp=${spinstr#?}
  1081.         printf " [${bold}${yellow}%c${normal}]  " "$spinstr"
  1082.         local spinstr=$temp${spinstr%"$temp"}
  1083.         sleep $delay
  1084.         printf "\b\b\b\b\b\b"
  1085.     done
  1086.     printf "    \b\b\b\b"
  1087.     echo -ne "${OK}"
  1088. }
  1089.  
  1090. local_setup=/root/QuickBox/setup/
  1091. local_packages=/root/QuickBox/packages/
  1092. local_rutorrent=/root/QuickBox/rutorrent/
  1093. local_rplugins=/root/QuickBox/rtplugins/
  1094. local_dashboard=/root/QuickBox/dashboard/
  1095.  
  1096. IFACE=$(ip link show|grep -i broadcast|grep -m1 UP|cut -d: -f 2|cut -d@ -f 1|sed -e 's/ //g');
  1097. HOSTNAME1=$(hostname -s);
  1098. PORT=$(shuf -i 2000-61000 -n 1)
  1099. PORTEND=$((${PORT} + 1500))
  1100. while [[ "$(netstat -ln | grep ':'"$PORT"'' | grep -c 'LISTEN')" -eq "1" ]]; do PORT="$(shuf -i 2000-61000 -n 1)"; done
  1101. RPORT=$(shuf -i 2000-61000 -n 1)
  1102. while [[ "$(netstat -ln | grep ':'"$RPORT"'' | grep -c 'LISTEN')" -eq "1" ]]; do RPORT="$(shuf -i 2000-61000 -n 1)"; done
  1103. S=$(date +%s)
  1104. OK=$(echo -e "[ ${bold}${green}DONE${normal} ]")
  1105. genpass=$(_string)
  1106. HTPASSWD="/etc/htpasswd"
  1107. rutorrent="/srv/rutorrent/"
  1108. REALM="rutorrent"
  1109. AUTODLPASSWORD=$(_string)
  1110. AUTODLPORT=$(shuf -i 2000-61000 -n 1)
  1111. ip=$(ip route get 8.8.8.8 | awk 'NR==1 {print $NF}')
  1112. BTSYNCIP=$(ip route get 8.8.8.8 | awk 'NR==1 {print $NF}')
  1113. export DEBIAN_FRONTEND=noninteractive
  1114. cd
  1115.  
  1116. # QuickBox STRUCTURE
  1117. _bashrc
  1118. _intro
  1119. _checkroot
  1120. _logcheck
  1121. _checkkernel
  1122. _hostname
  1123. _askquota
  1124. _askcontinue
  1125. _ssdpblock
  1126. _locale
  1127. clear
  1128.  
  1129. #_askservices
  1130. _askpartition
  1131. _ask10g
  1132. _askrtorrent
  1133. _askdeluge
  1134. _adduser
  1135. _askffmpeg
  1136. _denyhosts
  1137.  
  1138. echo
  1139. echo ""
  1140. echo "${bold}${magenta}QuickBox will now install, this may take between${normal}"
  1141. echo "${bold}${magenta}10 and 45 minutes depending on your systems specs${normal}"
  1142. echo ""
  1143. echo -n "Pulling QuickBox Ecosystem ... ";_repos & spinner $!;echo
  1144. echo -n "Updating system ... ";_updates & spinner $!;echo
  1145. echo -n "Installing all needed dependencies ... ";_depends & spinner $!;echo
  1146. echo -n "Setting up system executables ... ";_syscommands & spinner $!;echo
  1147. echo -n "Building required user directories ... ";_skel & spinner $!;echo
  1148. if [[ ${quota} == "yes" ]]; then
  1149. echo -n "Setting up quotas for ${green}/($primaryroot)${normal} mount ... ";_qmount & spinner $!;echo
  1150. fi
  1151. echo -n "Setting up Limited Shell environment ... ";_lshell & spinner $!;echo
  1152. if [[ ${ffmpeg} == "yes" ]]; then
  1153.     echo -n "Building ffmpeg from source for screenshots ... ";_ffmpeg & spinner $!;echo
  1154. fi
  1155. _apachesudo
  1156. echo -n "Installing xmlrpc-c-${green}1.33.12${normal} ... ";_xmlrpc & spinner $!;echo
  1157. echo -n "Installing libtorrent-${green}$LTORRENT${normal} ... ";_libtorrent & spinner $!;echo
  1158. echo -n "Installing rtorrent-${green}$RTVERSION${normal} ... ";_rtorrent & spinner $!;echo
  1159. echo -n "Installing rutorrent into /srv ... ";_rutorrent & spinner $!;echo
  1160. echo -n "Installing rutorrent plugins ... ";_rutorrent-plugins & spinner $!;echo
  1161. echo -n "Installing deluge ... ";_deluge & spinner $!;echo
  1162. echo -n "Installing quickbox dashboard ... ";_dashboard & spinner $!;echo
  1163. echo -n "Setting up seedbox.conf for apache ... ";_apacheconf & spinner $!;echo
  1164. echo -n "Installing .rtorrent.rc for ${username} ... ";_rconf & spinner $!;echo
  1165. echo -n "Adjusting fileupload & filemanager plugins ... ";_plugins & spinner $!;echo
  1166. echo -n "Installing autodl-irssi ... ";_autodl & spinner $!;echo
  1167. echo -n "Making ${username} directory structure ... ";_makedirs & spinner $!;echo
  1168. echo -n "Writing ${username} rutorrent config.php file ... ";_ruconf & spinner $!;echo
  1169. echo -n "Installing vsftpd ... ";_installftpd & spinner $!;echo
  1170. echo -n "Setting up vsftpd ... ";_ftpdconfig & spinner $!;echo
  1171. _quickstats;
  1172. _quickconsole;
  1173. echo -n "Setting irssi/rtorrent to start on boot ... ";_boot & spinner $!;echo;
  1174. echo -n "Setting permissions on ${username} ... ";_perms & spinner $!;echo;
  1175. cd
  1176. E=$(date +%s)
  1177. DIFF=$(echo "$E" - "$S"|bc)
  1178. FIN=$(echo "$DIFF" / 60|bc)
  1179. clear
  1180. _finished
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement