mirror of
https://github.com/n5amd/NextionDriverInstaller.git
synced 2026-01-20 15:00:17 +01:00
Added detection of 'normal' debian (ot Pi-Star)
This commit is contained in:
parent
bbf3886c7b
commit
55c777ce7e
|
|
@ -5,7 +5,7 @@
|
|||
# #
|
||||
# (c)2018 by ON7LDS #
|
||||
# #
|
||||
# V1.02 #
|
||||
# V1.03 #
|
||||
# #
|
||||
# This program changes the MMDVMHost configuration #
|
||||
# file to suit the needs of NextionDriver #
|
||||
|
|
@ -24,14 +24,14 @@ if [ "$1" == "" ]; then
|
|||
fi
|
||||
|
||||
MMDVMConfig=$1
|
||||
VERSION="1.01"
|
||||
echo ""
|
||||
#echo "Starting NextionDriver_ConvertConfig $VERSION"
|
||||
VERSION="1.03"
|
||||
echo ""
|
||||
echo "-----------------------------------------------------------"
|
||||
echo "NOTE: I tried to make this script as foolproof as possible."
|
||||
echo " There might still be situations where it does not work"
|
||||
echo " as expected."
|
||||
echo " If you should discover any bugs, please let me know."
|
||||
echo "-----------------------------------------------------------"
|
||||
echo ""
|
||||
echo "Starting NextionDriver_ConvertConfig $VERSION"
|
||||
echo ""
|
||||
|
|
@ -49,6 +49,9 @@ if [[ -f "$MMDVMConfig.old" ]]; then
|
|||
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."
|
||||
echo ""
|
||||
echo "Mind you, running the convertor twice might result in a"
|
||||
echo " broken configuration"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
|
|
|
|||
64
install.sh
64
install.sh
|
|
@ -5,41 +5,44 @@
|
|||
# #
|
||||
# (c)2018 by ON7LDS #
|
||||
# #
|
||||
# V1.00 #
|
||||
# V1.01 #
|
||||
# #
|
||||
#########################################################
|
||||
|
||||
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
|
||||
PATH=/opt/MMDVMHost:$PATH
|
||||
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
|
||||
rm -rf /tmp/NextionDriver
|
||||
git clone https://github.com/on7lds/NextionDriver.git;
|
||||
cd /tmp/NextionDriver
|
||||
cd /tmp/NextionDriver 2>/dev/null
|
||||
if [ "$(pwd)" != "/tmp/NextionDriver" ]; then echo "- Getting NextionDriver failed. Cannot continue."; exit; fi
|
||||
|
||||
|
||||
#########################################################
|
||||
#######################################################################################
|
||||
|
||||
THISVERSION=$(cat NextionDriver.h | grep VERSION | sed "s/.*VERSION //" | sed 's/"//g')
|
||||
TV=$(echo $THISVERSION | sed 's/\.//')
|
||||
ND=$(which NextionDriver)
|
||||
PISTAR=$(if [ -f /etc/pistar-release ];then echo "OK"; fi)
|
||||
MMDVM=$(which MMDVMHost)
|
||||
BINDIR=$(echo "$MMDVM" | sed "s/MMDVMHost//")
|
||||
BINDIR=$(echo "$MMDVM" | sed "s/\/MMDVMHost//")
|
||||
CONFIGFILE="MMDVM.ini"
|
||||
CONFIGDIR="/etc/"
|
||||
SYSTEMCTL="systemctl daemon-reload"
|
||||
MMDVMSTOP="service mmdvmhost stop"
|
||||
MMDVMSTART="service mmdvmhost start"
|
||||
NDSTOP="service nextion-helper stop"
|
||||
|
||||
#######################################################################################
|
||||
|
||||
#########################################################
|
||||
|
||||
compileer () {
|
||||
echo "+ Compiling ..."
|
||||
|
|
@ -87,20 +90,36 @@ herstart () {
|
|||
if [ "$x" = "N" ]; then x="n"; fi
|
||||
done
|
||||
echo -e "\n\n+ OK, not rebooting. Trying to start mmdvmhost.\n\n"
|
||||
$SYSTEMCTL
|
||||
$MMDVMSTART
|
||||
}
|
||||
|
||||
|
||||
CHECK=""
|
||||
|
||||
if [ "$PISTAR" = "OK" ]; then
|
||||
sudo mount -o remount,rw / ; sudo mount -o remount,rw /boot
|
||||
CONFIGFILE="mmdvmhost"
|
||||
CONFIGDIR="/etc/"
|
||||
MMDVMSTOP="service mmdvmhost stop"
|
||||
MMDVMSTART="service mmdvmhost start"
|
||||
else
|
||||
echo ""
|
||||
echo "- This is not a Pi-Star."
|
||||
CHECK="PISTAR"
|
||||
fi
|
||||
if [ "$CHECK" = "" ]; then
|
||||
|
||||
echo "Bindir [$BINDIR]"
|
||||
if [ "$BINDIR" = "/opt/MMDVMHost" ]; then
|
||||
echo ""
|
||||
echo "+ Found MMDVMHost in /opt."
|
||||
echo "+ I'm going to suppose you followed "
|
||||
echo "+ https://g0wfv.wordpress.com/how-to-auto-start-mmdvmhost-as-a-service-on-boot-in-raspbian-jessie/"
|
||||
echo ""
|
||||
echo ""
|
||||
CONFIGFILE="MMDVMHost.ini"
|
||||
CONFIGDIR="/opt/MMDVMHost"
|
||||
CHECK="JESSIE"
|
||||
fi
|
||||
fi
|
||||
if [ "$CHECK" = "" ]; then
|
||||
echo "- I could not find out which system this is."
|
||||
echo "- At this moment, I cannot yet automaticly install NextionDriver"
|
||||
echo ""
|
||||
echo "- Sorry."
|
||||
|
|
@ -125,9 +144,25 @@ fi
|
|||
if [ "$ND" = "" ]; then
|
||||
echo "+ No NextionDriver found, trying to install one."
|
||||
compileer
|
||||
$SYSTEMCTL
|
||||
$NDSTOP
|
||||
$MMDVMSTOP
|
||||
killall -q -I MMDVMHost
|
||||
cp $DIR"/mmdvmhost.service.pistar" /usr/local/sbin/mmdvmhost.service
|
||||
killall -9 -q -I MMDVMHost
|
||||
if [ "$CHECK" = "PISTAR" ]; then
|
||||
cp $DIR"/mmdvmhost.service.pistar" /usr/local/sbin/mmdvmhost.service
|
||||
fi
|
||||
if [ "$CHECK" = "JESSIE" ]; then
|
||||
cp $DIR"/mmdvmhost.service.jessie" /lib/systemd/system/mmdvmhost.service
|
||||
cp $DIR"/mmdvmhost.timer.jessie" /lib/systemd/system/mmdvmhost.timer
|
||||
cp $DIR"/nextion-helper.service.jessie" /lib/systemd/system/nextion-helper.service
|
||||
if [ -e /etc/systemd/system/nextion-helper.service ]; then
|
||||
echo "+ there is already a link /etc/systemd/system/nextion-helper.service"
|
||||
echo "+ I'll leave it like that."
|
||||
else
|
||||
ln -s /lib/systemd/system/nextion-helper.service /etc/systemd/system/nextion-helper.service
|
||||
fi
|
||||
fi
|
||||
cp NextionDriver $BINDIR
|
||||
echo "+ Check version :"
|
||||
NextionDriver -V
|
||||
|
|
@ -151,8 +186,13 @@ echo "+ We are version $THISVERSION"
|
|||
if [ $TV -gt $V ]; then
|
||||
echo "+ Start Update"
|
||||
compileer
|
||||
$SYSTEMCTL
|
||||
$NDSTOP
|
||||
$MMDVMSTOP
|
||||
killall -q -I MMDVMHost
|
||||
killall -q -I NextionDriver
|
||||
killall -9 -q -I MMDVMHost
|
||||
killall -9 -q -I NextionDriver
|
||||
cp NextionDriver $BINDIR
|
||||
echo -e "\n+ Check version"
|
||||
NextionDriver -V
|
||||
|
|
|
|||
14
mmdvmhost.service.jessie
Normal file
14
mmdvmhost.service.jessie
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
[Unit]
|
||||
Description=MMDVM Host Service
|
||||
After=syslog.target network.target
|
||||
BindsTo=nextion-helper.service
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
WorkingDirectory=/opt/MMDVMHost
|
||||
ExecStartPre=/bin/sleep 3
|
||||
ExecStart=/usr/bin/screen -S MMDVMHost -D -m /opt/MMDVMHost/MMDVMHost /opt/MMDVM.ini
|
||||
ExecStop=/usr/bin/screen -S MMDVMHost -X quit
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
6
mmdvmhost.timer.jessie
Normal file
6
mmdvmhost.timer.jessie
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[Timer]
|
||||
OnStartupSec=60
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
15
nextion-helper.service.jessie
Normal file
15
nextion-helper.service.jessie
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
[Unit]
|
||||
Description=Nextion Helper Service Service
|
||||
After=syslog.target network.target
|
||||
Before= mmdvmhost.service
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
WorkingDirectory=/opt/MMDVMHost
|
||||
Type=forking
|
||||
ExecStart=/opt/MMDVMHost/NextionDriver -c /opt/MMDVM.ini -vvvv
|
||||
ExecStop=/usr/bin/killall NextionDriver
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
Loading…
Reference in a new issue