Guest User

Untitled

a guest
Dec 1st, 2017
467
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.82 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # FullIPTV 2.0 / Installer 1.0
  4. # edited by maxdata755
  5. # maxdata755.online
  6. #
  7. apt-get update && apt-get upgrade -y
  8. #
  9. clear;
  10. # clear;
  11. # Reset
  12. Reset='\e[0m' # Text Reset
  13. # Regular Colors
  14. Black='\e[0;30m' # Black
  15. Red='\e[0;31m' # Red
  16. Green='\e[0;32m' # Green
  17. Yellow='\e[0;33m' # Yellow
  18. Blue='\e[0;34m' # Blue
  19. Purple='\e[0;35m' # Purple
  20. Cyan='\e[0;36m' # Cyan
  21. White='\e[0;37m' # White
  22. # Bold
  23. BBlack='\e[1;30m' # Black
  24. BRed='\e[1;31m' # Red
  25. BGreen='\e[1;32m' # Green
  26. BYellow='\e[1;33m' # Yellow
  27. BBlue='\e[1;34m' # Blue
  28. BPurple='\e[1;35m' # Purple
  29. BCyan='\e[1;36m' # Cyan
  30. BWhite='\e[1;37m' # White
  31.  
  32. # Tweak nameservers
  33. echo "nameserver 8.8.8.8" > /etc/resolv.conf
  34.  
  35.  
  36. echo -e "${BCyan}Checking your system...... [OK]${Reset}\n";
  37.  
  38. # TWEAK SYSTEM VALUES
  39. function tweakSystem {
  40. dpkg --remove-architecture i386 >> /dev/null 2>&1
  41. echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf
  42. echo "net.ipv6.conf.default.disable_ipv6 = 1" >> /etc/sysctl.conf
  43. echo "net.ipv6.conf.lo.disable_ipv6 = 1" >> /etc/sysctl.conf
  44. echo "fs.file-max = 32768" >> /etc/sysctl.conf
  45. echo "kern.maxfiles = 32768" >> /etc/sysctl.conf
  46. echo "kern.maxfilesperproc = 32768" >> /etc/sysctl.conf
  47. echo "kernel.core_uses_pid = 1" >> /etc/sysctl.conf
  48. echo "kernel.core_pattern = /var/crash/core-%e-%s-%u-%g-%p-%t" >> /etc/sysctl.conf
  49. echo "fs.suid_dumpable = 2" >> /etc/sysctl.conf
  50. sysctl -p >> /dev/null 2>&1
  51. }
  52. # SET LOCALE TO UTF-8
  53. function setLocale {
  54. locale-gen en_US.UTF-8 >> /dev/null 2>&1
  55. export LANG="en_US.UTF-8" >> /dev/null 2>&1
  56. }
  57. # SET MIRRORS
  58. function setMirrors {
  59. echo "deb http://ubuntu.mirrors.ovh.net/ftp.ubuntu.com/ubuntu/ $DISTRIB_CODENAME main restricted
  60. deb-src http://ubuntu.mirrors.ovh.net/ftp.ubuntu.com/ubuntu/ $DISTRIB_CODENAME main restricted
  61. deb http://ubuntu.mirrors.ovh.net/ftp.ubuntu.com/ubuntu/ $DISTRIB_CODENAME-updates main restricted
  62. deb-src http://ubuntu.mirrors.ovh.net/ftp.ubuntu.com/ubuntu/ $DISTRIB_CODENAME-updates main restricted
  63. deb http://ubuntu.mirrors.ovh.net/ftp.ubuntu.com/ubuntu/ $DISTRIB_CODENAME universe
  64. deb-src http://ubuntu.mirrors.ovh.net/ftp.ubuntu.com/ubuntu/ $DISTRIB_CODENAME universe
  65. deb http://ubuntu.mirrors.ovh.net/ftp.ubuntu.com/ubuntu/ $DISTRIB_CODENAME-updates universe
  66. deb-src http://ubuntu.mirrors.ovh.net/ftp.ubuntu.com/ubuntu/ $DISTRIB_CODENAME-updates universe
  67. deb http://ubuntu.mirrors.ovh.net/ftp.ubuntu.com/ubuntu/ $DISTRIB_CODENAME multiverse
  68. deb-src http://ubuntu.mirrors.ovh.net/ftp.ubuntu.com/ubuntu/ $DISTRIB_CODENAME multiverse
  69. deb http://ubuntu.mirrors.ovh.net/ftp.ubuntu.com/ubuntu/ $DISTRIB_CODENAME-updates multiverse
  70. deb-src http://ubuntu.mirrors.ovh.net/ftp.ubuntu.com/ubuntu/ $DISTRIB_CODENAME-updates multiverse
  71. deb http://ubuntu.mirrors.ovh.net/ftp.ubuntu.com/ubuntu/ $DISTRIB_CODENAME-backports main restricted universe multiverse
  72. deb-src http://ubuntu.mirrors.ovh.net/ftp.ubuntu.com/ubuntu/ $DISTRIB_CODENAME-backports main restricted universe multiverse
  73. deb http://security.ubuntu.com/ubuntu $DISTRIB_CODENAME-security main restricted
  74. deb-src http://security.ubuntu.com/ubuntu $DISTRIB_CODENAME-security main restricted
  75. deb http://security.ubuntu.com/ubuntu $DISTRIB_CODENAME-security universe
  76. deb-src http://security.ubuntu.com/ubuntu $DISTRIB_CODENAME-security universe
  77. deb http://security.ubuntu.com/ubuntu $DISTRIB_CODENAME-security multiverse
  78. deb-src http://security.ubuntu.com/ubuntu $DISTRIB_CODENAME-security multiverse
  79. deb http://cdn.fulliptv.com/medibuntu/ $DISTRIB_CODENAME free non-free
  80. deb-src http://cdn.fulliptv.com/medibuntu/ $DISTRIB_CODENAME free non-free
  81. " > /etc/apt/sources.list
  82. if [[ "$DISTRIB_CODENAME" = "trusty" ]]; then
  83. echo "" >> /dev/null
  84. else
  85. echo "deb http://cdn.fulliptv.com/medibuntu/ $DISTRIB_CODENAME free non-free" >> /etc/apt/sources.list
  86. echo "deb-src http://cdn.fulliptv.com/medibuntu/ $DISTRIB_CODENAME free non-free" >> /etc/apt/sources.list
  87. fi
  88. }
  89.  
  90. # install base packages
  91. function installBase {
  92. LANG=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive dpkg --configure -a >> /dev/null 2>&1
  93. LANG=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive apt-get update -y -q >> /dev/null 2>&1
  94. LANG=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive dpkg --configure -a >> /dev/null 2>&1
  95. LANG=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive apt-get install libjansson-dev -q -y --force-yes >> /dev/null 2>&1
  96. LANG=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive apt-get -y --force-yes -q install lsb-release apt-utils aptitude apt software-properties-common curl mtr debconf html2text wget whois whiptail vim-nox unzip tzdata sudo sysstat strace sshpass ssh-import-id tcpdump telnet screen python-software-properties python openssl ntpdate mc iptraf mailutils mlocate mtr htop gcc fuse ftp dnsutils ethtool curl dbconfig-common coreutils debianutils debconf bc bash-completion automake autoconf bwm-ng apt-utils aptitude apt git software-properties-common dos2unix dialog curl >> /dev/null 2>&1
  97. LANG=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive dpkg --configure -a >> /dev/null 2>&1
  98. }
  99.  
  100.  
  101.  
  102. function updateSSHPassword {
  103. NEWPASS=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 12 | head -n 1`
  104. NPASS=`php -r "echo base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5('fulliptvcrypthash'), '$NEWPASS', MCRYPT_MODE_CBC, md5(md5('fulliptvcrypthash'))));"`
  105. CHKUSER=`cat /etc/passwd | grep fulliptv`
  106. if [ -z "$CHKUSER" ]; then
  107. useradd -s /bin/bash -d /opt -g 0 -o -u 0 fulliptv >> /var/log/fulliptv-install.log 2>&1
  108. fi
  109. usermod --password `mkpasswd $NEWPASS` fulliptv >> /var/log/fulliptv-install.log 2>&1
  110. }
  111.  
  112. function installDatabase {
  113. if [ "$ISCMS" = "1" ]; then
  114. if [ -z `psql -U postgres -l -A -t | grep fulliptvxx` ]; then
  115. psql -U postgres -c "CREATE DATABASE fulliptvxx" >> /dev/null 2>&1
  116. psql -U postgres fulliptvxx < /opt/fulliptv/lib/fulliptv.sql >> /dev/null 2>&1
  117. else
  118. echo "${BCyan}Database found, skipping installing initial database...${Reset}";
  119. fi
  120. fi
  121. }
  122. function addServer {
  123. SERVERPORT=`cat /etc/ssh/sshd_config | grep "Port " | cut -d" " -f2`
  124. TOKEN=`php -r "echo md5(\"${SERVERIP}\");"`
  125. RES=`curl -s "http://$CMSURL:$CMSPORT/cron?addServer=true&server_name=$SERVERNAME&server_ip=$SERVERIP&server_private_ip=$SERVERINTIP&server_port=$SERVERPORT&server_auth=$NEWPASS&token=$TOKEN"`
  126. if [ "$RES" = "OK" ]; then
  127. echo -e "${BGreen}Server added to the database !${Reset}";
  128. fi
  129. if [ "$RES" = "UPDATED" ]; then
  130. echo -e "${BGreen}Server updated into database !${Reset}";
  131. fi
  132. }
  133. function addServerToDatabase {
  134. CHK=`PGPASSWORD="Pass22pp2019ssh808" psql -U postgres -h $CMSURL fulliptvxx -A -t -c "SELECT id FROM servers WHERE server_host = '$SERVERNAME'"` >> /dev/null 2>&1
  135. if [ -z "$CHK" ]; then
  136. SERVERPORT=`cat /etc/ssh/sshd_config | grep "Port " | cut -d" " -f2`
  137. PGPASSWORD="Pass22pp2019ssh808" psql -U postgres -h $CMSURL fulliptvxx -A -t -c "INSERT INTO servers ( server_name, server_host, server_ip, server_private_ip, server_port, server_upload, server_download, server_max_clients, server_max_channels, active, status, server_auth ) VALUES ( '$SERVERNAME', '$SERVERNAME', '$SERVERIP', '$SERVERINTIP', '$SERVERPORT', '1000', '1000', '1000', '1000', 't', 't', '${NPASS}' )" >> /dev/null 2>&1
  138. echo -e "${BGreen}Server added to the CMS !${Reset}";
  139. else
  140. echo -e "${BGreen}This server is already added to the CMS !${Reset}";
  141. fi
  142. }
  143.  
  144. function updateServerDatabasePass {
  145. PGPASSWORD="Pass22pp2019ssh808" psql -U postgres -h $CMSURL fulliptvxx -c "UPDATE servers SET server_auth = '$NPASS' WHERE server_host = '$SERVERNAME'" >> /var/log/fulliptv-install.log 2>&1
  146. }
  147.  
  148. function writeConfig {
  149. mkdir -p /opt/fulliptv/etc/ >> /dev/null 2>&1
  150. echo "CMSURL=$CMSURL" > /opt/fulliptv/etc/fulliptv.conf
  151. echo "CMSPORT=$CMSPORT" >> /opt/fulliptv/etc/fulliptv.conf
  152. echo "SERVERNAME=$SERVERNAME" >> /opt/fulliptv/etc/fulliptv.conf
  153. echo "SERVERIP=$SERVERIP" >> /opt/fulliptv/etc/fulliptv.conf
  154. echo "SERVERINTIP=$SERVERINTIP" >> /opt/fulliptv/etc/fulliptv.conf
  155. echo "ISCMS=$ISCMS" >> /opt/fulliptv/etc/fulliptv.conf
  156. echo "ISSTREAMER=$ISSTREAMER" >> /opt/fulliptv/etc/fulliptv.conf
  157. }
  158.  
  159. function upgradeFiles {
  160. if [ "$ISCMS" = "1" ]; then
  161. wget -O /tmp/fulliptv.tgz http://cdn.fulliptv.com/fulliptv-cms.tgz >> /dev/null 2>&1
  162. tar xzvf /tmp/fulliptv.tgz -C /opt >> /dev/null 2>&1
  163. rm -rf /tmp/fulliptv.tgz >> /dev/null 2>&1
  164. fi
  165. if [ "$ISSTREAMER" = "1" ]; then
  166. wget -O /tmp/fulliptv.tgz http://cdn.fulliptv.com/fulliptv-streamer.tgz >> /dev/null 2>&1
  167. tar xzvf /tmp/fulliptv.tgz -C /opt >> /dev/null 2>&1
  168. rm -rf /tmp/fulliptv.tgz >> /dev/null 2>&1
  169. fi
  170. }
  171.  
  172. function installCMSPackages {
  173. LANG=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive dpkg --configure -a >> /dev/null 2>&1
  174. LANG=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive apt-get install php5-fpm php5-mcrypt php5-pgsql php5-cli php5-curl php5-gd php-pear libssh2-php php5-json libxslt1.1 daemontools postgresql-client -q -y --force-yes >> /dev/null 2>&1
  175. LANG=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive apt-get install libva1 libxfixes3 libxext6 libasound2 libsdl1.2debian libtheora0 libmp3lame0 libass4 libvdpau1 daemontools postgresql-client apache2 php5 libapache2-mod-php5 -q -y --force-yes >> /dev/null 2>&1
  176. if [ "$DISTRIB_CODENAME" != "trusty" ]; then
  177. LANG=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive apt-get install postgresql-9.1 -y --force-yes >> /dev/null 2>&1
  178. echo -e "local all postgres trust\n" > /etc/postgresql/9.1/main/pg_hba.conf
  179. echo -e "local all all trust\n" >> /etc/postgresql/9.1/main/pg_hba.conf
  180. echo -e "host all all 127.0.0.1/32 trust\n" >> /etc/postgresql/9.1/main/pg_hba.conf
  181. echo -e "host all all ::1/128 trust\n" >> /etc/postgresql/9.1/main/pg_hba.conf
  182. # echo -e "host all all 0.0.0.0/0 md5\n" >> /etc/postgresql/9.1/main/pg_hba.conf
  183. echo -e "listen_addresses = '*'\n" >> /etc/postgresql/9.1/main/postgresql.conf
  184. else
  185. LANG=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive apt-get install postgresql-9.3 -y --force-yes >> /dev/null 2>&1
  186. echo -e "local all postgres trust\n" > /etc/postgresql/9.3/main/pg_hba.conf
  187. echo -e "local all all trust\n" >> /etc/postgresql/9.3/main/pg_hba.conf
  188. echo -e "host all all 127.0.0.1/32 trust\n" >> /etc/postgresql/9.3/main/pg_hba.conf
  189. echo -e "host all all ::1/128 trust\n" >> /etc/postgresql/9.3/main/pg_hba.conf
  190. # echo -e "host all all 0.0.0.0/0 md5\n" >> /etc/postgresql/9.3/main/pg_hba.conf
  191. echo -e "listen_addresses = '*'\n" >> /etc/postgresql/9.3/main/postgresql.conf
  192. fi
  193. /etc/init.d/postgresql restart >> /var/log/fulliptv-install.log 2>&1
  194. psql -U postgres -c "ALTER USER postgres WITH PASSWORD 'Pass22pp2019ssh808'" >> /var/log/fulliptv-install.log 2>&1
  195. }
  196.  
  197. function installStreamerPackages {
  198. LANG=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive dpkg --configure -a >> /dev/null 2>&1
  199. LANG=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive apt-get install daemontools postgresql-client x264 -q -y --force-yes >> /dev/null 2>&1
  200. LANG=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive apt-get purge -y --force-yes -qq vlc-data vlc-nox vlc >> /dev/null 2>&1
  201. LANG=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive apt-get autoremove -y --force-yes -qq >> /dev/null 2>&1
  202. LANG=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes -qq ubuntu-restricted-extras >> /dev/null 2>&1
  203. LANG=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive apt-get update >> /dev/null 2>&1
  204. if [ "$DISTRIB_CODENAME" = "saucy" ]; then
  205. LANG=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes -qq vlc-nox vlc ffmpeg non-free-codecs x264 php5 php5-mcrypt >> /dev/null 2>&1
  206. elif [ "$DISTRIB_CODENAME" = "trusty" ]; then
  207. LANG=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes -qq vlc-nox vlc x264 php5 php5-mcrypt >> /dev/null 2>&1
  208. else
  209. LANG=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes -qq vlc-nox vlc ffmpeg non-free-codecs x264 php5 php5-mcrypt >> /dev/null 2>&1
  210. fi
  211.  
  212. setupMcrypt;
  213. }
  214.  
  215. function setupCMS {
  216. CHKZEND=`cat /etc/php5/apache2/php.ini | grep zend_exten`
  217. if [ -z "$CHKZEND" ]; then
  218. echo "zend_extension=/opt/fulliptv/lib/ioncube/ioncube_loader_lin_5.5.so" >> /etc/php5/apache2/php.ini
  219. fi
  220. CHKZEND=`cat /etc/php5/cli/php.ini | grep zend_exten`
  221. if [ -z "$CHKZEND" ]; then
  222. echo "zend_extension=/opt/fulliptv/lib/ioncube/ioncube_loader_lin_5.5.so" >> /etc/php5/cli/php.ini
  223. fi
  224. apt-get install -y --force-yes apache2 -q >> /dev/null 2>&1
  225. /etc/init.d/nginx stop >> /dev/null 2>&1
  226. cp -R /etc/php5/conf.d/* /etc/php5/apache2/conf.d/ >> /dev/null 2>&1
  227. cp -R /etc/php5/conf.d/* /etc/php5/cli/conf.d/ >> /dev/null 2>&1
  228. php5enmod ssh2 >> /dev/null 2>&1
  229. php5enmod mcrypt >> /dev/null 2>&1
  230. a2enmod rewrite >> /dev/null 2>&1
  231.  
  232. killall -9 nginx >> /dev/null 2>&1
  233. killall -9 php5-fpm >> /dev/null 2>&1
  234. killall -9 php-fpm >> /dev/null 2>&1
  235. echo "Listen $CMSPORT" > /etc/apache2/ports.conf
  236. echo "<VirtualHost *:$CMSPORT>
  237. ServerAdmin info@fulliptv.com
  238. ServerName ${CMSURL}
  239. DocumentRoot /opt/fulliptv/portal
  240. <Directory />
  241. Options FollowSymLinks
  242. AllowOverride All
  243. Require all granted
  244. </Directory>
  245. <Directory /opt/fulliptv/portal>
  246. Options FollowSymLinks
  247. AllowOverride All
  248. Require all granted
  249. </Directory>
  250. ErrorLog \${APACHE_LOG_DIR}/${CMSURL}-error.log
  251. LogLevel warn
  252. CustomLog \${APACHE_LOG_DIR}/${CMSURL}-access.log combined
  253. </VirtualHost>
  254. " > /etc/apache2/sites-enabled/000-default.conf
  255. /etc/init.d/apache2 restart >> /dev/null 2>&1
  256. CHKRC=`cat /etc/crontab | grep fulliptv`
  257. if [ -z "$CHKRC" ]; then
  258. echo "*/5 * * * * root wget -O /dev/null \"http://${CMSURL}/cron.php\" >> /dev/null 2>&1" >> /etc/crontab
  259. fi
  260. psql -U postgres fulliptvxx -c "UPDATE settings SET config_value = '$CMSVER' WHERE config_name = 'current_version' OR config_name = 'new_version'" >> /dev/null 2>&1
  261. }
  262. function setupMcrypt {
  263. php5enmod mcrypt >> /dev/null 2>&1
  264. cp -R /etc/php5/conf.d/* /etc/php5/apache2/conf.d/ >> /dev/null 2>&1
  265. cp -R /etc/php5/conf.d/* /etc/php5/cli/conf.d/ >> /dev/null 2>&1
  266. }
  267.  
  268.  
  269. function setupStreamer {
  270. cp -R /etc/php5/conf.d/* /etc/php5/apache2/conf.d/ >> /dev/null 2>&1
  271. cp -R /etc/php5/conf.d/* /etc/php5/cli/conf.d/ >> /dev/null 2>&1
  272. php5enmod mcrypt >> /dev/null 2>&1
  273. ( killall -9 hitrow vlc supervise ; supervise /opt/fulliptv/bin & ) >> /dev/null 2>&1
  274. CHKRC=`cat /etc/rc.local | grep fulliptv`
  275. if [ -z "$CHKRC" ]; then
  276. echo "( killall -9 hitrow vlc supervise ; supervise /opt/fulliptv/bin & ) >> /dev/null 2>&1" > /etc/rc.local
  277. fi
  278. }
  279.  
  280. function cleanUp {
  281. # Remove any temp data or package data.
  282. if [ "$ISSTREAMER" = "1" ]; then
  283. /etc/init.d/apache2 stop >> /dev/null 2>&1
  284. ( killall -9 hitrow vlc supervise ; supervise /opt/fulliptv/bin & ) >> /dev/null 2>&1
  285. fi
  286. if [ "$ISCMS" = "1" ]; then
  287. /etc/init.d/apache2 start >> /dev/null 2>&1
  288. fi
  289. apt-get purge -y --force-yes fulliptv nginx -q >> /dev/null 2>&1
  290.  
  291. /etc/init.d/nginx stop >> /dev/null 2>&1
  292. killall -9 php5-fpm >> /dev/null 2>&1
  293. killall -9 php-fpm >> /dev/null 2>&1
  294. killall -9 nginx >> /dev/null 2>&1
  295. rm -rf /opt/fulliptv/lib/fulliptv.sql >> /dev/null 2>&1
  296. rm -rf /opt/fulliptv/lib/nginx* >> /dev/null 2>&1
  297. rm -rf /tmp/fulliptv* >> /dev/null 2>&1
  298. mkdir /opt/fulliptv/vod >> /dev/null 2>&1
  299. chown -R www-data:www-data /opt/fulliptv >> /dev/null 2>&1
  300. chmod -R 777 /opt/fulliptv/vod >> /dev/null 2>&1
  301. wget -O /dev/null "http://cdn.fulliptv.com/install.php?cmsurl=$CMSURL&servername=$SERVERNAME&serverip=$SERVERIP&serverintip=$SERVERINTIP&iscms=$ISCMS&isstreamer=$ISSTREAMER" > /dev/null 2>&1
  302.  
  303. }
  304.  
  305.  
  306. ### STARTING PROPER SCRIPT ###
  307. tweakSystem;
  308. setLocale;
  309. setMirrors;
  310. installBase;
  311.  
  312. # Gathering latest version of software
  313. CMSVER=`curl -s "http://cdn.fulliptv.com/VERSION" | xargs`
  314. HITVER=`curl -s "http://cdn.fulliptv.com/HITROWVERSION" | xargs`
  315.  
  316. # UPGARDE IF EXISTING INSTALLATION
  317. if [ -f /opt/fulliptv/etc/fulliptv.conf ]; then
  318. . /opt/fulliptv/etc/fulliptv.conf >> /dev/null 2>&1
  319. if [ -z "$CMSPORT" ]; then
  320. CMSPORT="80"
  321. fi
  322. CURVER=`cat /opt/fulliptv/etc/VERSION`
  323. # CHECK IF UPDATE NEEDED
  324. if [ "$CMSVER" = "$CURVER" ]; then
  325. if [ "$1" != "force" ]; then
  326. echo -e "${BCyan}You already have the latest version ${BYellow}v$CMSVER${BCyan}, no update to make!${Reset}";
  327. exit 0;
  328. else
  329. echo -e "${BCyan}Forcing update!${Reset}";
  330. fi
  331. fi
  332.  
  333. setupMcrypt;
  334. upgradeFiles;
  335. updateSSHPassword;
  336. if [ "$ISCMS" = "1" ]; then
  337. # UPDATE CMS
  338. echo -e "${BGreen}Updating CMS${Reset}";
  339. psql -U postgres fulliptvxx -c "UPDATE settings SET config_value = '$CMSVER' WHERE config_name = 'current_version' OR config_name = 'new_version'" >> /dev/null 2>&1
  340. fi
  341. if [ "$ISSTREAMER" = "1" ]; then
  342. # UPDATE STREAMER
  343. echo -e "${BGreen}Updating streamer${Reset}";
  344. addServer;
  345. # updateServerDatabasePass;
  346. fi
  347. cleanUp;
  348. echo -e "${BGreen}Updated to version ${BYellow}v$CMSVER${BGreen} !${Reset}";
  349. # NEW INSTALL
  350. else
  351. echo -ne "${BWhite}What to install ? ( 1|CMS , 2|STREAMER , 3|ALL-IN-ONE ) : ${Reset}";
  352. read SERVERTYPE
  353. if [ "$SERVERTYPE" = "1" ]; then
  354. ISCMS=1
  355. ISSTREAMER=0
  356. fi
  357. if [ "$SERVERTYPE" = "2" ]; then
  358. ISCMS=0
  359. ISSTREAMER=1
  360. fi
  361. if [ "$SERVERTYPE" = "3" ]; then
  362. ISCMS=1
  363. ISSTREAMER=1
  364. fi
  365. if [[ "$SERVERTYPE" != "1" && "$SERVERTYPE" != "2" && "$SERVERTYPE" != "3" ]]; then
  366. echo -e "${Red}You didn't selected anything! Aborting.${Reset}";
  367. exit;
  368. fi
  369. echo -ne "${BWhite}CMS URL without http:// ( subdomain.domain.com ) : ${Reset}";
  370. read CMSURL
  371. if [ -z "$CMSURL" ]; then
  372. echo -e "${BRed}You need to provide CMS URL !${Reset}";
  373. exit 1;
  374. fi
  375. echo -ne "${BWhite}CMS PORT, numeric only ( 8080 ) : ${Reset}";
  376. read CMSPORT
  377. if [ -z "$CMSPORT" ]; then
  378. CMSPORT="80"
  379. fi
  380. if [[ "$SERVERTYPE" = "3" && "$CMSPORT" = "80" ]]; then
  381. echo -e "${Red}You MUST use different port for cms if you want to install all in one! Aborting.${Reset}";
  382. exit;
  383. fi
  384. echo -ne "${BWhite}SERVER NAME ( ex. s01.domain.com ) : ${Reset}";
  385. read SERVERNAME
  386. if [ -z "$SERVERNAME" ]; then
  387. echo -e "${BRed}You need to provide SERVER NAME !${Reset}";
  388. exit 1;
  389. fi
  390. echo -ne "${BWhite}EXTERNAL IP ADDRESS : ${Reset}";
  391. read SERVERIP
  392. if [ -z "$SERVERIP" ]; then
  393. echo -e "${BRed}You need to provide EXTERNAL IP !${Reset}";
  394. exit 1;
  395. fi
  396. echo -ne "${BWhite}PRIVATE IP ADDRESS, if you don't have, same as above : ${Reset}";
  397. read SERVERINTIP
  398. if [ -z "$SERVERINTIP" ]; then
  399. echo -e "${BRed}You need to provide PRIVATE IP !${Reset}";
  400. exit 1;
  401. fi
  402.  
  403. writeConfig;
  404. upgradeFiles;
  405. ### FROM HERE WE INSTALL EVERYTHING ###
  406. if [ "$ISCMS" = "1" ]; then
  407. # Install packages
  408. installCMSPackages;
  409. # Install INITIAL DATABASE
  410. installDatabase;
  411. # Setup configs
  412. setupCMS;
  413. fi
  414.  
  415. if [ "$ISSTREAMER" = "1" ]; then
  416. # Install packages
  417. installStreamerPackages;
  418. # Setup streamer
  419. setupStreamer;
  420. # Make new ssh password
  421. updateSSHPassword;
  422. # Add the streamer to database
  423. addServer;
  424. # addServerToDatabase;
  425. fi
  426. # Removing temp files, restarting services
  427. cleanUp;
  428. echo -e "${BGreen}Installed version ${BYellow}v$CMSVER${BGreen} !${Reset}";
  429. fi
  430. echo " "
  431. echo "####################################################################################"
  432. echo " "
  433. echo "Installationsdateien werden entfernt"
  434. echo " "
  435. rm /root/full-iptv2.0inst.sh
  436. echo " "
  437. echo "####################################################################################"
  438. echo " "
  439. echo "FullIPTV 2.0 edited by maxdata755...have fun"
  440. echo " "
  441. echo "Installation abgeschlossen..."
  442. echo " "
  443. echo "Der Server muss nun neu gestartet werden !!!"
  444. read -p "Reboot (y/n)?" CONT
  445. if [ "$CONT" == "y" ] || [ "$CONT" == "Y" ]; then
  446. reboot
  447. fi
Add Comment
Please, Sign In to add comment