2016-11-20 13:44:53 +01:00
|
|
|
#!/bin/bash
|
2017-02-20 21:44:19 +01:00
|
|
|
|
|
|
|
|
function exitcodefunction {
|
|
|
|
|
errorcode=$1
|
|
|
|
|
action=$2
|
|
|
|
|
module=$3
|
|
|
|
|
|
|
|
|
|
if [ $errorcode -ne "0" ]; then
|
2017-02-21 16:45:45 +01:00
|
|
|
echo "Action: $action on $module failed." >> $boswatchpath/install/setup_log.txt
|
|
|
|
|
echo "Exitcode: $errorcode" >> $boswatchpath/install/setup_log.txt
|
2017-02-20 21:44:19 +01:00
|
|
|
echo "Action: $action on $module failed."
|
|
|
|
|
echo "Exitcode: $errorcode"
|
|
|
|
|
exit 1
|
|
|
|
|
else
|
2017-02-21 16:45:45 +01:00
|
|
|
echo "Action: $action on $module ok." >> $boswatchpath/install/setup_log.txt
|
2017-02-20 21:44:19 +01:00
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2015-04-05 01:05:14 +02:00
|
|
|
tput clear
|
|
|
|
|
tput civis
|
2015-07-02 09:02:49 +02:00
|
|
|
echo " ____ ____ ______ __ __ __ "
|
|
|
|
|
echo " / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ "
|
|
|
|
|
echo " / __ / / / /\__ \| | /| / / __ / __/ ___/ __ \ "
|
|
|
|
|
echo " / /_/ / /_/ /___/ /| |/ |/ / /_/ / /_/ /__/ / / / "
|
|
|
|
|
echo " /_____/\____//____/ |__/|__/\__,_/\__/\___/_/ /_/ "
|
|
|
|
|
echo " German BOS Information Script "
|
|
|
|
|
echo " by Bastian Schroll "
|
2015-04-04 12:20:40 +02:00
|
|
|
echo ""
|
2017-02-20 21:44:19 +01:00
|
|
|
|
|
|
|
|
# Make sure only root can run our script
|
|
|
|
|
if [[ $EUID -ne 0 ]]; then
|
|
|
|
|
echo "This script must be run as root!" 1>&2
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo "This may take several minutes... Don't panic!"
|
2015-04-04 12:20:40 +02:00
|
|
|
echo ""
|
2016-11-22 12:54:53 +01:00
|
|
|
echo "Caution, script does not install a webserver with PHP and MySQL"
|
2016-11-20 13:44:53 +01:00
|
|
|
echo "So you have to make up manually if you want to use MySQL support"
|
2015-04-04 12:20:40 +02:00
|
|
|
|
2016-11-20 13:44:53 +01:00
|
|
|
boswatchpath=/opt/boswatch
|
|
|
|
|
mkdir -p $boswatchpath
|
2016-11-22 00:28:58 +01:00
|
|
|
reboot=false
|
2016-11-20 13:44:53 +01:00
|
|
|
|
|
|
|
|
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
|
2017-02-20 21:17:55 +01:00
|
|
|
dev|develop) echo " !!! WARNING: you are using the DEV BRANCH !!! "; branch=dev ;;
|
2016-11-20 13:44:53 +01:00
|
|
|
*) branch=master ;;
|
|
|
|
|
esac ;;
|
|
|
|
|
|
|
|
|
|
*) echo "Internal error!" ; exit 1 ;;
|
|
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
mkdir -p $boswatchpath/install
|
|
|
|
|
|
|
|
|
|
echo ""
|
2015-04-04 12:20:40 +02:00
|
|
|
|
2015-04-05 00:54:41 +02:00
|
|
|
tput cup 13 15
|
|
|
|
|
echo "[ 1/10] [#---------]"
|
|
|
|
|
tput cup 15 5
|
2016-11-22 12:54:53 +01:00
|
|
|
echo "-> make an apt-get update................"
|
2016-11-20 13:44:53 +01:00
|
|
|
apt-get update -y > $boswatchpath/install/setup_log.txt 2>&1
|
2015-04-04 12:20:40 +02:00
|
|
|
|
2015-04-05 00:54:41 +02:00
|
|
|
tput cup 13 15
|
|
|
|
|
echo "[ 2/10] [##--------]"
|
|
|
|
|
tput cup 15 5
|
2016-11-22 12:54:53 +01:00
|
|
|
echo "-> download GIT and other stuff.........."
|
2016-11-21 14:26:55 +01:00
|
|
|
apt-get -y install git cmake build-essential libusb-1.0 qt4-qmake qt4-default libpulse-dev libx11-dev sox >> $boswatchpath/install/setup_log.txt 2>&1
|
2017-02-20 21:44:19 +01:00
|
|
|
exitcodefunction $? download stuff
|
2015-04-04 12:20:40 +02:00
|
|
|
|
2015-04-05 00:54:41 +02:00
|
|
|
tput cup 13 15
|
|
|
|
|
echo "[ 3/10] [###-------]"
|
|
|
|
|
tput cup 15 5
|
2016-11-20 13:44:53 +01:00
|
|
|
echo "-> download rtl_fm......................"
|
|
|
|
|
cd $boswatchpath/install
|
2017-02-20 21:44:19 +01:00
|
|
|
git clone https://github.com/Schrolli91/rtl-sdr.git >> $boswatchpath/install/setup_log.txt 2>&1
|
|
|
|
|
exitcodefunction $? git-clone rtl-sdr
|
2015-04-04 12:20:40 +02:00
|
|
|
cd rtl-sdr/
|
|
|
|
|
|
2015-04-05 00:54:41 +02:00
|
|
|
tput cup 13 15
|
|
|
|
|
echo "[ 4/10] [####------]"
|
|
|
|
|
tput cup 15 5
|
2016-11-20 13:44:53 +01:00
|
|
|
echo "-> compile rtl_fm......................"
|
2015-04-04 12:20:40 +02:00
|
|
|
mkdir -p build && cd build
|
2016-11-20 13:44:53 +01:00
|
|
|
cmake ../ -DINSTALL_UDEV_RULES=ON >> $boswatchpath/install/setup_log.txt 2>&1
|
2017-02-20 21:44:19 +01:00
|
|
|
exitcodefunction $? cmake rtl-sdr
|
|
|
|
|
|
2016-11-20 13:44:53 +01:00
|
|
|
make >> $boswatchpath/install/setup_log.txt 2>&1
|
2017-02-20 21:44:19 +01:00
|
|
|
exitcodefunction $? make rtl-sdr
|
|
|
|
|
|
2016-11-20 13:44:53 +01:00
|
|
|
make install >> $boswatchpath/install/setup_log.txt 2>&1
|
2017-02-20 21:44:19 +01:00
|
|
|
exitcodefunction $? make-install rtl-sdr
|
|
|
|
|
|
2016-11-20 13:44:53 +01:00
|
|
|
ldconfig >> $boswatchpath/install/setup_log.txt 2>&1
|
2017-02-20 21:44:19 +01:00
|
|
|
exitcodefunction $? ldconfig rtl-sdr
|
|
|
|
|
|
|
|
|
|
|
2015-04-04 12:20:40 +02:00
|
|
|
|
2015-04-05 00:54:41 +02:00
|
|
|
tput cup 13 15
|
|
|
|
|
echo "[ 5/10] [#####-----]"
|
|
|
|
|
tput cup 15 5
|
2016-11-20 13:44:53 +01:00
|
|
|
echo "-> download multimon-ng................"
|
|
|
|
|
cd $boswatchpath/install
|
2017-02-20 21:44:19 +01:00
|
|
|
git clone https://github.com/Schrolli91/multimon-ng.git multimonNG >> $boswatchpath/install/setup_log.txt 2>&1
|
|
|
|
|
exitcodefunction $? git-clone multimonNG
|
|
|
|
|
|
|
|
|
|
|
2016-11-20 13:44:53 +01:00
|
|
|
cd $boswatchpath/install/multimonNG/
|
2015-04-04 12:20:40 +02:00
|
|
|
|
2015-04-05 00:54:41 +02:00
|
|
|
tput cup 13 15
|
|
|
|
|
echo "[ 6/10] [######----]"
|
|
|
|
|
tput cup 15 5
|
2016-11-20 13:44:53 +01:00
|
|
|
echo "-> compile multimon-ng................."
|
2015-04-04 12:20:40 +02:00
|
|
|
mkdir -p build
|
|
|
|
|
cd build
|
2016-11-20 13:44:53 +01:00
|
|
|
qmake ../multimon-ng.pro >> $boswatchpath/install/setup_log.txt 2>&1
|
2017-02-20 21:44:19 +01:00
|
|
|
exitcodefunction $? qmake multimonNG
|
|
|
|
|
|
2016-11-20 13:44:53 +01:00
|
|
|
make >> $boswatchpath/install/setup_log.txt 2>&1
|
2017-02-20 21:44:19 +01:00
|
|
|
exitcodefunction $? make multimonNG
|
|
|
|
|
|
|
|
|
|
|
2016-11-20 13:44:53 +01:00
|
|
|
make install >> $boswatchpath/install/setup_log.txt 2>&1
|
2017-02-20 21:44:19 +01:00
|
|
|
exitcodefunction $? qmakeinstall multimonNG
|
|
|
|
|
|
2015-04-04 12:20:40 +02:00
|
|
|
|
2015-04-05 00:54:41 +02:00
|
|
|
tput cup 13 15
|
|
|
|
|
echo "[ 7/10] [#######---]"
|
|
|
|
|
tput cup 15 5
|
2016-11-22 12:54:53 +01:00
|
|
|
echo "-> download MySQL connector for Python."
|
2016-11-20 13:44:53 +01:00
|
|
|
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
|
2017-02-20 21:44:19 +01:00
|
|
|
exitcodefunction $? download mysql-connector
|
|
|
|
|
|
2016-11-20 13:44:53 +01:00
|
|
|
tar xfv mysql-connector.tar >> $boswatchpath/install/setup_log.txt 2>&1
|
2017-02-20 21:44:19 +01:00
|
|
|
exitcodefunction $? untar mysql-connector
|
|
|
|
|
|
2016-11-20 13:44:53 +01:00
|
|
|
cd $boswatchpath/install/mysql-connector-python*
|
2015-04-04 12:20:40 +02:00
|
|
|
|
2015-04-05 00:54:41 +02:00
|
|
|
tput cup 13 15
|
|
|
|
|
echo "[ 8/10] [########--]"
|
|
|
|
|
tput cup 15 5
|
2016-11-22 12:54:53 +01:00
|
|
|
echo "-> install MySQL connector for Python.."
|
2015-04-04 12:20:40 +02:00
|
|
|
chmod +x ./setup.py
|
2016-11-20 13:44:53 +01:00
|
|
|
./setup.py install >> $boswatchpath/install/setup_log.txt 2>&1
|
2017-02-20 21:44:19 +01:00
|
|
|
exitcodefunction $? setup mysql-connector
|
|
|
|
|
|
2015-04-04 12:20:40 +02:00
|
|
|
|
2015-04-05 00:54:41 +02:00
|
|
|
tput cup 13 15
|
|
|
|
|
echo "[ 9/10] [#########-]"
|
|
|
|
|
tput cup 15 5
|
2016-11-20 13:44:53 +01:00
|
|
|
echo "-> download BOSWatch..................."
|
|
|
|
|
cd $boswatchpath/
|
|
|
|
|
|
|
|
|
|
case $branch in
|
2017-02-20 21:17:55 +01:00
|
|
|
"dev") git clone -b develop https://github.com/Schrolli91/BOSWatch >> $boswatchpath/install/setup_log.txt 2>&1 && \
|
|
|
|
|
# "dev") git clone -b develop https://github.com/thejockel/BOSWatch >> $boswatchpath/install/setup_log.txt 2>&1 && \
|
|
|
|
|
exitcodefunction $? git-clone BOSWatch-develop ;;
|
|
|
|
|
*) git clone -b master https://github.com/Schrolli91/BOSWatch >> $boswatchpath/install/setup_log.txt 2>&1 && \
|
|
|
|
|
exitcodefunction $? git-clone BOSWatch ;;
|
2016-11-20 13:44:53 +01:00
|
|
|
esac
|
2015-04-04 12:20:40 +02:00
|
|
|
|
2015-04-05 00:54:41 +02:00
|
|
|
tput cup 13 15
|
|
|
|
|
echo "[10/10] [##########]"
|
|
|
|
|
tput cup 15 5
|
2016-11-20 13:44:53 +01:00
|
|
|
echo "-> configure..........................."
|
|
|
|
|
cd $boswatchpath/
|
2015-04-04 12:20:40 +02:00
|
|
|
chmod +x *
|
2016-11-21 14:26:55 +01:00
|
|
|
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
|
2015-04-04 12:20:40 +02:00
|
|
|
|
2015-04-05 00:54:41 +02:00
|
|
|
tput cup 17 1
|
2016-11-22 12:54:53 +01:00
|
|
|
echo "BOSWatch is now installed in $boswatchpath/"
|
|
|
|
|
echo "Installation ready!"
|
2017-02-20 21:44:19 +01:00
|
|
|
tput cup 19 3
|
|
|
|
|
echo "Watch out: to run BOSWatch you have to generate and modify the config.ini!"
|
|
|
|
|
echo "Do the following steps to have a running version of BOSWatch:"
|
|
|
|
|
echo "sudo cp $boswatchpath/BOSWatch/config/config.template.ini $boswatchpath/BOSWatch/config/config.ini"
|
|
|
|
|
echo "sudo nano $boswatchpath/BOSWatch/config/config.ini"
|
|
|
|
|
echo "and modify the config as you need. This step is optional if you are upgrading an old version of BOSWatch. "
|
2016-11-22 12:54:53 +01:00
|
|
|
|
|
|
|
|
tput cnorm
|
2016-11-20 13:44:53 +01:00
|
|
|
|
2017-02-20 21:44:19 +01:00
|
|
|
# cleanup
|
|
|
|
|
mkdir $boswatchpath/log/install -p
|
|
|
|
|
mv $boswatchpath/install/setup_log.txt $boswatchpath/log/install/
|
|
|
|
|
rm $boswatchpath/install/ -R
|
|
|
|
|
|
|
|
|
|
mv $boswatchpath/BOSWatch/* $boswatchpath/
|
|
|
|
|
rm $boswatchpath/BOSWatch -R
|
|
|
|
|
|
2016-11-21 14:26:55 +01:00
|
|
|
if [ $reboot = "true" ]; then
|
2016-11-20 13:44:53 +01:00
|
|
|
/sbin/reboot
|
|
|
|
|
fi
|