From d5a39ff00339421596611b0456eb822425499b86 Mon Sep 17 00:00:00 2001 From: timniklas Date: Sat, 21 Sep 2024 01:42:59 +0200 Subject: [PATCH 1/5] added python2.7 legacy support --- install.sh | 107 +++++++++-------------------------------------------- 1 file changed, 18 insertions(+), 89 deletions(-) diff --git a/install.sh b/install.sh index 0335aee..9dfd139 100755 --- a/install.sh +++ b/install.sh @@ -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/Schrolli91/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 From 8270e45bead6813dfa43eb5aef1df6564290b9a6 Mon Sep 17 00:00:00 2001 From: timniklas Date: Sat, 21 Sep 2024 01:43:44 +0200 Subject: [PATCH 2/5] changed git url --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 9dfd139..28498b6 100755 --- a/install.sh +++ b/install.sh @@ -117,7 +117,7 @@ echo "[ 3/4] [###------]" tput cup 15 5 echo "-> download BOSWatch..................." -git clone https://github.com/Schrolli91/BOSWatch $boswatchpath +git clone https://github.com/timniklas/BOSWatch $boswatchpath # Blacklist DVB-Drivers tput cup 13 15 From bba6961281b4b494da4cb2fc5b6d3a66fe852c7b Mon Sep 17 00:00:00 2001 From: timniklas Date: Sat, 21 Sep 2024 01:44:35 +0200 Subject: [PATCH 3/5] removed deprecated init.d file --- service/boswatch.sh | 62 --------------------------------------------- 1 file changed, 62 deletions(-) delete mode 100755 service/boswatch.sh diff --git a/service/boswatch.sh b/service/boswatch.sh deleted file mode 100755 index 70263b4..0000000 --- a/service/boswatch.sh +++ /dev/null @@ -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 From 7e0b4de07c6d46ad416d1599d6b272d17359ceb7 Mon Sep 17 00:00:00 2001 From: timniklas Date: Sat, 21 Sep 2024 01:46:01 +0200 Subject: [PATCH 4/5] Added legacy python support --- service/boswatch.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/boswatch.service b/service/boswatch.service index 80c440b..f68452c 100644 --- a/service/boswatch.service +++ b/service/boswatch.service @@ -4,7 +4,7 @@ After=multi-user.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] From 8f079f46cdd3d0b14f29f7204618699556586825 Mon Sep 17 00:00:00 2001 From: timniklas Date: Sat, 21 Sep 2024 01:53:34 +0200 Subject: [PATCH 5/5] fixed startup logic --- service/boswatch.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/boswatch.service b/service/boswatch.service index f68452c..40df0ba 100644 --- a/service/boswatch.service +++ b/service/boswatch.service @@ -1,6 +1,6 @@ [Unit] Description=BOSWatch -After=multi-user.target +After=network.target [Service] Type=simple