#!/bin/sh remove(){ echo '\n'"$(tput setaf 1)[!] Note REMOVE will delete completly MySQL installation and restereamer files [!]$(tput sgr0)" echo "" read -rp 1 -p "Would you like to (R)emove , (C)ancel ?" choise; case $choise in R|r) echo '\n'"$(tput setaf 1)[!] Removing Installed...wait [!]$(tput sgr0)" /nice/restream.sh stop > /dev/null 2>&1 & pid=$! spinner rm -r /nice > /dev/null 2>&1 & pid=$! spinner apt-get purge -y --force-yes ubuntu-restricted-extras > /dev/null 2>&1 & pid=$! spinner service mysql stop #killall -KILL mysql mysqld_safe mysqld apt-get -y --force-yes purge mysql* > /dev/null 2>&1 & pid=$! spinner rm -rf /etc/apparmor.d/abstractions/mysql /etc/apparmor.d/cache/usr.sbin.mysqld /etc/mysql /var/lib/mysql /var/log/mysql* /var/log/upstart/mysql.log* /var/run/mysqld ~/.mysql_history #rm -rf /var/lib/mysql/db_login #rm -rf /etc/mysql* apt-get -y --force-yes autoremove > /dev/null 2>&1 & pid=$! spinner sudo apt-get -y --force-yes autoclean > /dev/null 2>&1 & pid=$! spinner echo "\n$(tput setaf 2)[!] Removing Done [!]$(tput sgr0)" sleep 4 echo "" sleep 2;; C|c) echo "$(tput setaf 2)[!] Remove Canceled....... [!]$(tput sgr0)" sleep 3;; *) esac } linuxver(){ if [ -f /etc/lsb-release ]; then . /etc/lsb-release fi echo "" echo "Installing on Distribution Release:" $DISTRIB_RELEASE } installexist() { if [ -d "/nice" ]; then echo '\n'"$(tput setaf 1)[!] Nice Restreamer folder exist? [!]$(tput sgr0)" echo "" read -rp 1 -p "Would you like to (R)emove , (C)ontinue (E)xit ?" choise; case $choise in R|r) rm -r /nice echo "" echo "$(tput setaf 1)[!] Restreamer Folder Removed [!]$(tput sgr0)" killall -9 nodenice-linux > /dev/null 2>&1 echo "" sleep 2;; C|c) echo "" echo "$(tput setaf 2)[!] Killing Restreamer and Continue Setup .... [!]$(tput sgr0)" killall -9 nodenice-linux > /dev/null 2>&1 sleep 1;; E|e) echo "$(tput setaf 2)[!] Exiting......bye bye [!]$(tput sgr0)" echo "$(tput setaf 2)[!] For future questions and custom builds Please contact us at niceiptvpanel@gmail.com [!]$(tput sgr0)" sleep 1 exit;; *) esac fi } network(){ echo "$(tput setaf 3)[+] Network Check Setup [+]$(tput sgr0)" interface=$(ls /sys/class/net | grep -v lo) if [ $DISTRIB_RELEASE = "17.04" ] || [ $DISTRIB_RELEASE = "16.10" ] ; then ipaddress=$(ifconfig $interface | grep "inet " | cut -d ':' -f2 | awk '{print $2}') else ipaddress=$(ifconfig $interface | grep "inet " | cut -d ':' -f2 | awk '{print $1}') fi echo "" echo "Network Interface:" $interface echo "IP address:" $ipaddress echo "" echo "$(tput setaf 2)[+] Done [+]$(tput sgr0)" echo "" } spinner(){ printf "$(tput setaf 2)[" while kill -0 $pid 2> /dev/null; do printf "##" sleep 1 done printf "$(tput setaf 2)] Done [+]$(tput sgr0)\n" } segmenter(){ echo "[+] Installing Needed Library ....please wait" apt-get update > /dev/null 2>&1 & pid=$! spinner apt-get install -y --force-yes ubuntu-restricted-extras > /dev/null 2>&1 & pid=$! spinner wget -qN nice.minimal103.com/libavcodec.so.54.71.100 -O /usr/lib/x86_64-linux-gnu/libavcodec.so.54 > /dev/null 2>&1 & pid=$! spinner wget -qN nice.minimal103.com/libavformat.so.54.36.100 -O /usr/lib/x86_64-linux-gnu/libavformat.so.54 > /dev/null 2>&1 & pid=$! spinner wget -qN nice.minimal103.com/libavutil.so.52.6.100 -O /usr/lib/x86_64-linux-gnu/libavutil.so.52 > /dev/null 2>&1 & pid=$! spinner ldconfig > /dev/null 2>&1 echo "" } installpersonal(){ echo "$(tput setaf 3)[+] Requesting Install Files [+]$(tput sgr0)" mkdir /nice > /dev/null 2>&1 if ! wget -q nice.minimal103.com/nodenice-personal.tar.gz -P /tmp; then echo "Install Source Missing !! Please contact us at niceiptvpanel@gmail.com" exit fi tar xvzf /tmp/nodenice-personal.tar.gz --strip-components=1 -C /nice > /dev/null 2>&1 & pid=$! spinner sleep 1 rm -r /tmp/nodenice-personal.tar.gz > /dev/null 2>&1 echo "" echo "$(tput setaf 2)[+] Done [+]$(tput sgr0)" echo "" echo "$(tput setaf 3)[+] Nice re/streamer Personal Setup [+]$(tput sgr0)" echo "" echo "$(tput setaf 1)[R] Ports Should be diffrent !!! [R]$(tput sgr0)" echo "" read -rp $'~~Enter Port for Mpegts streaming (0 to dissable) : ' mpegtsport echo "" read -rp $'~~Enter Port for HLS streaming (0 to dissable) : ' hlsport echo "" read -rp $'~~Enter Port for Web interface : ' webport echo "" read -rp $'~~Enter Username for Web interface : ' webuser echo "" read -rp $'~~Enter Password for Web interface : ' webpass echo "" read -rp $'~~Enter WAN IP to output M3U list : ' m3ulist echo "" echo "$(tput setaf 2)[+] Done [+]$(tput sgr0)" echo "" echo "$(tput setaf 3)[+] MySQL Setup [+]$(tput sgr0)" sqldatabase="db_login" sqluname="root" mysqlex=$(pidof /usr/sbin/mysqld) if [ $mysqlex > 0 ]; then echo "MySQL server running with pid:" $mysqlex echo '\n'"$(tput setaf 1)[!] MySQL installation allready exist !! Please enter existing password for MySQL !! [!]$(tput sgr0)" echo "" read -rp $'Enter your MySQL existing password : ' sqlpasswd echo "mysql-server mysql-server/root_password password $sqlpasswd" | debconf-set-selections echo "mysql-server mysql-server/root_password_again password $sqlpasswd" | debconf-set-selections else read -rp $'Enter your MySQL password (ENTER for none): ' sqlpasswd echo "" echo "$(tput setaf 3)[+] MySQL Setup in progress ....[+]$(tput sgr0)" echo "mysql-server mysql-server/root_password password $sqlpasswd" | debconf-set-selections echo "mysql-server mysql-server/root_password_again password $sqlpasswd" | debconf-set-selections apt-get install -y --force-yes mysql-server > /dev/null 2>&1 & pid=$! spinner fi mysqladmin -u root -p$sqlpasswd create $sqldatabase > /dev/null 2>&1 mysql -u root -p$sqlpasswd $sqldatabase < /nice/db_login.sql > /dev/null 2>&1 sed -i 's/xxx/'$sqlpasswd'/g' /nice/config.json sed -i 's/yyy/'$ipaddress'/g' /nice/config.json sed -i 's/11111/'$mpegtsport'/g' /nice/config.json sed -i 's/22222/'$hlsport'/g' /nice/config.json sed -i 's/33333/'$webport'/g' /nice/config.json sed -i 's/44444/'$webuser'/g' /nice/config.json sed -i 's/55555/'$webpass'/g' /nice/config.json sed -i 's/66666/'$m3ulist'/g' /nice/config.json echo "" } while true do clear echo "" echo "$(tput setaf 6)[+] ##################################################[+]$(tput sgr0)" echo "$(tput setaf 9)[!] # Welcome to Nice re/streamer Personal Installer # [!]$(tput sgr0)" echo "$(tput setaf 6)[+] ##################################################[+]$(tput sgr0)" sleep 1 echo "" read -rp 1 -p "[ ] Would you like to (I)nstall , (R)emove , (E)xit ? " choise; case $choise in I|i) linuxver installexist network segmenter installpersonal sleep 1 /nice/restream.sh start > /dev/null 2>&1 echo "$(tput setaf 5)[!] Setup Done ..Nice re/streamer Personal running on http://$ipaddress:$webport [!]$(tput sgr0)" echo "" echo "$(tput setaf 2)[!] Start Script Usage /nice/restream.sh start | stop | restart | check | uptime [!]$(tput sgr0)" echo "" echo "$(tput setaf 2)[!] Check out for PRO version on http://nice-panel.com/restreamer.html [!]$(tput sgr0)" sleep 3 exit;; R|r) remove ;; E|e) echo "$(tput setaf 2)[!] Exiting......bye bye [!]$(tput sgr0)" echo "$(tput setaf 2)[!] For future questions and custom builds Please contact us at niceiptvpanel@gmail.com [!]$(tput sgr0)" exit;; *) echo "$(tput setaf 2)[!] Leaving Installer....... [!]$(tput sgr0)" echo "$(tput setaf 2)[!] For future questions and custom builds Please contact us at niceiptvpanel@gmail.com [!]$(tput sgr0)" sleep 1 exit;; esac trap '' SIGINT SIGQUIT SIGTSTP clear done