From dd9f2e80720db41b677da2980af960f2b2f377f5 Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Plogmann Date: Tue, 4 Oct 2016 01:19:40 +0200 Subject: [PATCH] update insatll script --- install_dev.sh | 77 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 55 insertions(+), 22 deletions(-) diff --git a/install_dev.sh b/install_dev.sh index 9924127..724f6a9 100644 --- a/install_dev.sh +++ b/install_dev.sh @@ -15,26 +15,51 @@ echo "" echo "Caution, script don't install a Webserver with PHP and MySQL" echo "So you have to make up manually if you want to use MySQL support" -mkdir -p ~/boswatch/install +boswatchpath=/opt/boswatch + +for (( i=1; i<=$#; i=$i+2 )); do + t=$((i + 1)) + eval arg=\$$i + eval arg2=\$$t + + case $arg in + -r|--reboot) + case $arg2 in + y|yes) reboot=true ;; + n|no) reboot=false ;; + *) echo "Please use y/yes or n/no for reboot" ; exit 1 ;; + esac ;; + + -b|--branch) + case $arg2 in + dev) branch=dev ;; + *) branch=master ;; + esac ;; + + *) echo "Internal error!" ; exit 1 ;; + esac +done + +mkdir -p $boswatchpath/install tput cup 13 15 echo "[ 1/10] [#---------]" tput cup 15 5 echo "-> make a apt-get update................" -apt-get update -y > ~/boswatch/install/setup_log.txt 2>&1 +apt-get update -y > $boswatchpath/install/setup_log.txt 2>&1 tput cup 13 15 echo "[ 2/10] [##--------]" tput cup 15 5 echo "-> download GIT an other stuff.........." -apt-get -y install git cmake build-essential libusb-1.0 qt4-qmake qt4-default qt5-default libpulse-dev libx11-dev sox >> ~/boswatch/install/setup_log.txt 2>&1 +apt-get -y install git cmake build-essential libusb-1.0 qt4-qmake qt4-default qt5-default libpulse-dev libx11-dev sox >> $boswatchpath/install/setup_log.txt 2>&1 tput cup 13 15 echo "[ 3/10] [###-------]" tput cup 15 5 echo "-> download rtl_fm......................" -cd ~/boswatch/install -git clone git://git.osmocom.org/rtl-sdr.git >> ~/boswatch/install/setup_log.txt 2>&1 +cd $boswatchpath/install +git clone git://git.osmocom.org/rtl-sdr.git >> $boswatchpath/install/setup_log.txt 2>&1 cd rtl-sdr/ tput cup 13 15 @@ -42,17 +67,17 @@ echo "[ 4/10] [####------]" tput cup 15 5 echo "-> compile rtl_fm......................" mkdir -p build && cd build -cmake ../ -DINSTALL_UDEV_RULES=ON >> ~/boswatch/install/setup_log.txt 2>&1 -make >> ~/boswatch/install/setup_log.txt 2>&1 -make install >> ~/boswatch/install/setup_log.txt 2>&1 -ldconfig >> ~/boswatch/install/setup_log.txt 2>&1 +cmake ../ -DINSTALL_UDEV_RULES=ON >> $boswatchpath/install/setup_log.txt 2>&1 +make >> $boswatchpath/install/setup_log.txt 2>&1 +make install >> $boswatchpath/install/setup_log.txt 2>&1 +ldconfig >> $boswatchpath/install/setup_log.txt 2>&1 tput cup 13 15 echo "[ 5/10] [#####-----]" tput cup 15 5 echo "-> download multimon-ng................" -cd ~/boswatch/install -git clone https://github.com/EliasOenal/multimonNG.git >> ~/boswatch/install/setup_log.txt 2>&1 +cd $boswatchpath/install +git clone https://github.com/EliasOenal/multimonNG.git >> $boswatchpath/install/setup_log.txt 2>&1 cd multimonNG/ tput cup 13 15 @@ -61,17 +86,17 @@ tput cup 15 5 echo "-> compile multimon-ng................." mkdir -p build cd build -qmake ../multimon-ng.pro >> ~/boswatch/install/setup_log.txt 2>&1 -make >> ~/boswatch/install/setup_log.txt 2>&1 -make install >> ~/boswatch/install/setup_log.txt 2>&1 +qmake ../multimon-ng.pro >> $boswatchpath/install/setup_log.txt 2>&1 +make >> $boswatchpath/install/setup_log.txt 2>&1 +make install >> $boswatchpath/install/setup_log.txt 2>&1 tput cup 13 15 echo "[ 7/10] [#######---]" tput cup 15 5 echo "-> download MySQL Connector for Python." -cd ~/boswatch/install -wget "http://dev.mysql.com/get/Downloads/Connector-Python/mysql-connector-python-1.0.9.tar.gz/from/http://cdn.mysql.com/" -O mysql-connector.tar >> ~/boswatch/install/setup_log.txt 2>&1 -tar xfv mysql-connector.tar >> ~/boswatch/install/setup_log.txt 2>&1 +cd $boswatchpath/install +wget "http://dev.mysql.com/get/Downloads/Connector-Python/mysql-connector-python-1.0.9.tar.gz/from/http://cdn.mysql.com/" -O mysql-connector.tar >> $boswatchpath/install/setup_log.txt 2>&1 +tar xfv mysql-connector.tar >> $boswatchpath/install/setup_log.txt 2>&1 cd mysql-connector-python* tput cup 13 15 @@ -79,23 +104,31 @@ echo "[ 8/10] [########--]" tput cup 15 5 echo "-> install MySQL Connector for Python.." chmod +x ./setup.py -./setup.py install >> ~/boswatch/install/setup_log.txt 2>&1 +./setup.py install >> $boswatchpath/install/setup_log.txt 2>&1 tput cup 13 15 echo "[ 9/10] [#########-]" tput cup 15 5 echo "-> download BOSWatch..................." -cd ~/boswatch -git clone -b develop https://github.com/Schrolli91/BOSWatch >> ~/boswatch/install/setup_log.txt 2>&1 +cd $boswatchpath/ + +case $branch in + dev) git clone -b develop https://github.com/Schrolli91/BOSWatch >> $boswatchpath/install/setup_log.txt 2>&1 ;; + *) git clone -b master https://github.com/Schrolli91/BOSWatch >> $boswatchpath/install/setup_log.txt 2>&1 ;; +esac tput cup 13 15 echo "[10/10] [##########]" tput cup 15 5 echo "-> configure..........................." -cd ~/boswatch +cd $boswatchpath/ chmod +x * echo "# BOSWatch - blacklist the DVB drivers to avoid conflict with the SDR driver\n blacklist dvb_usb_rtl28xxu \n blacklist rtl2830\n blacklist dvb_usb_v2\n blacklist dvb_core" >> /etc/modprobe.d/boswatch_blacklist_sdr.conf tput cup 17 1 -echo "BOSWatch are now installed in ~/boswatch/" +echo "BOSWatch are now installed in $boswatchpath/" echo "Install ready!" + +if [ $reboot == "true" ]; then + /sbin/reboot +fi