This commit is contained in:
timniklas 2024-09-21 01:57:13 +02:00 committed by GitHub
commit fe8f05c5cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 20 additions and 153 deletions

View file

@ -51,22 +51,22 @@ didBackup=false
# Checking for Backup
# 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"
echo "Old installation found!"
echo "A backup will be copied to $boswatchpath/old"
mkdir /tmp/boswatch
mv $boswatchpath/BOSWatch/* /tmp/boswatch/
didBackup=true
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"
echo "Old installation found!"
echo "A backup will be copied to $boswatchpath/old"
mkdir /tmp/boswatch
mv $boswatchpath/* /tmp/boswatch/
didBackup=true
mkdir /tmp/boswatch
mv $boswatchpath/* /tmp/boswatch/
didBackup=true
fi
# Check for Flags in command line
@ -98,101 +98,30 @@ echo ""
# Update of computer
tput cup 13 15
echo "[ 1/9] [#--------]"
echo "[ 1/4] [#--------]"
tput cup 15 5
echo "-> make an apt-get update................"
apt-get update -y > $boswatch_install_path/setup_log.txt 2>&1
# download software
tput cup 13 15
echo "[ 2/9] [##-------]"
echo "[ 2/4] [##-------]"
tput cup 15 5
echo "-> download GIT and other stuff.........."
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
apt-get -y install git cmake build-essential libusb-1.0 qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libpulse-dev libx11-dev sox python2 rtl-sdr multimon-ng>> $boswatch_install_path/setup_log.txt 2>&1
exitcodefunction $? download stuff
# download BOSWatch via git
tput cup 13 15
echo "[ 3/9] [###------]"
echo "[ 3/4] [###------]"
tput cup 15 5
echo "-> download BOSWatch..................."
cd $boswatchpath/
case $branch in
"dev") git clone -b develop https://github.com/Schrolli91/BOSWatch . >> $boswatch_install_path/setup_log.txt 2>&1 && \
exitcodefunction $? git-clone BOSWatch-develop ;;
*) git clone -b master https://github.com/Schrolli91/BOSWatch . >> $boswatch_install_path/setup_log.txt 2>&1 && \
exitcodefunction $? git-clone BOSWatch ;;
esac
# Download RTL-SDR
tput cup 13 15
echo "[ 4/9] [####-----]"
tput cup 15 5
echo "-> download rtl_fm......................"
cd $boswatch_install_path
git clone https://github.com/Schrolli91/rtl-sdr.git >> $boswatch_install_path/setup_log.txt 2>&1
exitcodefunction $? git-clone rtl-sdr
cd rtl-sdr/
# Compie RTL-FM
tput cup 13 15
echo "[ 5/9] [#####----]"
tput cup 15 5
echo "-> compile rtl_fm......................"
mkdir -p build && cd build
cmake ../ -DINSTALL_UDEV_RULES=ON >> $boswatch_install_path/setup_log.txt 2>&1
exitcodefunction $? cmake rtl-sdr
make >> $boswatch_install_path/setup_log.txt 2>&1
exitcodefunction $? make rtl-sdr
make install >> $boswatch_install_path/setup_log.txt 2>&1
exitcodefunction $? make-install rtl-sdr
ldconfig >> $boswatch_install_path/setup_log.txt 2>&1
exitcodefunction $? ldconfig rtl-sdr
# Download Multimon-NG
tput cup 13 15
echo "[ 6/9] [######---]"
tput cup 15 5
echo "-> download multimon-ng................"
cd $boswatch_install_path
git clone https://github.com/Schrolli91/multimon-ng.git multimonNG >> $boswatch_install_path/setup_log.txt 2>&1
exitcodefunction $? git-clone multimonNG
cd $boswatch_install_path/multimonNG/
# Compile Multimon-NG
tput cup 13 15
echo "[ 7/9] [#######--]"
tput cup 15 5
echo "-> compile multimon-ng................."
mkdir -p build
cd build
qmake ../multimon-ng.pro >> $boswatch_install_path/setup_log.txt 2>&1
exitcodefunction $? qmake multimonNG
make >> $boswatch_install_path/setup_log.txt 2>&1
exitcodefunction $? make multimonNG
make install >> $boswatch_install_path/setup_log.txt 2>&1
exitcodefunction $? qmakeinstall multimonNG
# Download & Install MySQL-Connector for Python via pip
tput cup 13 15
echo "[ 8/9] [########-]"
tput cup 15 5
echo "-> Download & Install MySQL connector for Python."
cd $boswatch_install_path
pip install mysql-connector-python >> $boswatch_install_path/setup_log.txt 2>&1
exitcodefunction $? install mysql-connector
git clone https://github.com/timniklas/BOSWatch $boswatchpath
# Blacklist DVB-Drivers
tput cup 13 15
echo "[9/9] [#########]"
echo "[4/4] [#########]"
tput cup 15 5
echo "-> configure..........................."
cd $boswatchpath/
@ -221,8 +150,8 @@ 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/
mkdir $boswatchpath/old/
mv /tmp/boswatch/* $boswatchpath/old/
fi
if [ $reboot = "true" ]; then

View file

@ -1,10 +1,10 @@
[Unit]
Description=BOSWatch
After=multi-user.target
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/python /opt/boswatch/boswatch.py -f 123.45M -a POC512
ExecStart=/usr/bin/python2 /opt/boswatch/boswatch.py -f 123.45M -a POC1200
Restart=on-abort
[Install]

View file

@ -1,62 +0,0 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: BOSWatch
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Python Service to receive and decode German BOS Information with rtl_fm and multimon-NG
# Description: Python Service to receive and decode German BOS Information with rtl_fm and multimon-NG
### END INIT INFO
# Change the next 3 lines to suit where you install your script and what you want to call it
DIR=/opt/boswatch
DAEMON=$DIR/boswatch.py
DAEMON_NAME=boswatch
# Add any command line options for your daemon here
DAEMON_OPTS="-f xxx -a yyy -s zz -u -q"
# This next line determines what user the script runs as.
# Root generally not recommended but necessary if you are using the Raspberry Pi GPIO from Python.
DAEMON_USER=root
# The process ID of the script when it runs is stored here:
PIDFILE=/var/run/$DAEMON_NAME.pid
. /lib/lsb/init-functions
do_start () {
log_daemon_msg "Starting system $DAEMON_NAME daemon"
start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile --user $DAEMON_USER --chuid $DAEMON_USER --startas $DAEMON -- $DAEMON_OPTS
log_end_msg $?
}
do_stop () {
log_daemon_msg "Stopping system $DAEMON_NAME daemon"
start-stop-daemon --stop --pidfile $PIDFILE --retry 10
log_end_msg $?
}
case "$1" in
start|stop)
do_${1}
;;
restart|reload|force-reload)
do_stop
do_start
;;
status)
status_of_proc "$DAEMON_NAME" "$DAEMON" && exit 0 || exit $?
;;
*)
echo "Usage: /etc/init.d/$DAEMON_NAME {start|stop|restart|status}"
exit 1
;;
esac
exit 0