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
|
2020-05-02 17:08:59 +02:00
|
|
|
echo "Action: $action on $module failed." >> $boswatch_install_path/setup_log.txt
|
|
|
|
|
echo "Exitcode: $errorcode" >> $boswatch_install_path/setup_log.txt
|
2017-02-21 23:23:11 +01:00
|
|
|
echo ""
|
2017-02-20 21:44:19 +01:00
|
|
|
echo "Action: $action on $module failed."
|
|
|
|
|
echo "Exitcode: $errorcode"
|
2017-02-21 23:23:11 +01:00
|
|
|
echo ""
|
2017-10-04 08:54:23 +02:00
|
|
|
echo " -> If you want to open an issue at https://github.com/Schrolli91/BOSWatch/issues"
|
2020-05-02 17:08:59 +02:00
|
|
|
echo " please post the logfile, located at $boswatch_install_path/setup_log.txt"
|
2017-02-20 21:44:19 +01:00
|
|
|
exit 1
|
|
|
|
|
else
|
2020-05-02 17:08:59 +02:00
|
|
|
echo "Action: $action on $module ok." >> $boswatch_install_path/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
|
2020-05-02 16:51:11 +02:00
|
|
|
boswatch_install_path=/opt/boswatch_install
|
2016-11-22 00:28:58 +01:00
|
|
|
reboot=false
|
2017-03-25 00:13:14 +01:00
|
|
|
didBackup=false
|
|
|
|
|
|
2020-05-02 14:12:04 +02:00
|
|
|
# Checking for Backup
|
2017-03-25 00:13:14 +01:00
|
|
|
# check for old version (for the old ones...)
|
|
|
|
|
if [ -f $boswatchpath/BOSWatch/boswatch.py ]; then
|
|
|
|
|
echo "Old installation found!"
|
|
|
|
|
echo "A backup will be copied to $boswatchpath/old"
|
2017-10-02 07:25:22 +02:00
|
|
|
|
2017-03-25 00:13:14 +01:00
|
|
|
mkdir /tmp/boswatch
|
|
|
|
|
mv $boswatchpath/BOSWatch/* /tmp/boswatch/
|
|
|
|
|
didBackup=true
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
#and the future...
|
|
|
|
|
if [ -f $boswatchpath/boswatch.py ]; then
|
|
|
|
|
echo "Old installation found!"
|
|
|
|
|
echo "A backup will be copied to $boswatchpath/old"
|
2017-10-02 07:25:22 +02:00
|
|
|
|
2017-03-25 00:13:14 +01:00
|
|
|
mkdir /tmp/boswatch
|
|
|
|
|
mv $boswatchpath/* /tmp/boswatch/
|
|
|
|
|
didBackup=true
|
|
|
|
|
fi
|
2016-11-20 13:44:53 +01:00
|
|
|
|
2020-05-02 14:12:04 +02:00
|
|
|
# Check for Flags in command line
|
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
|
2017-02-21 16:28:01 +01:00
|
|
|
-r|--reboot) reboot=true ;;
|
2016-11-20 13:44:53 +01:00
|
|
|
|
|
|
|
|
-b|--branch)
|
|
|
|
|
case $arg2 in
|
2017-02-21 21:36:07 +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 ;;
|
|
|
|
|
|
2017-10-04 08:54:23 +02:00
|
|
|
-p|--path) echo " !!! WARNING: you'll install BOSWATCH to alternative path !!! "; boswatchpath=$arg2 ;;
|
2017-02-21 21:36:07 +01:00
|
|
|
|
2016-11-20 13:44:53 +01:00
|
|
|
*) echo "Internal error!" ; exit 1 ;;
|
|
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
|
|
2020-05-02 14:25:44 +02:00
|
|
|
# Create default paths
|
2017-02-21 21:38:30 +01:00
|
|
|
mkdir -p $boswatchpath
|
2020-05-02 16:53:17 +02:00
|
|
|
mkdir -p $boswatch_install_path
|
2016-11-20 13:44:53 +01:00
|
|
|
|
|
|
|
|
echo ""
|
2015-04-04 12:20:40 +02:00
|
|
|
|
2020-05-02 14:25:44 +02:00
|
|
|
# Update of computer
|
2015-04-05 00:54:41 +02:00
|
|
|
tput cup 13 15
|
2020-05-02 16:51:11 +02:00
|
|
|
echo "[ 1/9] [#--------]"
|
2015-04-05 00:54:41 +02:00
|
|
|
tput cup 15 5
|
2016-11-22 12:54:53 +01:00
|
|
|
echo "-> make an apt-get update................"
|
2020-05-02 16:51:11 +02:00
|
|
|
apt-get update -y > $boswatch_install_path/setup_log.txt 2>&1
|
2015-04-04 12:20:40 +02:00
|
|
|
|
2020-05-02 14:25:44 +02:00
|
|
|
# download software
|
2015-04-05 00:54:41 +02:00
|
|
|
tput cup 13 15
|
2020-05-02 16:51:11 +02:00
|
|
|
echo "[ 2/9] [##-------]"
|
2015-04-05 00:54:41 +02:00
|
|
|
tput cup 15 5
|
2016-11-22 12:54:53 +01:00
|
|
|
echo "-> download GIT and other stuff.........."
|
2020-05-02 16:51:11 +02:00
|
|
|
apt-get -y install git cmake build-essential libusb-1.0 qt4-qmake qt4-default libpulse-dev libx11-dev sox python-pip >> $boswatch_install_path/setup_log.txt 2>&1
|
2017-02-20 21:44:19 +01:00
|
|
|
exitcodefunction $? download stuff
|
2015-04-04 12:20:40 +02:00
|
|
|
|
2020-05-02 14:25:44 +02:00
|
|
|
# download BOSWatch via git
|
2015-04-05 00:54:41 +02:00
|
|
|
tput cup 13 15
|
2020-05-02 16:51:11 +02:00
|
|
|
echo "[ 3/9] [###------]"
|
2020-05-02 14:12:04 +02:00
|
|
|
tput cup 15 5
|
|
|
|
|
echo "-> download BOSWatch..................."
|
|
|
|
|
cd $boswatchpath/
|
|
|
|
|
|
|
|
|
|
case $branch in
|
2020-05-02 16:51:11 +02:00
|
|
|
"dev") git clone -b develop https://github.com/Schrolli91/BOSWatch . >> $boswatch_install_path/setup_log.txt 2>&1 && \
|
2020-05-02 14:12:04 +02:00
|
|
|
exitcodefunction $? git-clone BOSWatch-develop ;;
|
2020-05-02 16:51:11 +02:00
|
|
|
*) git clone -b master https://github.com/Schrolli91/BOSWatch . >> $boswatch_install_path/setup_log.txt 2>&1 && \
|
2020-05-02 14:12:04 +02:00
|
|
|
exitcodefunction $? git-clone BOSWatch ;;
|
|
|
|
|
esac
|
|
|
|
|
|
2020-05-02 14:25:44 +02:00
|
|
|
# Download RTL-SDR
|
2020-05-02 14:12:04 +02:00
|
|
|
tput cup 13 15
|
2020-05-02 16:51:11 +02:00
|
|
|
echo "[ 4/9] [####-----]"
|
2015-04-05 00:54:41 +02:00
|
|
|
tput cup 15 5
|
2016-11-20 13:44:53 +01:00
|
|
|
echo "-> download rtl_fm......................"
|
2020-05-02 17:08:59 +02:00
|
|
|
cd $boswatch_install_path
|
2020-05-02 16:51:11 +02:00
|
|
|
git clone https://github.com/Schrolli91/rtl-sdr.git >> $boswatch_install_path/setup_log.txt 2>&1
|
2017-02-20 21:44:19 +01:00
|
|
|
exitcodefunction $? git-clone rtl-sdr
|
2015-04-04 12:20:40 +02:00
|
|
|
cd rtl-sdr/
|
|
|
|
|
|
2020-05-02 14:25:44 +02:00
|
|
|
# Compie RTL-FM
|
2015-04-05 00:54:41 +02:00
|
|
|
tput cup 13 15
|
2020-05-02 16:51:11 +02:00
|
|
|
echo "[ 5/9] [#####----]"
|
2015-04-05 00:54:41 +02:00
|
|
|
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
|
2020-05-02 16:51:11 +02:00
|
|
|
cmake ../ -DINSTALL_UDEV_RULES=ON >> $boswatch_install_path/setup_log.txt 2>&1
|
2017-02-20 21:44:19 +01:00
|
|
|
exitcodefunction $? cmake rtl-sdr
|
|
|
|
|
|
2020-05-02 16:51:11 +02:00
|
|
|
make >> $boswatch_install_path/setup_log.txt 2>&1
|
2017-02-20 21:44:19 +01:00
|
|
|
exitcodefunction $? make rtl-sdr
|
|
|
|
|
|
2020-05-02 16:51:11 +02:00
|
|
|
make install >> $boswatch_install_path/setup_log.txt 2>&1
|
2017-02-20 21:44:19 +01:00
|
|
|
exitcodefunction $? make-install rtl-sdr
|
|
|
|
|
|
2020-05-02 16:51:11 +02:00
|
|
|
ldconfig >> $boswatch_install_path/setup_log.txt 2>&1
|
2017-02-20 21:44:19 +01:00
|
|
|
exitcodefunction $? ldconfig rtl-sdr
|
|
|
|
|
|
|
|
|
|
|
2020-05-02 14:25:44 +02:00
|
|
|
# Download Multimon-NG
|
2015-04-05 00:54:41 +02:00
|
|
|
tput cup 13 15
|
2020-05-02 16:51:11 +02:00
|
|
|
echo "[ 6/9] [######---]"
|
2015-04-05 00:54:41 +02:00
|
|
|
tput cup 15 5
|
2016-11-20 13:44:53 +01:00
|
|
|
echo "-> download multimon-ng................"
|
2020-05-02 17:08:59 +02:00
|
|
|
cd $boswatch_install_path
|
2020-05-02 16:51:11 +02:00
|
|
|
git clone https://github.com/Schrolli91/multimon-ng.git multimonNG >> $boswatch_install_path/setup_log.txt 2>&1
|
2017-02-20 21:44:19 +01:00
|
|
|
exitcodefunction $? git-clone multimonNG
|
|
|
|
|
|
2020-05-02 17:08:59 +02:00
|
|
|
cd $boswatch_install_path/multimonNG/
|
2015-04-04 12:20:40 +02:00
|
|
|
|
2020-05-02 14:25:44 +02:00
|
|
|
# Compile Multimon-NG
|
2015-04-05 00:54:41 +02:00
|
|
|
tput cup 13 15
|
2020-05-02 16:51:11 +02:00
|
|
|
echo "[ 7/9] [#######--]"
|
2015-04-05 00:54:41 +02:00
|
|
|
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
|
2020-05-02 16:51:11 +02:00
|
|
|
qmake ../multimon-ng.pro >> $boswatch_install_path/setup_log.txt 2>&1
|
2017-02-20 21:44:19 +01:00
|
|
|
exitcodefunction $? qmake multimonNG
|
|
|
|
|
|
2020-05-02 17:08:59 +02:00
|
|
|
make >> $boswatch_install_path/setup_log.txt 2>&1
|
2017-02-20 21:44:19 +01:00
|
|
|
exitcodefunction $? make multimonNG
|
|
|
|
|
|
2020-05-02 17:08:59 +02:00
|
|
|
make install >> $boswatch_install_path/setup_log.txt 2>&1
|
2017-02-20 21:44:19 +01:00
|
|
|
exitcodefunction $? qmakeinstall multimonNG
|
|
|
|
|
|
2020-05-02 14:25:44 +02:00
|
|
|
# Download & Install MySQL-Connector for Python via pip
|
2015-04-05 00:54:41 +02:00
|
|
|
tput cup 13 15
|
2020-05-02 16:51:11 +02:00
|
|
|
echo "[ 8/9] [########-]"
|
2015-04-05 00:54:41 +02:00
|
|
|
tput cup 15 5
|
2020-05-02 14:25:44 +02:00
|
|
|
echo "-> Download & Install MySQL connector for Python."
|
2020-05-02 17:08:59 +02:00
|
|
|
cd $boswatch_install_path
|
2020-05-02 16:51:11 +02:00
|
|
|
pip install mysql-connector-python >> $boswatch_install_path/setup_log.txt 2>&1
|
2020-05-02 17:08:59 +02:00
|
|
|
exitcodefunction $? install mysql-connector
|
2017-02-20 21:44:19 +01:00
|
|
|
|
2020-05-02 14:25:44 +02:00
|
|
|
# Blacklist DVB-Drivers
|
2015-04-05 00:54:41 +02:00
|
|
|
tput cup 13 15
|
2020-05-02 16:51:11 +02:00
|
|
|
echo "[9/9] [#########]"
|
2015-04-05 00:54:41 +02:00
|
|
|
tput cup 15 5
|
2016-11-20 13:44:53 +01:00
|
|
|
echo "-> configure..........................."
|
|
|
|
|
cd $boswatchpath/
|
2017-10-04 08:54:23 +02:00
|
|
|
echo $'# BOSWatch - blacklist the DVB drivers to avoid conflicts 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
|
|
|
|
2020-05-02 14:25:44 +02:00
|
|
|
# Installation is ready
|
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
|
2017-10-04 08:54:23 +02:00
|
|
|
echo "Watch out: to run BOSWatch you have to modify the config.ini!"
|
|
|
|
|
echo "Do the following step to do so:"
|
2017-10-09 14:11:26 +02:00
|
|
|
echo "sudo nano $boswatchpath/config/config.ini"
|
2017-02-20 21:44:19 +01:00
|
|
|
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
|
2020-05-02 16:51:11 +02:00
|
|
|
mv $boswatch_install_path/setup_log.txt $boswatchpath/log/install/
|
|
|
|
|
rm $boswatch_install_path/ -R
|
2017-02-20 21:44:19 +01:00
|
|
|
|
2017-03-25 00:13:14 +01:00
|
|
|
#copy the template config to run boswatch
|
|
|
|
|
cp $boswatchpath/config/config.template.ini $boswatchpath/config/config.ini
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#replay the backup
|
|
|
|
|
if [ $didBackup = "true" ]; then
|
|
|
|
|
mkdir $boswatchpath/old/
|
|
|
|
|
mv /tmp/boswatch/* $boswatchpath/old/
|
|
|
|
|
fi
|
|
|
|
|
|
2016-11-21 14:26:55 +01:00
|
|
|
if [ $reboot = "true" ]; then
|
2016-11-20 13:44:53 +01:00
|
|
|
/sbin/reboot
|
|
|
|
|
fi
|