Advertisement
Guest User

Untitled

a guest
Apr 12th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.65 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. function Cancel() {
  4. if [ "$Quit" -eq "1" ]; then
  5. exit 1
  6. fi
  7. }
  8. function InstallWhat() {
  9.  
  10. if [[ $Options == *"Apache"* ]]; then
  11. InstallApache=1
  12. echo "Install Apache"
  13. let "TotalInstall=TotalInstall+1"
  14. fi
  15.  
  16. if [[ $Options == *"Jacket"* ]]; then
  17. InstallJacket=1
  18. echo "Install Jacket"
  19. let "TotalInstall=TotalInstall+1"
  20. fi
  21.  
  22. if [[ $Options == *"NextCloud (Requires apache)"* ]]; then
  23. InstallNextCloud=1
  24. echo "Install NextCloud"
  25. let "TotalInstall=TotalInstall+1"
  26. fi
  27.  
  28. if [[ $Options == *"Plex"* ]]; then
  29. InstallPlex=1
  30. echo "Install Plex"
  31. let "TotalInstall=TotalInstall+1"
  32. fi
  33.  
  34. if [[ $Options == *"Raid Card (rr278x)"* ]]; then
  35. InstallRaidCard=1
  36. echo "Install Raid Card"
  37. let "TotalInstall=TotalInstall+1"
  38. fi
  39.  
  40. if [[ $Options == *"Sonarr"* ]]; then
  41. InstallSonarr=1
  42. echo "Install Sonarr"
  43. let "TotalInstall=TotalInstall+1"
  44. fi
  45.  
  46. if [[ $Options == *"Samba"* ]]; then
  47. InstallSamba=1
  48. echo "Install Samba"
  49. let "TotalInstall=TotalInstall+1"
  50. fi
  51.  
  52. if [[ $Options == *"Transmission"* ]]; then
  53. InstallTransmission=1
  54. echo "Install Transmission"
  55. let "TotalInstall=TotalInstall+1"
  56. fi
  57.  
  58. if [[ $Options == *"VNC"* ]]; then
  59. InstallVNC=1
  60. echo "Install VNC"
  61. let "TotalInstall=TotalInstall+1"
  62. fi
  63. }
  64. function UserExist() {
  65.  
  66. awk -F":" '{ print $1 }' /etc/passwd | grep -x $1 > /dev/null
  67.  
  68. if [ "$?" -eq "0" ]; then
  69. zenity --error --timeout 3 --text="$1 user is already used, please choose another username\!"
  70. Valid=0
  71. else
  72. zenity --info --timeout 2 --text="$1 user will be create"
  73. Valid=1
  74. fi
  75. }
  76. function TestValidUsername() {
  77. isValidUsername() {
  78. local re='^[[:lower:]_][[:lower:][:digit:]_-]{2,15}$'
  79. (( ${#1} > 16 )) && return 1
  80. [[ $1 =~ $re ]] # return value of this comparison is used for the function
  81. }
  82. if isValidUsername "$1"; then
  83. zenity --info --timeout 2 --text="$1 is a valid username"
  84. else
  85. zenity --error --timeout 3 --text="$1 is not a valid username\!"
  86. NotValidUser=1
  87. fi
  88. }
  89. function ApacheInstall() {
  90. sudo apt install -y apache2
  91.  
  92. Domain=$(zenity --text "Please enter you domain name (example.com)" --entry)
  93.  
  94. # Disable directory listing #
  95. sudo sed -i "s/Options Indexes FollowSymLinks/Options FollowSymLinks/" /etc/apache2/apache2.conf
  96.  
  97. sudo systemctl stop apache2.service
  98.  
  99. sudo a2enmod rewrite
  100. sudo a2enmod headers
  101. sudo a2enmod env
  102. sudo a2enmod dir
  103. sudo a2enmod mime
  104.  
  105. sudo systemctl start apache2.service
  106. sudo systemctl enable apache2.service
  107. }
  108. function Jackett-Install() {
  109.  
  110. mkdir -p /opt/jackett
  111.  
  112. sudo apt-get update -y
  113.  
  114. sudo apt-get install -y libcurl4-openssl-dev bzip2 mono-devel -y
  115.  
  116. cd /tmp
  117.  
  118. wget https://github.com/Jackett/Jackett/releases/download/v0.8.832/Jackett.Binaries.Mono.tar.gz
  119.  
  120. sudo tar -xvf Jackett*
  121.  
  122. sudo mv Jackett/* /opt/jackett
  123.  
  124. sudo chown -R $Admin:$Admin /opt/jackett
  125.  
  126. cat <<-EOF > /etc/systemd/system/jackett.service
  127. [Unit]
  128. Description=Jackett Daemon
  129. After=network.target
  130.  
  131. [Service]
  132. User=root
  133. Restart=always
  134. RestartSec=5
  135. Type=simple
  136. ExecStart=/usr/bin/mono --debug /opt/jackett/JackettConsole.exe --NoRestart
  137. TimeoutStopSec=20
  138.  
  139. [Install]
  140. WantedBy=multi-user.target
  141. EOF
  142.  
  143. sudo systemctl enable jackett
  144.  
  145. sudo service jackett start
  146. }
  147. function CreateDB-bash() {
  148.  
  149. cat <<-EOF > /usr/bin/createdb
  150. #!/bin/bash
  151.  
  152. EXPECTED_ARGS=3
  153. E_BADARGS=65
  154. MYSQL=`which mysql`
  155.  
  156. Q1="CREATE DATABASE $1;"
  157. Q2="GRANT USAGE ON *.* TO $2@localhost IDENTIFIED BY '$3';"
  158. Q3="GRANT ALL PRIVILEGES ON $1.* TO $2@localhost;"
  159. Q4="FLUSH PRIVILEGES;"
  160. SQL="${Q1}${Q2}${Q3}${Q4}"
  161.  
  162. if [ $# -ne $EXPECTED_ARGS ]
  163. then
  164. echo "Usage: $0 dbname dbuser dbpass"
  165. exit $E_BADARGS
  166. fi
  167.  
  168. $MYSQL -uroot -p -e "$SQL"
  169. EOF
  170.  
  171. sudo chmod 755 /usr/bin/createdb
  172. }
  173. function Dwnld-Ombi() {
  174. mkdir -p /opt/Ombi
  175.  
  176. cd /opt/Ombi
  177.  
  178. wget https://github.com/tidusjar/Ombi/releases/download/v3.0.3111/linux.tar.gz
  179.  
  180. sudo tar xzf linux.tar.gz
  181.  
  182. sudo chmod +x Ombi
  183.  
  184. sudo apt-get install libicu-dev
  185.  
  186. sudo apt-get install libunwind8
  187.  
  188. sudo apt-get install libcurl4-openssl-dev
  189.  
  190. cat <<-EOF > /etc/systemd/system/ombi.service
  191. [Unit]
  192. Description=Ombi - PMS Requests System
  193. After=network-online.target
  194.  
  195. [Service]
  196. User=root
  197. Group=root
  198. WorkingDirectory=/opt/Ombi/
  199. ExecStart=/opt/Ombi/Ombi
  200. Type=simple
  201. TimeoutStopSec=30
  202. Restart=on-failure
  203. RestartSec=5
  204.  
  205. [Install]
  206. WantedBy=multi-user.target
  207. EOF
  208.  
  209. sudo systemctl daemon-reload
  210. sudo systemctl start ombi
  211. sudo systemctl enable ombi.service
  212.  
  213. if [ "$ApacheInstall" -eq "1" ]; then
  214. cat <<-EOF > /etc/apache2/sites-available/request.conf
  215. <VirtualHost *:80>
  216. ServerName request.$Domain
  217. ProxyRequests off
  218. ProxyPreserveHost on
  219. ProxyPass / http://localhost:5000/
  220. ProxyPassReverse / http://localhost:5000/
  221. </VirtualHost>
  222. EOF
  223.  
  224. sudo a2ensite request.conf
  225.  
  226. fi
  227.  
  228. }
  229. function Dwnld-NextCloud() {
  230.  
  231. temp=$(zenity --text "Enter the NextCloud base directory (I'll create it in need be)" --entry)
  232. if [ -d "$temp" ]; then
  233. echo "Path exists"
  234. else
  235. echo "Path doesn't exist, i'll create it!"
  236. sudo mkdir -p "$temp"
  237. fi
  238.  
  239. cd /tmp && wget https://download.nextcloud.com/server/releases/nextcloud-11.0.1.zip
  240.  
  241. sudo unzip nextcloud-11.0.1.zip
  242.  
  243. sudo mv nextcloud /var/www/html/nextcloud/
  244.  
  245. cat <<-EOF > /etc/apache2/sites-available/nextcloud.conf
  246. <VirtualHost *:80>
  247. DocumentRoot /var/www/html/nextcloud/
  248. ServerName cloud.$Domain
  249.  
  250. Alias /nextcloud "/var/www/html/nextcloud/"
  251.  
  252. <Directory /var/www/html/nextcloud/>
  253. Options +FollowSymlinks
  254. AllowOverride All
  255. Require all granted
  256. <IfModule mod_dav.c>
  257. Dav off
  258. </IfModule>
  259. SetEnv HOME /var/www/html/nextcloud
  260. SetEnv HTTP_HOME /var/www/html/nextcloud
  261. </Directory>
  262.  
  263. ErrorLog ${APACHE_LOG_DIR}/error.log
  264. CustomLog ${APACHE_LOG_DIR}/access.log combined
  265.  
  266. </VirtualHost>
  267. EOF
  268.  
  269. sudo a2ensite nextcloud.conf
  270.  
  271. sudo chown -R www-data:www-data /var/www/html/nextcloud/
  272. sudo chmod -R 755 /var/www/html/nextcloud/
  273. }
  274. function Plex-Install() {
  275. sudo mkdir -p /Plex/1.0-2.0
  276.  
  277. echo deb https://downloads.plex.tv/repo/deb ./public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list
  278.  
  279. sudo apt-get update -y
  280.  
  281. curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -
  282.  
  283. sudo apt-get update -y
  284.  
  285. Sudo apt-get install -y plexmediaserver
  286.  
  287. echo "[Plex Plug-ins]
  288. path = /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins
  289. valid users = @smbgrp
  290. guest ok = no
  291. writable = yes
  292. browsable = yes
  293.  
  294. [Plex 1.0-2.0]
  295. path = /Plex/1.0-2.0
  296. valid users = @smbgrp
  297. guest ok = no
  298. writable = yes
  299. browsable = yes" >> /etc/samba/smb.conf
  300. }
  301. function Raid-Card-Install() {
  302. sudo apt-get install -y alien
  303.  
  304. #### Make instal and start Drivers ####
  305.  
  306. cd /tmp
  307.  
  308. sudo wget 'https://www.dropbox.com/s/fkgeez3w9uat9jd/rr278x-linux-src-v1.1.16.zip?dl=1' -O 'rr278x-linux-src-v1.1.16.zip' -c
  309.  
  310. sudo unzip rr278x-linux-src-v1.1.16.zip
  311.  
  312. cd /tmp/rr278x-linux-src-v1.1.16/product/rr278x/linux
  313.  
  314. make install
  315.  
  316. modprobe rr278x
  317.  
  318. #### Install web managment app ####
  319.  
  320. cd /tmp
  321.  
  322. arch=$(uname -m)
  323.  
  324. if [ "$arch" -eq "x86_64" ]; then
  325. sudo wget 'https://www.dropbox.com/s/4819uxc6lxzyq6x/hptsvr-https-2.1.5-13.0409.x86_64.rpm?dl=1' -O 'hptsvr-https-2.1.5-13.0409.x86_64.rpm' -c
  326.  
  327. sudo alien --scripts --install /tmp/hptsvr-https-2.1.5-13.0409.x86_64.rpm
  328. else
  329. sudo wget 'https://www.dropbox.com/s/c7rko8j4xnxsucq/hptsvr-https-2.1.5-13.0409.i386.rpm?dl=1' -O 'hptsvr-https-2.1.5-13.0409.i386.rpm' -c
  330.  
  331. sudo alien --scripts --install /tmp/hptsvr-https-2.1.5-13.0409.i386.rpm
  332. }
  333. function Sonarr-Install() {
  334. sudo mkdir -p /opt/NzbDrone
  335.  
  336. sudo apt-get install -y libmono-cil-dev
  337.  
  338. sudo apt-get install apt-transport-https -y
  339.  
  340. sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FDA5DFFC
  341.  
  342. sudo apt-get update -yes
  343.  
  344. sudo apt-get install -y nzbdrone
  345.  
  346. sudo rm /etc/apt/sources.list.d/sonarr.list
  347.  
  348. sudo chown -R "$Admin":"$Admin" /opt/NzbDrone
  349.  
  350. cd /etc/systemd/system/
  351.  
  352. cat <<-EOF > sonarr.service
  353. [Unit]
  354. Description=Sonarr Daemon
  355. After=network.target
  356.  
  357. [Service]
  358. User=plex-admin
  359. Group=plex-admin
  360.  
  361. Type=simple
  362. ExecStart=/usr/bin/mono /opt/NzbDrone/NzbDrone.exe -nobrowser
  363. TimeoutStopSec=20
  364. KillMode=process
  365. Restart=on-failure
  366.  
  367. [Install]
  368. WantedBy=multi-user.target
  369. EOF
  370.  
  371. sudo systemctl enable sonarr.service
  372.  
  373. sudo systemctl start sonarr.service
  374.  
  375. if [ "$ApacheInstall" -eq "1" ]; then
  376. cat <<-EOF > /etc/apache2/sites-available/sonarr.conf
  377. <VirtualHost *:80>
  378. ServerName sonarr.$Domain
  379. ProxyRequests off
  380. ProxyPreserveHost on
  381. ProxyPass / http://localhost:8989/
  382. ProxyPassReverse / http://localhost:8989/
  383. </VirtualHost>
  384. EOF
  385.  
  386. sudo a2ensite sonarr.conf
  387.  
  388. fi
  389.  
  390. }
  391. function Transmission-Install() {
  392. function replace-password() {
  393. local file="settings.json"
  394. local line_num="51"
  395. local replacement=' "rpc-password": '"$AdminPass"','
  396.  
  397. # Escape backslash, forward slash and ampersand for use as a sed replacement.
  398. replacement_escaped=$( echo "$replacement" | sed -e 's/[\/&]/\\&/g' )
  399.  
  400. sed -i "${line_num}s/.*/$replacement_escaped/" "$file"
  401. }
  402. function replace-username() {
  403. local file="settings.json"
  404. local line_num="54"
  405. local replacement=' "rpc-username": '"$Admin"','
  406.  
  407. # Escape backslash, forward slash and ampersand for use as a sed replacement.
  408. replacement_escaped=$( echo "$replacement" | sed -e 's/[\/&]/\\&/g' )
  409.  
  410. sed -i "${line_num}s/.*/$replacement_escaped/" "$file"
  411. }
  412. function replace-whitelist-enabled() {
  413. local file="settings.json"
  414. local line_num="56"
  415. local replacement=' "rpc-whitelist-enabled": "false",'
  416.  
  417. # Escape backslash, forward slash and ampersand for use as a sed replacement.
  418. replacement_escaped=$( echo "$replacement" | sed -e 's/[\/&]/\\&/g' )
  419.  
  420. sed -i "${line_num}s/.*/$replacement_escaped/" "$file"
  421. }
  422. function replace-download-dir() {
  423. local file="settings.json"
  424. local line_num="15"
  425. local replacement=' "download-dir": '"$DwlDir"','
  426.  
  427. # Escape backslash, forward slash and ampersand for use as a sed replacement.
  428. replacement_escaped=$( echo "$replacement" | sed -e 's/[\/&]/\\&/g' )
  429.  
  430. sed -i "${line_num}s/.*/$replacement_escaped/" "$file"
  431. }
  432. function replace-incomplete-download-dir() {
  433. local file="settings.json"
  434. local line_num="73"
  435. local replacement=' "download-dir": '"$IncDwlDir"','
  436.  
  437. # Escape backslash, forward slash and ampersand for use as a sed replacement.
  438. replacement_escaped=$( echo "$replacement" | sed -e 's/[\/&]/\\&/g' )
  439.  
  440. sed -i "${line_num}s/.*/$replacement_escaped/" "$file"
  441. }
  442.  
  443. sudo add-apt-repository ppa:transmissionbt/ppa -y
  444.  
  445. sudo apt update -y
  446.  
  447. sudo apt install -y transmission-cli transmission-common transmission-daemon
  448.  
  449. sudo service transmission-daemon stop
  450.  
  451. cd /var/lib/transmission-daemon/info
  452.  
  453. replace-password
  454. replace-username
  455. replace-whitelist-enabled
  456.  
  457. DwlDir=$(zenity --text "Enter the download dirrectory for transmission (I'll create it in need be)" --entry)
  458. IncDwlDir=$(zenity --text "Enter the incomplete download dirrectory for transmission (I'll create it in need be)" --entry)
  459.  
  460. if [ -d "$DwlDir" ]; then
  461. echo "Path exists"
  462. replace-download-dir
  463. else
  464. echo "Path doesn't exist, i'll create it!"
  465. sudo mkdir -p "$DwlDir"
  466. fi
  467.  
  468. if [ -d "$IncDwlDir" ]; then
  469. echo "Path exists"
  470. replace-incomplete-download-dir
  471. else
  472. echo "Path doesn't exist, i'll create it!"
  473. sudo mkdir -p "$IncDwlDir"
  474. fi
  475.  
  476. sudo service transmission-daemon start
  477.  
  478. if [ "$ApacheInstall" -eq "1" ]; then
  479. cat <<-EOF > /etc/apache2/sites-available/torrent.conf
  480. <VirtualHost *:80>
  481. ServerName torrent.$Domain
  482. ProxyRequests off
  483. ProxyPreserveHost on
  484. ProxyPass / http://localhost:9091/
  485. ProxyPassReverse / http://localhost:9091/
  486. </VirtualHost>
  487. EOF
  488.  
  489. sudo a2ensite torrent.conf
  490.  
  491. fi
  492.  
  493. }
  494. function NextCloud-Pre() {
  495. function File-Uploads() {
  496. local file="php.ini"
  497. local line_num="815"
  498. local replacement='file_uploads = On'
  499.  
  500. # Escape backslash, forward slash and ampersand for use as a sed replacement.
  501. replacement_escaped=$( echo "$replacement" | sed -e 's/[\/&]/\\&/g' )
  502.  
  503. sed -i "${line_num}s/.*/$replacement_escaped/" "$file"
  504. }
  505. function Allow-Url-Fopen() {
  506. local file="php.ini"
  507. local line_num="835"
  508. local replacement='allow_url_fopen = On'
  509.  
  510. # Escape backslash, forward slash and ampersand for use as a sed replacement.
  511. replacement_escaped=$( echo "$replacement" | sed -e 's/[\/&]/\\&/g' )
  512.  
  513. sed -i "${line_num}s/.*/$replacement_escaped/" "$file"
  514. }
  515. function Memory-Limit() {
  516. local file="php.ini"
  517. local line_num="404"
  518. local replacement='memory_limit = 256M'
  519.  
  520. # Escape backslash, forward slash and ampersand for use as a sed replacement.
  521. replacement_escaped=$( echo "$replacement" | sed -e 's/[\/&]/\\&/g' )
  522.  
  523. sed -i "${line_num}s/.*/$replacement_escaped/" "$file"
  524. }
  525. function Upload-Max() {
  526. local file="php.ini"
  527. local line_num="824"
  528. local replacement='upload_max_filesize = 1G'
  529.  
  530. # Escape backslash, forward slash and ampersand for use as a sed replacement.
  531. replacement_escaped=$( echo "$replacement" | sed -e 's/[\/&]/\\&/g' )
  532.  
  533. sed -i "${line_num}s/.*/$replacement_escaped/" "$file"
  534. }
  535. function Max-File-Upload() {
  536. local file="php.ini"
  537. local line_num="827"
  538. local replacement='max_file_uploads = 40'
  539.  
  540. # Escape backslash, forward slash and ampersand for use as a sed replacement.
  541. replacement_escaped=$( echo "$replacement" | sed -e 's/[\/&]/\\&/g' )
  542.  
  543. sed -i "${line_num}s/.*/$replacement_escaped/" "$file"
  544. }
  545. function Max-Exec-Time() {
  546. local file="php.ini"
  547. local line_num="383"
  548. local replacement='max_execution_time = 360'
  549.  
  550. # Escape backslash, forward slash and ampersand for use as a sed replacement.
  551. replacement_escaped=$( echo "$replacement" | sed -e 's/[\/&]/\\&/g' )
  552.  
  553. sed -i "${line_num}s/.*/$replacement_escaped/" "$file"
  554. }
  555. function Date-Timezone() {
  556. local file="php.ini"
  557. local line_num="939"
  558. local replacement="date.timezone = $Area"
  559.  
  560. # Escape backslash, forward slash and ampersand for use as a sed replacement.
  561. replacement_escaped=$( echo "$replacement" | sed -e 's/[\/&]/\\&/g' )
  562.  
  563. sed -i "${line_num}s/.*/$replacement_escaped/" "$file"
  564. }
  565. function AreaSet(){
  566. Area=$(zenity --entry --title "Land Mass" --text "${Area[@]}" --text "Please choose the appropriat one for your country.")
  567. retval=$?
  568.  
  569. case $retval in
  570. 0)
  571. if [ "$Area" == "Africa" ]; then
  572. AreaTemp=$(zenity --entry --title "Land Mass" --text "${Africa[@]}" --text "Please choose the appropriat one for your country.")
  573. retval=$?
  574. case $retval in
  575. 0)
  576. Area="$AreaTemp"
  577. ;;
  578. 1)
  579. AreaSet
  580. ;;
  581. esac
  582. elif [ "$Area" == "America" ]; then
  583. AreaTemp=$(zenity --entry --title "Land Mass" --text "${America[@]}" --text "Please choose the appropriat one for your country.")
  584. retval=$?
  585. case $retval in
  586. 0)
  587. Area="$AreaTemp"
  588. ;;
  589. 1)
  590. AreaSet
  591. ;;
  592. esac
  593. elif [ "$Area" == "Antarctica" ]; then
  594. AreaTemp=$(zenity --entry --title "Land Mass" --text "${Antarctica[@]}" --text "Please choose the appropriat one for your country.")
  595. retval=$?
  596. case $retval in
  597. 0)
  598. Area="$AreaTemp"
  599. ;;
  600. 1)
  601. AreaSet
  602. ;;
  603. esac
  604. elif [ "$Area" == "Arctic" ]; then
  605. AreaTemp=$(zenity --entry --title "Land Mass" --text "${Arctic[@]}" --text "Please choose the appropriat one for your country.")
  606. retval=$?
  607. case $retval in
  608. 0)
  609. Area="$AreaTemp"
  610. ;;
  611. 1)
  612. AreaSet
  613. ;;
  614. esac
  615. elif [ "$Area" == "Asia" ]; then
  616. AreaTemp=$(zenity --entry --title "Land Mass" --text "${Asia[@]}" --text "Please choose the appropriat one for your country.")
  617. retval=$?
  618. case $retval in
  619. 0)
  620. Area="$AreaTemp"
  621. ;;
  622. 1)
  623. AreaSet
  624. ;;
  625. esac
  626. elif [ "$Area" == "Atlantic" ]; then
  627. AreaTemp=$(zenity --entry --title "Land Mass" --text "${Atlantic[@]}" --text "Please choose the appropriat one for your country.")
  628. retval=$?
  629. case $retval in
  630. 0)
  631. Area="$AreaTemp"
  632. ;;
  633. 1)
  634. AreaSet
  635. ;;
  636. esac
  637. elif [ "$Area" == "Australia" ]; then
  638. AreaTemp=$(zenity --entry --title "Land Mass" --text "${Australia[@]}" --text "Please choose the appropriat one for your country.")
  639. retval=$?
  640. case $retval in
  641. 0)
  642. Area="$AreaTemp"
  643. ;;
  644. 1)
  645. AreaSet
  646. ;;
  647. esac
  648. elif [ "$Area" == "Europe" ]; then
  649. AreaTemp=$(zenity --entry --title "Land Mass" --text "${Europe[@]}" --text "Please choose the appropriat one for your country.")
  650. retval=$?
  651. case $retval in
  652. 0)
  653. Area="$AreaTemp"
  654. ;;
  655. 1)
  656. AreaSet
  657. ;;
  658. esac
  659. elif [ "$Area" == "Indian" ]; then
  660. AreaTemp=$(zenity --entry --title "Land Mass" --text "${Indian[@]}" --text "Please choose the appropriat one for your country.")
  661. retval=$?
  662. case $retval in
  663. 0)
  664. Area="$AreaTemp"
  665. ;;
  666. 1)
  667. AreaSet
  668. ;;
  669. esac
  670. elif [ "$Area" == "Pacific" ]; then
  671. AreaTemp=$(zenity --entry --title "Land Mass" --text "${Pacific[@]}" --text "Please choose the appropriat one for your country.")
  672. retval=$?
  673. case $retval in
  674. 0)
  675. Area="$AreaTemp"
  676. ;;
  677. 1)
  678. AreaSet
  679. ;;
  680. esac
  681. fi;;
  682. 1)
  683. echo "Will Default to Europe/London"
  684. ;;
  685. esac
  686. }
  687.  
  688. sudo apt-get install -y mariadb-server mariadb-client
  689.  
  690. sudo systemctl stop mysql.service
  691. sudo systemctl start mysql.service
  692. sudo systemctl enable mysql.service
  693.  
  694. echo -e '\ny\n$MySQLPass\n$MySQLPass\ny\ny\ny\ny\n' | sudo mysql_secure_installation
  695.  
  696. sudo systemctl restart mysql.service
  697.  
  698. sudo apt-get install -y software-properties-common
  699. sudo add-apt-repository -y ppa:ondrej/php
  700.  
  701. sudo apt update -y
  702.  
  703. sudo apt install -y php7.1 libapache2-mod-php7.1 php7.1-common libapache2-mod-php7.1 php7.1-mbstring php7.1-xmlrpc php7.1-soap php7.1-apcu php7.1-smbclient php7.1-ldap php7.1-redis php7.1-gd php7.1-xml php7.1-intl php7.1-json php7.1-imagick php7.1-mysql php7.1-cli php7.1-mcrypt php7.1-ldap php7.1-zip php7.1-curl
  704.  
  705. cd /etc/php/7.1/apache2/
  706.  
  707. File-Uploads
  708. Allow-Url-Fopen
  709. Memory-Limit
  710. Upload-Max
  711. Max-File-Upload
  712. Max-Exec-Time
  713. AreaSet
  714. Date-Timezone
  715. }
  716. function VNC-Install() {
  717.  
  718. apt install xfce4 xfce4-goodies tightvncserver
  719.  
  720. vncserver
  721.  
  722. vncserver -kill :1
  723.  
  724. mv ~/.vnc/xstartup ~/.vnc/xstartup.bak
  725.  
  726. echo "#!/bin/bash
  727. xrdb $HOME/.Xresources
  728. startxfce4 &" > ~/.vnc/xstartup
  729.  
  730. chmod +x ~/.vnc/xstartup
  731.  
  732. sudo vncserver :1
  733.  
  734. cd /
  735.  
  736. echo "@reboot /usr/bin/vncserver :1" >> Newcron
  737.  
  738. crontab Newcron
  739. }
  740. function Samba-Install() {
  741. sudo apt install -y samba samba-common python-glade2 system-config-samba
  742.  
  743. sudo mkdir -p /samba/anonymous
  744. sudo mkdir -p /samba/secured
  745.  
  746. echo "
  747. [Anonymous]
  748. path = /samba/anonymous
  749. browsable =yes
  750. writable = yes
  751. guest ok = yes
  752. read only = no
  753. force user = nobody
  754.  
  755. [Secured]
  756. path = /samba/secured
  757. valid users = @smbgrp
  758. guest ok = no
  759. writable = yes
  760. browsable = yes
  761.  
  762. [Temp]
  763. path = /tmp
  764. valid users = @smbgrp
  765. guest ok = no
  766. writable = yes
  767. browsable = yes" >> /etc/samba/smb.conf
  768.  
  769. sudo addgroup smbgrp
  770.  
  771. echo -e "Admin user "$Admin" added to samba group"
  772. sudo usermod -a -G smbgrp "$Admin"
  773. sudo smbpasswd -a "$Admin"
  774.  
  775. for i in "${Users[@]}"; do
  776. echo -e "User $i added to samba group"
  777. sudo usermod -a -G smbgrp "$i"
  778. sudo smbpasswd -a "$i"
  779. done
  780.  
  781. sudo chmod -R 0775 /samba/anonymous
  782. sudo chmod -R 0770 /samba/secured
  783. sudo chown -R nobody:nogroup /samba/anonymous
  784. sudo chown root:smbgrp /samba/secured
  785.  
  786. sudo service smbd restart
  787. }
  788. function SSL() {
  789.  
  790. sudo add-apt-repository ppa:certbot/certbot
  791.  
  792. sudo apt-get -y update
  793.  
  794. sudo apt-get install -y python-certbot-apache
  795.  
  796. sudo certbot --apache
  797. }
  798.  
  799. ########################
  800. # Start of Program #
  801. ########################
  802.  
  803. #### Global Variables ####
  804. Arrays
  805. Area=(0 Africa America Antarctica Arctic Asia Atlantic Australia Europe Indian Pacific)
  806.  
  807. Africa=(0 Africa/Abidjan Africa/Accra Africa/Addis_Ababa Africa/Algiers
  808. Africa/Asmara Africa/Bamako Africa/Bangui Africa/Banjul
  809. Africa/Bissau Africa/Blantyre Africa/Brazzaville Africa/Bujumbura
  810. Africa/Cairo Africa/Casablanca Africa/Ceuta Africa/Conakry
  811. Africa/Dakar Africa/Dar_es_Salaam Africa/Djibouti Africa/Douala
  812. Africa/El_Aaiun Africa/Freetown Africa/Gaborone Africa/Harare
  813. Africa/Johannesburg Africa/Juba Africa/Kampala Africa/Khartoum
  814. Africa/Kigali Africa/Kinshasa Africa/Lagos Africa/Libreville
  815. Africa/Lome Africa/Luanda Africa/Lubumbashi Africa/Lusaka
  816. Africa/Malabo Africa/Maputo Africa/Maseru Africa/Mbabane
  817. Africa/Mogadishu Africa/Monrovia Africa/Nairobi Africa/Ndjamena
  818. Africa/Niamey Africa/Nouakchott Africa/Ouagadougou Africa/Porto-Novo
  819. Africa/Sao_Tome Africa/Tripoli Africa/Tunis Africa/Windhoek)
  820.  
  821. America=(0 America/Adak America/Anchorage America/Anguilla America/Antigua
  822. America/Araguaina America/Argentina/Buenos_Aires America/Argentina/Catamarca America/Argentina/Cordoba
  823. America/Argentina/Jujuy America/Argentina/La_Rioja America/Argentina/Mendoza America/Argentina/Rio_Gallegos
  824. America/Argentina/Salta America/Argentina/San_Juan America/Argentina/San_Luis America/Argentina/Tucuman
  825. America/Argentina/Ushuaia America/Aruba America/Asuncion America/Atikokan
  826. America/Bahia America/Bahia_Banderas America/Barbados America/Belem
  827. America/Belize America/Blanc-Sablon America/Boa_Vista America/Bogota
  828. America/Boise America/Cambridge_Bay America/Campo_Grande America/Cancun
  829. America/Caracas America/Cayenne America/Cayman America/Chicago
  830. America/Chihuahua America/Costa_Rica America/Creston America/Cuiaba
  831. America/Curacao America/Danmarkshavn America/Dawson America/Dawson_Creek
  832. America/Denver America/Detroit America/Dominica America/Edmonton
  833. America/Eirunepe America/El_Salvador America/Fort_Nelson America/Fortaleza
  834. America/Glace_Bay America/Godthab America/Goose_Bay America/Grand_Turk
  835. America/Grenada America/Guadeloupe America/Guatemala America/Guayaquil
  836. America/Guyana America/Halifax America/Havana America/Hermosillo
  837. America/Indiana/Indianapolis America/Indiana/Knox America/Indiana/Marengo America/Indiana/Petersburg
  838. America/Indiana/Tell_City America/Indiana/Vevay America/Indiana/Vincennes America/Indiana/Winamac
  839. America/Inuvik America/Iqaluit America/Jamaica America/Juneau
  840. America/Kentucky/Louisville America/Kentucky/Monticello America/Kralendijk America/La_Paz
  841. America/Lima America/Los_Angeles America/Lower_Princes America/Maceio
  842. America/Managua America/Manaus America/Marigot America/Martinique
  843. America/Matamoros America/Mazatlan America/Menominee America/Merida
  844. America/Metlakatla America/Mexico_City America/Miquelon America/Moncton
  845. America/Monterrey America/Montevideo America/Montserrat America/Nassau
  846. America/New_York America/Nipigon America/Nome America/Noronha
  847. America/North_Dakota/Beulah America/North_Dakota/Center America/North_Dakota/New_Salem America/Ojinaga
  848. America/Panama America/Pangnirtung America/Paramaribo America/Phoenix
  849. America/Port-au-Prince America/Port_of_Spain America/Porto_Velho America/Puerto_Rico
  850. America/Punta_Arenas America/Rainy_River America/Rankin_Inlet America/Recife
  851. America/Regina America/Resolute America/Rio_Branco America/Santarem
  852. America/Santiago America/Santo_Domingo America/Sao_Paulo America/Scoresbysund
  853. America/Sitka America/St_Barthelemy America/St_Johns America/St_Kitts
  854. America/St_Lucia America/St_Thomas America/St_Vincent America/Swift_Current
  855. America/Tegucigalpa America/Thule America/Thunder_Bay America/Tijuana
  856. America/Toronto America/Tortola America/Vancouver America/Whitehorse
  857. America/Winnipeg America/Yakutat America/Yellowknife)
  858.  
  859. Antarctica=(0 Antarctica/Casey Antarctica/Davis Antarctica/DumontDUrville Antarctica/Macquarie
  860. Antarctica/Mawson Antarctica/McMurdo Antarctica/Palmer Antarctica/Rothera
  861. Antarctica/Syowa Antarctica/Troll Antarctica/Vostok)
  862.  
  863. Artic=(0 Arctic/Longyearbyen)
  864.  
  865. Asia=(0 Asia/Aden Asia/Almaty Asia/Amman Asia/Anadyr
  866. Asia/Aqtau Asia/Aqtobe Asia/Ashgabat Asia/Atyrau
  867. Asia/Baghdad Asia/Bahrain Asia/Baku Asia/Bangkok
  868. Asia/Barnaul Asia/Beirut Asia/Bishkek Asia/Brunei
  869. Asia/Chita Asia/Choibalsan Asia/Colombo Asia/Damascus
  870. Asia/Dhaka Asia/Dili Asia/Dubai Asia/Dushanbe
  871. Asia/Famagusta Asia/Gaza Asia/Hebron Asia/Ho_Chi_Minh
  872. Asia/Hong_Kong Asia/Hovd Asia/Irkutsk Asia/Jakarta
  873. Asia/Jayapura Asia/Jerusalem Asia/Kabul Asia/Kamchatka
  874. Asia/Karachi Asia/Kathmandu Asia/Khandyga Asia/Kolkata
  875. Asia/Krasnoyarsk Asia/Kuala_Lumpur Asia/Kuching Asia/Kuwait
  876. Asia/Macau Asia/Magadan Asia/Makassar Asia/Manila
  877. Asia/Muscat Asia/Nicosia Asia/Novokuznetsk Asia/Novosibirsk
  878. Asia/Omsk Asia/Oral Asia/Phnom_Penh Asia/Pontianak
  879. Asia/Pyongyang Asia/Qatar Asia/Qyzylorda Asia/Riyadh
  880. Asia/Sakhalin Asia/Samarkand Asia/Seoul Asia/Shanghai
  881. Asia/Singapore Asia/Srednekolymsk Asia/Taipei Asia/Tashkent
  882. Asia/Tbilisi Asia/Tehran Asia/Thimphu Asia/Tokyo
  883. Asia/Tomsk Asia/Ulaanbaatar Asia/Urumqi Asia/Ust-Nera
  884. Asia/Vientiane Asia/Vladivostok Asia/Yakutsk Asia/Yangon
  885. Asia/Yekaterinburg Asia/Yerevan)
  886.  
  887. Atlantic=(0 Atlantic/Azores Atlantic/Bermuda Atlantic/Canary Atlantic/Cape_Verde
  888. Atlantic/Faroe Atlantic/Madeira Atlantic/Reykjavik Atlantic/South_Georgia
  889. Atlantic/St_Helena Atlantic/Stanley)
  890.  
  891. Australia=(0 Australia/Adelaide Australia/Brisbane Australia/Broken_Hill Australia/Currie
  892. Australia/Darwin Australia/Eucla Australia/Hobart Australia/Lindeman
  893. Australia/Lord_Howe Australia/Melbourne Australia/Perth Australia/Sydney)
  894.  
  895. Europe=(0 Europe/Amsterdam Europe/Andorra Europe/Astrakhan Europe/Athens
  896. Europe/Belgrade Europe/Berlin Europe/Bratislava Europe/Brussels
  897. Europe/Bucharest Europe/Budapest Europe/Busingen Europe/Chisinau
  898. Europe/Copenhagen Europe/Dublin Europe/Gibraltar Europe/Guernsey
  899. Europe/Helsinki Europe/Isle_of_Man Europe/Istanbul Europe/Jersey
  900. Europe/Kaliningrad Europe/Kiev Europe/Kirov Europe/Lisbon
  901. Europe/Ljubljana Europe/London Europe/Luxembourg Europe/Madrid
  902. Europe/Malta Europe/Mariehamn Europe/Minsk Europe/Monaco
  903. Europe/Moscow Europe/Oslo Europe/Paris Europe/Podgorica
  904. Europe/Prague Europe/Riga Europe/Rome Europe/Samara
  905. Europe/San_Marino Europe/Sarajevo Europe/Saratov Europe/Simferopol
  906. Europe/Skopje Europe/Sofia Europe/Stockholm Europe/Tallinn
  907. Europe/Tirane Europe/Ulyanovsk Europe/Uzhgorod Europe/Vaduz
  908. Europe/Vatican Europe/Vienna Europe/Vilnius Europe/Volgograd
  909. Europe/Warsaw Europe/Zagreb Europe/Zaporozhye Europe/Zurich)
  910.  
  911. Indian=(0 Indian/Antananarivo Indian/Chagos Indian/Christmas Indian/Cocos
  912. Indian/Comoro Indian/Kerguelen Indian/Mahe Indian/Maldives
  913. Indian/Mauritius Indian/Mayotte Indian/Reunion)
  914.  
  915. Pacific=(0 Pacific/Apia Pacific/Auckland Pacific/Bougainville Pacific/Chatham
  916. Pacific/Chuuk Pacific/Easter Pacific/Efate Pacific/Enderbury
  917. Pacific/Fakaofo Pacific/Fiji Pacific/Funafuti Pacific/Galapagos
  918. Pacific/Gambier Pacific/Guadalcanal Pacific/Guam Pacific/Honolulu
  919. Pacific/Kiritimati Pacific/Kosrae Pacific/Kwajalein Pacific/Majuro
  920. Pacific/Marquesas Pacific/Midway Pacific/Nauru Pacific/Niue
  921. Pacific/Norfolk Pacific/Noumea Pacific/Pago_Pago Pacific/Palau
  922. Pacific/Pitcairn Pacific/Pohnpei Pacific/Port_Moresby Pacific/Rarotonga
  923. Pacific/Saipan Pacific/Tahiti Pacific/Tarawa Pacific/Tongatapu
  924. Pacific/Wake Pacific/Wallis)
  925. AdditionalUsers=1
  926. AdminSet=0
  927. AdminPassSet=0
  928. InstallApache=0
  929. InstallJacket=0
  930. InstallNextCloud=0
  931. InstallPlex=0
  932. InstallRaidCard=0
  933. InstallSonarr=0
  934. InstallSamba=0
  935. InstallTransmission=0
  936. InstallVNC=0
  937. NotValidUser=0
  938. Quit=0
  939. TotalInstall=0
  940. Valid=0
  941. Admin=""
  942. AdminPass=""
  943. Area=""
  944. DwlDir=""
  945. Domain=""
  946. IncDwlDir=""
  947. MySQLPass=""
  948. Options=""
  949. User=""
  950. Users=()
  951.  
  952. #### Check script is run as root ####
  953. if [[ $EUID -ne 0 ]]; then
  954. echo "This script must be run as root"
  955. exit 1
  956. fi
  957.  
  958. #### Install zenity (used for GUI) ####
  959. sudo apt-get install -y zenity
  960.  
  961. #### Set admin username ####
  962. while [[ "$Valid" -eq "0" && "$Quit" -eq "0" && "AdminSet" -eq "0" ]]; do
  963.  
  964. Admin=$(zenity --text "Enter the primary admin username" --entry)
  965. retval=$?
  966.  
  967. case $retval in
  968. 0)
  969. TestValidUsername $Admin
  970. if [ "$NotValidUser" -eq "0" ]; then
  971. UserExist $Admin
  972. fi
  973. if [[ "$Valid" -eq "1" && "$NotValidUser" -eq "0" ]]; then
  974. AdminSet=1
  975. Valid=0
  976. fi;;
  977. 1)
  978. Quit=1
  979. echo "Cancel pressed."
  980. Cancel $Quit;;
  981. esac
  982. done
  983.  
  984. #### Select and set what to install ####
  985. if [ "$AdminSet" -eq "1" ]; then
  986. Options=$(zenity --list --text="Choose what you want to install" --checklist --column="Pick" --column="Options" \
  987. TRUE "Apache" \
  988. FALSE "Jackett" \
  989. FALSE "NextCloud (Requires apache)" \
  990. TRUE "Plex" \
  991. TURE "Raid Card (rr278x)"\
  992. FALSE "Sonarr" \
  993. TRUE "Samba" \
  994. FALSE "Transmission" \
  995. TRUE "VNC"\
  996. --separator=":");
  997.  
  998. if [ "$?" -eq "1" ]; then
  999. Quit=1
  1000. Cancel $Quit
  1001. fi
  1002. fi
  1003. InstallWhat
  1004. if [ "InstallTransmission" -eq "1" ]; then
  1005.  
  1006.  
  1007. #### Create the admin user ####
  1008. echo -e "Creating $Admin user"
  1009. while [ "$AdminPassSet" -eq "0" ]; do
  1010. temp1=$(zenity --forms --title="Password" --text="Please set a password for admin" --add-password="Password")
  1011.  
  1012. temp2=$(zenity --forms --title="Password" --text="Please confirm password for admin" --add-password="Password")
  1013.  
  1014. if [ "$temp1" == "$temp2" ]; then
  1015. echo "Passwords Match"
  1016. AdminPassSet=1
  1017. else
  1018. echo "Paswords Dont Match"
  1019. AdminPassSet=0
  1020. fi
  1021. done
  1022. echo -e "$AdminPass\n$AdminPass\n\n\n\n\n\nY\n" | sudo adduser $Admin
  1023.  
  1024. #### Set aditional users ####
  1025. AdditionalUsers=$(zenity --question --text="Would you like to create additional users?"; echo $?)
  1026. if [ "$AdditionalUsers" -eq "0" ]; then
  1027.  
  1028. while [[ "$Valid" -eq "0" && "$Quit" -eq "0" ]]; do
  1029.  
  1030. User=$(zenity --text "Enter the aditional users, username" --entry)
  1031. retval=$?
  1032.  
  1033. case $retval in
  1034. 0)
  1035. TestValidUsername $User
  1036. if [ "$NotValidUser" -eq "0" ]; then
  1037. UserExist $User
  1038. fi
  1039. if [[ "$Valid" -eq "1" && "$NotValidUser" -eq "0" ]]; then
  1040. Users+=($User)
  1041. Valid=0
  1042. fi;;
  1043. 1)
  1044. j=$(zenity --question --text="Finished adding users?"; echo $?)
  1045. if [ "$j" -eq "0" ]; then
  1046. Quit=1
  1047. fi;;
  1048. esac
  1049. done
  1050. fi
  1051.  
  1052. #### Add all additional users ###
  1053. for i in "${Users[@]}"; do
  1054. echo -e "Creating $i user"
  1055. echo -e '\n\n\n\n\nY\n' | sudo adduser --disabled-password $i
  1056. done
  1057. echo -e "All users created"
  1058.  
  1059. #### Install curl ####
  1060. sudo apt-get install -y curl
  1061.  
  1062. sudo apt-get upgrade
  1063.  
  1064.  
  1065.  
  1066.  
  1067.  
  1068.  
  1069. #### Restart apache ####
  1070. sudo systemctl restart apache2.service
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement