From bbf3886c7be353b9dfc15102f5fc2de7f803e936 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 29 Sep 2018 11:23:01 +0200 Subject: [PATCH] First release --- NextionDriver_ConvertConfig | 7 +++++-- README.md | 9 ++------- install.sh | 30 +++++++++++++++++------------- 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/NextionDriver_ConvertConfig b/NextionDriver_ConvertConfig index 4ac4657..3b4382d 100755 --- a/NextionDriver_ConvertConfig +++ b/NextionDriver_ConvertConfig @@ -5,7 +5,7 @@ # # # (c)2018 by ON7LDS # # # -# V1.01 # +# V1.02 # # # # This program changes the MMDVMHost configuration # # file to suit the needs of NextionDriver # @@ -45,7 +45,10 @@ fi if [[ -f "$MMDVMConfig.old" ]]; then echo "There already is a backup file $MMDVMConfig.old" - echo " If you are sure to run the installer again, then Please remove it." + echo "This could be because NextionDriver already was installed earlier." + echo "If this is the case, there probably is no need to run this convertor." + echo "If, however, you are sure to run this convertor again," + echo " then please rename or remove $MMDVMConfig.old." exit 3 fi diff --git a/README.md b/README.md index 4cb5bce..a2f3c0f 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This is the first release. I have tested it on some hotspots but there are always much more situations and combinations than the ones I tested :-) -This repository also includes the cofiguration convertor program +This repository also includes the configuration convertor program for automatically converting the MMDVM.ini file to incorporate NextionDriver. You could just run it (NextionDriver_ConvertConfig) if you installed @@ -38,12 +38,7 @@ get the installer git clone https://github.com/on7lds/NextionDriverInstaller.git ``` -go to the installation program directory -``` -cd NextionDriverInstaller -``` - go ! ``` -sudo ./install.sh +sudo NextionDriverInstaller/install.sh ``` diff --git a/install.sh b/install.sh index 4bef2d9..aad7f68 100755 --- a/install.sh +++ b/install.sh @@ -11,6 +11,12 @@ if [ "$(which gcc)" = "" ]; then echo "- I need gcc. Please install it." exit; fi if [ "$(which git)" = "" ]; then echo "- I need git. Please install it." exit; fi +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" #" +if [ "$EUID" -ne 0 ] + then echo "- Please run as root (did you forget to prepend 'sudo' ?)" + exit +fi + echo "+ Getting NextionDriver ..." cd /tmp @@ -29,8 +35,9 @@ PISTAR=$(if [ -f /etc/pistar-release ];then echo "OK"; fi) MMDVM=$(which MMDVMHost) BINDIR=$(echo "$MMDVM" | sed "s/MMDVMHost//") CONFIGFILE="MMDVM.ini" -CONFIGDIR="/etc" -MMDVMSTART="service mmdvmhost restart" +CONFIGDIR="/etc/" +MMDVMSTOP="service mmdvmhost stop" +MMDVMSTART="service mmdvmhost start" ######################################################### @@ -64,8 +71,8 @@ checkversion () { } helpfiles () { echo "+ Copying groups and users files" - cp /tmp/NextionDriverInstaller/groups.txt $CONFIGDIR - cp /tmp/NextionDriverInstaller/stripped.csv $CONFIGDIR + cp $DIR/groups.txt $CONFIGDIR + cp $DIR/stripped.csv $CONFIGDIR } herstart () { echo -e "\n+ To test if it all works as expected," @@ -84,17 +91,13 @@ herstart () { } -if [ "$EUID" -ne 0 ] - then echo "- Please run as root" - exit -fi - if [ "$PISTAR" = "OK" ]; then sudo mount -o remount,rw / ; sudo mount -o remount,rw /boot CONFIGFILE="mmdvmhost" CONFIGDIR="/etc/" - MMDVMSTART="service mmdvmhost restart" + MMDVMSTOP="service mmdvmhost stop" + MMDVMSTART="service mmdvmhost start" else echo "" echo "- This is not a Pi-Star." @@ -122,8 +125,9 @@ fi if [ "$ND" = "" ]; then echo "+ No NextionDriver found, trying to install one." compileer - service mmdvmhost stop + $MMDVMSTOP killall -q -I MMDVMHost + cp $DIR"/mmdvmhost.service.pistar" /usr/local/sbin/mmdvmhost.service cp NextionDriver $BINDIR echo "+ Check version :" NextionDriver -V @@ -132,7 +136,7 @@ if [ "$ND" = "" ]; then echo -e "+ NextionDriver installed\n" echo -e "+ -----------------------------------------------" echo -e "+ We will now start the configuration program ...\n" - ./NextionDriver_ConvertConfig $CONFIGDIR$CONFIGFILE + $DIR/NextionDriver_ConvertConfig $CONFIGDIR$CONFIGFILE herstart exit fi @@ -147,7 +151,7 @@ echo "+ We are version $THISVERSION" if [ $TV -gt $V ]; then echo "+ Start Update" compileer - service mmdvmhost stop + $MMDVMSTOP killall -q -I MMDVMHost cp NextionDriver $BINDIR echo -e "\n+ Check version"