754 lines
19 KiB
Bash
754 lines
19 KiB
Bash
|
#!/bin/bash
|
||
|
VERT="\\033[32m"
|
||
|
NORMAL="\\033[39m"
|
||
|
ROUGE="\\033[31m"
|
||
|
JAUNE="\\033[33m"
|
||
|
|
||
|
####################################################################################
|
||
|
#
|
||
|
# Installation complète d'une configuration Spotnik V3.0 || V3.1
|
||
|
# Pour Raspberry & BUSTER https://downloads.raspberrypi.org/raspbian_lite_latest
|
||
|
#
|
||
|
# chmod +x install_Spotnik3.sh
|
||
|
# sudo ./install_Spotnik3.sh
|
||
|
#
|
||
|
# V 3.23 - 03-02-2020 @TK4LS & @F8ASB & @F5SWB
|
||
|
#
|
||
|
#
|
||
|
####################################################################################
|
||
|
|
||
|
|
||
|
|
||
|
SPOTNIK_VERSION="3.0"
|
||
|
#SPOTNIK_VERSION="3.1"
|
||
|
SVXLINK_CONF_FILE="/etc/spotnik/svxlink.cfg"
|
||
|
pathinstall="/opt/spotnik/spotnik2hmi_V2"
|
||
|
|
||
|
WD=$PWD
|
||
|
# PWD ROOT
|
||
|
sudo sh -c 'echo root:spotnik | chpasswd'
|
||
|
sed -i 's/#\?\(PermitRootLogin\s*\).*$/\1 yes/' /etc/ssh/sshd_config
|
||
|
service sshd reload
|
||
|
|
||
|
if [ $(id -u) != 0 ] ; then
|
||
|
|
||
|
echo "Saisir le password 'spotnik'"
|
||
|
su root
|
||
|
|
||
|
# echo "Les droits de super-utilisateur (root) sont requis pour continuer l'instalation"
|
||
|
# #echo "Veuillez lancer 'sudo $0' ou connectez-vous en tant que root, puis relancez $0"
|
||
|
# echo "Connectez-vous en tant que 'root' avec la commande: 'su root'"
|
||
|
# echo "paswword: 'spotnik'";
|
||
|
# echo "puis relancez $0"
|
||
|
# exit 1
|
||
|
|
||
|
fi
|
||
|
|
||
|
|
||
|
grep --binary-files=text -s -q '^Raspberry' /proc/device-tree/model && HDW='Raspberry' || HDW='Orange Pi'
|
||
|
rev=`awk '/^Revision/ {sub("^1000", "", $3); print $3}' /proc/cpuinfo`
|
||
|
|
||
|
|
||
|
apt_install() {
|
||
|
apt-get -y install "$@"
|
||
|
if [ $? -ne 0 ]; then
|
||
|
echo -e "${ROUGE}Ne peut installer $@ - Annulation${NORMAL}"
|
||
|
exit 1
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
|
||
|
update_upgrade() {
|
||
|
echo "---------------------------------------------------------------------"
|
||
|
echo -e "${JAUNE}Update & Upgrade RaspBian BUSTER${NORMAL}"
|
||
|
apt-get update
|
||
|
apt-get -y upgrade
|
||
|
echo -e "${VERT}Update & Upgrade términé${NORMAL}"
|
||
|
}
|
||
|
|
||
|
install_mainpackage() {
|
||
|
echo "---------------------------------------------------------------------"
|
||
|
|
||
|
# apt_install lighttpd php htop toilet
|
||
|
# apt-get -y remove net-tools
|
||
|
# dpkg-reconfigure locales
|
||
|
|
||
|
echo -e "${VERT}Installation des paquets terminée${NORMAL}"
|
||
|
}
|
||
|
|
||
|
|
||
|
install_nodejs() {
|
||
|
echo "---------------------------------------------------------------------"
|
||
|
echo -e "${JAUNE}Installation de NodeJS${NORMAL}"
|
||
|
|
||
|
|
||
|
# ArmV6
|
||
|
if [[ $(uname -m) =~ ^armv6 ]] ; then
|
||
|
wget https://nodejs.org/dist/v11.9.0/node-v11.9.0-linux-armv6l.tar.xz
|
||
|
tar -xzf node-v11.9.0-linux-armv6l.tar.xz
|
||
|
cd node-v11.9.0-linux-armv6l/
|
||
|
cp -R * /usr/local/
|
||
|
rm -rf node-v11.9.0-linux-armv6l
|
||
|
rm -f node-v11.9.0-linux-armv6l.tar.xz
|
||
|
|
||
|
else
|
||
|
curl -sL https://deb.nodesource.com/setup_13.x | bash -
|
||
|
apt_install nodejs && npm install npm@latest -g
|
||
|
fi
|
||
|
|
||
|
echo -e "${VERT}Installation de NodeJS terminée${NORMAL}"
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
install_svxlink() {
|
||
|
|
||
|
echo -e "${JAUNE}Installation des paquets nécéssaires pour Svxlink${NORMAL}"
|
||
|
|
||
|
apt_install cmake libsigc++-2.0-dev libasound2-dev libpopt-dev libgcrypt20-dev tk-dev libgsm1-dev libspeex-dev libopus-dev groff build-essential git libfftw3-dev libusb-1.0-0-dev opus-tools librtlsdr-dev libcurl4-openssl-dev alsa-tools
|
||
|
|
||
|
# Branch master
|
||
|
#apt_install libjsoncpp-dev
|
||
|
|
||
|
apt_install locales mc gawk fetchmail procmail tcllib sox avahi-daemon
|
||
|
# apt_install lynx
|
||
|
|
||
|
echo "---------------------------------------------------------------------"
|
||
|
echo -e "${JAUNE}Installation de SvxLink${NORMAL}"
|
||
|
|
||
|
if pgrep -x svxlink >/dev/null
|
||
|
then
|
||
|
pkill -TERM svxlink
|
||
|
fi
|
||
|
|
||
|
cd /usr/src
|
||
|
|
||
|
# Récupère le source "svxlink 19.09.01" dans /usr/src
|
||
|
wget https://github.com/sm0svx/svxlink/archive/19.09.1.tar.gz
|
||
|
tar -xzf 19.09.1.tar.gz -C /usr/src/
|
||
|
rm 19.09.1.tar.gz
|
||
|
wget -O - ftp://ftp.f5nlg.ovh/DEV/SERVEUR_17.12/ReflectorClient.cpp > /usr/src/svxlink-19.09.1/src/svxlink/reflector/ReflectorClient.cpp
|
||
|
wget -O - ftp://ftp.f5nlg.ovh/DEV/SERVEUR_17.12/ModuleMetarInfo.cpp > /usr/src/svxlink-19.09.1/src/svxlink/modules/metarinfo/ModuleMetarInfo.cpp
|
||
|
mkdir /usr/src/svxlink-19.09.1/src/build && cd /usr/src/svxlink-19.09.1/src/build
|
||
|
|
||
|
#wget https://github.com/sm0svx/svxlink/archive/17.12.tar.gz
|
||
|
#tar -xzf 17.12.tar.gz -C /usr/src/
|
||
|
#rm 17.12.tar.gz
|
||
|
#wget -O - ftp://ftp.f5nlg.ovh/DEV/SERVEUR_17.12/ReflectorClient.cpp > /usr/src/svxlink-17.12/src/svxlink/reflector/ReflectorClient.cpp
|
||
|
#wget -O - ftp://ftp.f5nlg.ovh/DEV/SERVEUR_17.12/ModuleMetarInfo.cpp > /usr/src/svxlink-17.12/src/svxlink/modules/metarinfo/ModuleMetarInfo.cpp
|
||
|
#mkdir /usr/src/svxlink-17.12/src/build && cd /usr/src/svxlink-17.12/src/build
|
||
|
|
||
|
# Source sur la branch master
|
||
|
#mkdir -p /usr/src/svxlink-master
|
||
|
#git clone https://github.com/sm0svx/svxlink.git /usr/src/svxlink-master
|
||
|
#wget -O - ftp://ftp.f5nlg.ovh/DEV/SERVEUR_17.12/ReflectorClient.cpp > /usr/src/svxlink-master/src/svxlink/reflector/ReflectorClient.cpp
|
||
|
#mkdir /usr/src/svxlink-master/src/build && cd /usr/src/svxlink-master/src/build
|
||
|
|
||
|
|
||
|
|
||
|
useradd -r -g daemon svxlink
|
||
|
#usermod -a -G daemon svxlink
|
||
|
groupadd svxlink
|
||
|
gpasswd -a svxlink svxlink
|
||
|
gpasswd -a svxlink gpio
|
||
|
gpasswd -a svxlink audio
|
||
|
|
||
|
#cmake -DCMAKE_INSTALL_PREFIX=/usr -DSYSCONF_INSTALL_DIR=/etc -DLOCAL_STATE_DIR=/var -DUSE_OSS=NO -DUSE_QT=NO ..
|
||
|
#make
|
||
|
|
||
|
cmake -DCMAKE_INSTALL_PREFIX=/usr -DSYSCONF_INSTALL_DIR=/etc -DLOCAL_STATE_DIR=/var -DUSE_OSS=NO -DUSE_QT=NO -RELEASE_CFLAGS=-g -O2 -mfloat-abi=softfp -mfpu=vfp -mcpu=native ..
|
||
|
make -j4
|
||
|
|
||
|
if [ $? -ne 0 ]; then
|
||
|
echo -e "${ROUGE}Ne peut pas compiler Svxlink - Annulation${NORMAL}"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
#make doc
|
||
|
make install
|
||
|
make clean
|
||
|
|
||
|
rm -rf /usr/src/svxlink-17.12/src/build
|
||
|
|
||
|
ldconfig
|
||
|
|
||
|
rm -f svxlink-sounds-en_US-heather-16k-19.09.99.tar.gz
|
||
|
wget https://github.com/sm0svx/svxlink-sounds-en_US-heather/releases/download/19.09.99/svxlink-sounds-en_US-heather-16k-19.09.99.tar.gz
|
||
|
tar -xzf svxlink-sounds-en_US-heather-16k-19.09.99.tar.gz -C /usr/share/svxlink/sounds
|
||
|
rm -f svxlink-sounds-en_US-heather-16k-19.09.99.tar.gz
|
||
|
mv /usr/share/svxlink/sounds/en_US-heather-16k /usr/share/svxlink/sounds/en_US
|
||
|
|
||
|
|
||
|
pip install requests metar
|
||
|
|
||
|
|
||
|
echo -e "${VERT}Installation de SvxLink terminée${NORMAL}"
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
install_spotnik() {
|
||
|
|
||
|
echo "---------------------------------------------------------------------"
|
||
|
echo -e "${JAUNE}Configuration du Spotnik V$SPOTNIK_VERSION ${NORMAL}"
|
||
|
|
||
|
if pgrep -x spotnik >/dev/null
|
||
|
then
|
||
|
pkill -TERM spotnik
|
||
|
fi
|
||
|
|
||
|
if pgrep -x svxlink >/dev/null
|
||
|
then
|
||
|
pkill -TERM svxlink
|
||
|
if [ "$HDW" == "Raspberry" ]; then
|
||
|
echo "18" > /sys/class/gpio/unexport
|
||
|
echo "17" > /sys/class/gpio/unexport
|
||
|
elif [ "$HDW" == "Orange Pi" ]; then
|
||
|
echo "10" > /sys/class/gpio/unexport
|
||
|
echo "7" > /sys/class/gpio/unexport
|
||
|
fi
|
||
|
sleep 2
|
||
|
fi
|
||
|
|
||
|
cd $WD
|
||
|
|
||
|
wget https://raw.githubusercontent.com/spotnik-ham/usr_bin/master/spot
|
||
|
wget https://raw.githubusercontent.com/spotnik-ham/usr_bin/master/fetchsetup
|
||
|
mv -f spot /usr/bin/spot
|
||
|
mv -f fetchsetup /usr/bin/fetchsetup
|
||
|
|
||
|
chmod 744 /usr/bin/spot /usr/bin/fetchsetup
|
||
|
|
||
|
rm -rf /etc/spotnik
|
||
|
git clone https://github.com/spotnik-ham/etc.git /etc/spotnik
|
||
|
|
||
|
rm -rf /opt/spotnik/gui
|
||
|
git clone https://github.com/spotnik-ham/gui.git /opt/spotnik/gui
|
||
|
|
||
|
|
||
|
rm -rf /usr/share/svxlink/events.d/local
|
||
|
git clone https://github.com/spotnik-ham/usr_share_svxlink.git /usr/share/svxlink/events.d/local
|
||
|
|
||
|
|
||
|
rm -f fr_FR.tar.gz
|
||
|
wget ftp://ftp.f5nlg.ovh/DEV/fr_FR.tar.gz
|
||
|
tar -xzf fr_FR.tar.gz -C /usr/share/svxlink/sounds
|
||
|
rm -f fr_FR.tar.gz
|
||
|
|
||
|
rm -f Spotnik31.tgz
|
||
|
wget ftp://rrf.f5nlg.ovh/DEV/Spotnik_v3.1/Spotnik31.tgz
|
||
|
tar -xzf Spotnik31.tgz
|
||
|
rm -f Spotnik31.tgz
|
||
|
|
||
|
|
||
|
|
||
|
if [ "$SPOTNIK_VERSION" == "3.1" ]; then
|
||
|
|
||
|
### /ETC
|
||
|
rm -f /etc/spotnik/restart.* /etc/spotnik/svxlink.1voie /etc/spotnik/svxlink.2voies /etc/spotnik/svxlink.cfg /etc/spotnik/svxlink.el
|
||
|
cp -R Spotnik31/etc/. /etc
|
||
|
chmod 600 /etc/spotnik/fetchmailrc
|
||
|
chmod 744 /etc/spotnik/restart
|
||
|
|
||
|
### /USR/SHARE/SVXLINK
|
||
|
mkdir -p /usr/share/svxlink/sounds/fr_FR/RRF
|
||
|
mv -f /etc/spotnik/*.wav /usr/share/svxlink/sounds/fr_FR/RRF
|
||
|
mv -f /usr/share/svxlink/sounds/fr_FR/RRF/name.wav /usr/share/svxlink/sounds/fr_FR/PropagationMonitor
|
||
|
|
||
|
|
||
|
mkdir -p /usr/share/svxlink/events.d/local
|
||
|
cp -R Spotnik31/usr_share_svxlink_events.d_local/Logic.tcl /usr/share/svxlink/events.d/local
|
||
|
#cp -R Spotnik31/usr_share_svxlink_events.d_local/* /usr/share/svxlink/events.d/local
|
||
|
|
||
|
### /USR/BIN
|
||
|
cp -R Spotnik31/usr_bin/. /usr/bin
|
||
|
chmod 744 /usr/bin/spot /usr/bin/fetchsetup
|
||
|
|
||
|
### /OPT/SPOTNIK/GUI
|
||
|
cp -R Spotnik31/opt_spotnik_gui/. /opt/spotnik/gui
|
||
|
|
||
|
echo $SPOTNIK_VERSION > /etc/spotnik/version
|
||
|
|
||
|
#rm -f Spotnik31.tgz
|
||
|
|
||
|
fi
|
||
|
|
||
|
|
||
|
# Ramdisk
|
||
|
#cp /etc/fstab /etc/fstab.save
|
||
|
#echo "tmpfs /tmp tmpfs defaults,nosuid 0 0" >> /etc/fstab
|
||
|
#echo "tmpfs /var/spool/svxlink tmpfs defaults,nosuid 0 0" >> /etc/fstab
|
||
|
|
||
|
#swapoff -a
|
||
|
|
||
|
### /ETC
|
||
|
# hostname spotnikV$SPOTNIK_VERSION
|
||
|
echo "spotnikV$SPOTNIK_VERSION" > /etc/hostname
|
||
|
sed -i "s/raspberrypi/spotnikV$SPOTNIK_VERSION/g" /etc/hosts
|
||
|
|
||
|
# Si RPI 3B+
|
||
|
#if [ "$HDW" == "Raspberry" ] && [ "$rev" == "a020d3" ]; then
|
||
|
|
||
|
echo "default" > /etc/spotnik/network
|
||
|
|
||
|
mv /etc/rc.local /etc/rc.local.save
|
||
|
|
||
|
# RPI
|
||
|
if [ "$HDW" == "Raspberry" ]; then
|
||
|
|
||
|
if [ ! -f "/etc/wpa_supplicant/wpa_supplicant.conf" ]; then
|
||
|
mkdir -p /etc/wpa_supplicant
|
||
|
cp Spotnik31/wpa_supplicant.conf /etc/wpa_supplicant
|
||
|
fi
|
||
|
|
||
|
mv Spotnik31/etc/rc.local.rpi /etc/rc.local
|
||
|
|
||
|
sed -i 's/GPIO_SQL_PIN=gpio10/GPIO_SQL_PIN=gpio18/g' $SVXLINK_CONF_FILE > /dev/null 2>&1
|
||
|
sed -i 's/PTT_PIN=gpio7/PTT_PIN=gpio17/g' $SVXLINK_CONF_FILE > /dev/null 2>&1
|
||
|
|
||
|
# Sound card
|
||
|
#echo "blacklist snd_bcm2835" > /etc/modprobe.d/blacklist-snd_bcm2835.conf
|
||
|
echo -e "options snd_usb_audio index=0\noptions snd_bcm2835 index=1\noptions snd slots=snd_usb_audio,snd-bcm2835" > /lib/modprobe.d/snd-card.conf
|
||
|
# Rx1 & Tx1
|
||
|
#sed -i "/^\[Rx1\]/,/^\[/ s/AUDIO_DEV=alsa:plughw:0/AUDIO_DEV=alsa:plughw:1/g" $SVXLINK_CONF_FILE > /dev/null 2>&1
|
||
|
#sed -i "/^\[Tx1\]/,/^\[/ s/AUDIO_DEV=alsa:plughw:0/AUDIO_DEV=alsa:plughw:1/g" $SVXLINK_CONF_FILE > /dev/null 2>&1
|
||
|
|
||
|
|
||
|
# OPI
|
||
|
else
|
||
|
|
||
|
mv Spotnik31/etc/rc.local.opi /etc/rc.local
|
||
|
|
||
|
apt_install network-manager;
|
||
|
|
||
|
fi
|
||
|
|
||
|
rm -f /etc/rc.local.opi /etc/rc.local.rpi
|
||
|
|
||
|
chmod 0755 /etc/rc.local
|
||
|
|
||
|
rm -rf Spotnik31
|
||
|
|
||
|
cd /opt/spotnik/gui
|
||
|
|
||
|
#make stop
|
||
|
make
|
||
|
|
||
|
if [ $? -ne 0 ]; then
|
||
|
echo -e "${ROUGE}Ne peut installer Spotnik GUI - Annulation${NORMAL}"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
ldconfig
|
||
|
|
||
|
# Configure les fichiers SVXLINK_CONF_FILE & /etc/spotnik/config.json
|
||
|
_config
|
||
|
|
||
|
|
||
|
# CRON
|
||
|
echo -e "## Alerte Propagation\n#*/5 * * * * root /usr/bin/fetchmail -f /etc/spotnik/fetchmailrc &> /dev/null" > /etc/cron.d/spotnik-fetchmail
|
||
|
echo -e "## Meteo\n30 9,13,19,22 * * * root /etc/spotnik/meteo.sh" > /etc/cron.d/spotnik-meteo
|
||
|
echo -e "## Exemple QSO départemental sur le salon à 18h les vendredi\n#0 18 * * fri root /etc/spotnik/restart loc" > /etc/cron.d/spotnik-qsolocal
|
||
|
/etc/init.d/cron restart
|
||
|
|
||
|
|
||
|
# Clean
|
||
|
swapoff -a
|
||
|
rm /var/swapfile
|
||
|
apt-get -y remove dphys-swapfile
|
||
|
apt-get -y remove x11-common
|
||
|
apt-get -y autoremove
|
||
|
apt autoclean
|
||
|
apt clean
|
||
|
apt clean cache
|
||
|
|
||
|
# Locales
|
||
|
sed -i "s/# fr_FR.UTF-8/fr_FR.UTF-8/g" /etc/locale.gen
|
||
|
locale-gen && export LANG=fr_FR.UTF-8
|
||
|
echo "Europe/Paris" | sudo tee /etc/timezone
|
||
|
dpkg-reconfigure --frontend noninteractive tzdata
|
||
|
|
||
|
ip=`hostname -I`
|
||
|
|
||
|
echo -e "${VERT}Configuration du Spotnik terminée${NORMAL}"
|
||
|
echo -e "${VERT}Interface web => https://$ip${NORMAL}"
|
||
|
|
||
|
if (whiptail --title "Reboot necessaire" --yesno "Le Spotnik doit redemarrer.\nVoulez vous redemarrer maintenant ?\n\nInterface Web => https://$ip" 10 60) then
|
||
|
reboot
|
||
|
fi
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
_config() {
|
||
|
|
||
|
|
||
|
_qrz=`sed -nE 's:^.*\"callsign\"\: \"(.*)\".*$:\1:p' /etc/spotnik/config.json`
|
||
|
while true
|
||
|
do
|
||
|
|
||
|
qrz=$(whiptail --title "Configuration Spotnik" --inputbox "Saisissez votre indicatif" 16 35 $_qrz 3>&1 1>&2 2>&3)
|
||
|
if [ $? != 0 ]; then
|
||
|
qrz=$_qrz
|
||
|
break;
|
||
|
elif [ $qrz != "" ]; then
|
||
|
sed -i "s/\"callsign\"\: \"$_qrz\"/\"callsign\"\: \"$qrz\"/g" /etc/spotnik/config.json > /dev/null 2>&1
|
||
|
|
||
|
sed -i "/^\[SimplexLogic\]/,/^\[/ s/^CALLSIGN=\(.*\)/CALLSIGN=$qrz/g" $SVXLINK_CONF_FILE > /dev/null 2>&1
|
||
|
sed -i "/^\[LocationInfo\]/,/^\[/ s/^CALLSIGN=EL-\(.*\)/CALLSIGN=EL-$qrz/g" $SVXLINK_CONF_FILE > /dev/null 2>&1
|
||
|
|
||
|
break;
|
||
|
fi
|
||
|
|
||
|
done
|
||
|
|
||
|
|
||
|
_dpt=`sed -nE 's:^.*\"Departement\"\: \"([[:alnum:]]{0,3})\".*$:\1:p' /etc/spotnik/config.json`
|
||
|
while true
|
||
|
do
|
||
|
|
||
|
dpt=$(whiptail --title "Configuration Spotnik" --inputbox "Saisissez votre departement" 16 35 $_dpt 3>&1 1>&2 2>&3)
|
||
|
if [ $? != 0 ]; then
|
||
|
dpt=$_dpt
|
||
|
break;
|
||
|
elif [ $dpt != "" ]; then
|
||
|
sed -i "s/\"Departement\"\: \"$_dpt\"/\"Departement\"\: \"$dpt\"/g" /etc/spotnik/config.json > /dev/null 2>&1
|
||
|
break;
|
||
|
fi
|
||
|
|
||
|
done
|
||
|
|
||
|
|
||
|
|
||
|
_band=`sed -nE 's:^.*\"band_type\"\: \"(V|U|R|T|H|10M|6M|V3)\".*$:\1:p' /etc/spotnik/config.json`
|
||
|
while true
|
||
|
do
|
||
|
|
||
|
band=$(whiptail --title "Configuration materiel" --radiolist "Bande d'emission" 17 50 6 \
|
||
|
"10M" "29 MHZ" OFF \
|
||
|
"6M" "50 MHZ" OFF \
|
||
|
"V" "144 - 146 MHZ " OFF \
|
||
|
"U" "430 - 440 MHZ " ON \
|
||
|
"R" "Relais" OFF \
|
||
|
"H" "HotSpot " OFF \
|
||
|
"T" "Transpondeur" OFF 3>&1 1>&2 2>&3)
|
||
|
|
||
|
if [ $? != 0 ]; then
|
||
|
band=$_band
|
||
|
break;
|
||
|
else
|
||
|
sed -i "s/\"band_type\"\: \"$_band\"/\"band_type\"\: \"$band\"/g" /etc/spotnik/config.json > /dev/null 2>&1
|
||
|
break;
|
||
|
fi
|
||
|
|
||
|
done
|
||
|
|
||
|
|
||
|
_sql=`sed -nE 's:^.*\"sql_det\"\: \"(CTCSS|GPIO)\".*$:\1:p' /etc/spotnik/config.json`
|
||
|
while true
|
||
|
do
|
||
|
sql=$(whiptail --title "Configuration materiel" --radiolist "Detection du squelch" 15 52 4 \
|
||
|
"CTCSS" "Detection du CTCSS par SvxLink" ON \
|
||
|
"GPIO" "Detection du CTCSS par votre RX " OFF 3>&1 1>&2 2>&3)
|
||
|
|
||
|
if [ $? != 0 ]; then
|
||
|
sql=$_sql
|
||
|
break;
|
||
|
elif [ $sql != "" ]; then
|
||
|
sed -i "s/\"sql_det\"\: \"$_sql\"/\"sql_det\"\: \"$sql\"/g" /etc/spotnik/config.json > /dev/null 2>&1
|
||
|
|
||
|
sed -i "/^\[Rx1\]/,/^\[/ s/^SQL_DET=\(GPIO\|CTCSS\)/SQL_DET=$sql/g" $SVXLINK_CONF_FILE > /dev/null 2>&1
|
||
|
|
||
|
|
||
|
#tone=$(whiptail --title "Configuration materiel" --radiolist "Tonalité du CTCSS" 15 52 4 \
|
||
|
# "71.9" "71.9" ON \
|
||
|
# "88" "88" OFF 3>&1 1>&2 2>&3)
|
||
|
|
||
|
break;
|
||
|
fi
|
||
|
|
||
|
done
|
||
|
|
||
|
|
||
|
sed -i "s/^CALLSIGN=([[:alnum:]]\{1,3\}) \(.*\) \(B\|V\|U\|R\|T\|H\|10M\|6M\|V3\)/CALLSIGN=\($dpt\) $qrz $band/g" $SVXLINK_CONF_FILE > /dev/null 2>&1
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
install_SPOTNIK2HMI() {
|
||
|
|
||
|
echo "---------------------------------------------------------------------"
|
||
|
echo -e "${JAUNE}Installation SPOTNIK2HMI${NORMAL}"
|
||
|
|
||
|
echo "INSTALLATION DEPENDANCE PYTHON POUR SPOTNIK2HMI"
|
||
|
|
||
|
# Nextion
|
||
|
apt_install python-serial python3-serial python3-pip
|
||
|
pip3 install pyalsaaudio speedtest-cli
|
||
|
pip3 install requests
|
||
|
|
||
|
|
||
|
echo "INSTALLATION scripts python"
|
||
|
git clone https://github.com/F8ASB/spotnik2hmi_V2.git $pathinstall
|
||
|
|
||
|
chmod +x $pathinstall/spotnik2hmi.py
|
||
|
|
||
|
echo "INSTALLATION UTILITAIRE METAR"
|
||
|
git clone https://github.com/python-metar/python-metar.git $pathinstall/python-metar/
|
||
|
|
||
|
|
||
|
# Nextion RPI
|
||
|
if [ "$HDW" == "Raspberry" ]; then
|
||
|
|
||
|
# Desactive le Bluetooth
|
||
|
option=dtoverlay
|
||
|
value=pi3-disable-bt
|
||
|
sed -i \
|
||
|
-e '/^#\?\(\s*'${option//\//\\/}'\s*=\s*\).*/{s//\1'${value//\//\\/}'/;:a;n;ba;q}' \
|
||
|
-e '$a'${option//\//\\/}'='${value//\//\\/} /boot/config.txt
|
||
|
|
||
|
#PORT Nextion sur RPI
|
||
|
PORT=$(whiptail --title "Choix du Port de communication" --radiolist \
|
||
|
"Sur quoi raccorder vous le Nextion?" 15 60 4 \
|
||
|
"ttyAMA0" "Sur Raspberry Pi " ON \
|
||
|
"ttyUSB0" "Orange Pi ou Raspberry Pi " OFF 3>&1 1>&2 2>&3)
|
||
|
|
||
|
|
||
|
# Nextion OPI
|
||
|
elif [ "$HDW" == "Orange Pi" ]; then
|
||
|
apt_install libpython3-dev libasound2-dev
|
||
|
|
||
|
#PORT Nextion sur OPI
|
||
|
PORT=$(whiptail --title "Choix du Port de communication" --radiolist \
|
||
|
"Sur quoi raccorder vous le Nextion?" 15 60 4 \
|
||
|
"ttyS0" "Sur Orange Pi " ON \
|
||
|
"ttyUSB0" "Orange Pi ou Raspberry Pi " OFF 3>&1 1>&2 2>&3)
|
||
|
fi
|
||
|
|
||
|
|
||
|
|
||
|
# Desactiver Port série
|
||
|
sed -i "s/console=serial0,115200//g" /boot/cmdline.txt > /dev/null 2>&1
|
||
|
option=enable_uart
|
||
|
value=1
|
||
|
sed -i \
|
||
|
-e '/^#\?\(\s*'${option//\//\\/}'\s*=\s*\).*/{s//\1'${value//\//\\/}'/;:a;n;ba;q}' \
|
||
|
-e '$a'${option//\//\\/}'='${value//\//\\/} /boot/config.txt
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
grep -q "^python3 $pathinstall/spotnik2hmi.py $PORT 9600" /etc/rc.local
|
||
|
|
||
|
if [ $? -ne 0 ]; then
|
||
|
sed -i '/make start/a \sleep 10\npython3 '$pathinstall'/spotnik2hmi.py '$PORT' 9600' /etc/rc.local
|
||
|
fi
|
||
|
|
||
|
echo ""
|
||
|
echo " ENJOY ;) TEAM:F0DEI,F5SWB,F8ASB"
|
||
|
echo ""
|
||
|
|
||
|
|
||
|
|
||
|
echo -e "${VERT}Installation SPOTNIK2HMI terminée${NORMAL}"
|
||
|
|
||
|
if (whiptail --title "Reboot necessaire" --yesno "Voulez vous redemarrer maintenant ?" 10 60) then
|
||
|
reboot
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
|
||
|
install_NEXTION() {
|
||
|
|
||
|
echo "---------------------------------------------------------------------"
|
||
|
echo -e "${JAUNE}Installation NEXTION${NORMAL}"
|
||
|
|
||
|
#PORT='ttyUSB0'
|
||
|
if [ "$HDW" == "Raspberry" ]; then
|
||
|
|
||
|
PORT=$(whiptail --title "Choix du Port de communication" --radiolist \
|
||
|
"Sur quoi raccorder vous le Nextion?" 15 60 4 \
|
||
|
"ttyAMA0" "Sur Raspberry Pi " ON \
|
||
|
"ttyUSB0" "Orange Pi ou Raspberry Pi " OFF 3>&1 1>&2 2>&3)
|
||
|
|
||
|
elif [ "$HDW" == "Orange Pi" ]; then
|
||
|
|
||
|
PORT=$(whiptail --title "Choix du Port de communication" --radiolist \
|
||
|
"Sur quoi raccorder vous le Nextion?" 15 60 4 \
|
||
|
"ttyS0" "Sur Orange Pi " ON \
|
||
|
"ttyUSB0" "Orange Pi ou Raspberry Pi " OFF 3>&1 1>&2 2>&3)
|
||
|
|
||
|
fi
|
||
|
|
||
|
|
||
|
ECRAN=$(whiptail --title "Choix type d'ecran NEXTION" --radiolist \
|
||
|
"Quel Type d'ecran ?" 15 60 4 \
|
||
|
"NX4832K035.tft" "Ecran 3,5 Enhanced" OFF \
|
||
|
"NX4832T035.tft" "Ecran 3,5 Basic" ON 3>&1 1>&2 2>&3)
|
||
|
|
||
|
exitstatus=$?
|
||
|
if [ $exitstatus = 0 ]; then
|
||
|
echo "Type d'écran :" $ECRAN
|
||
|
python $pathinstall'/nextion/nextion.py' $pathinstall'/nextion/'$ECRAN '/dev/'$PORT
|
||
|
|
||
|
echo ""
|
||
|
echo " ENJOY ;) TEAM:F0DEI,F5SWB,F8ASB"
|
||
|
echo ""
|
||
|
|
||
|
else
|
||
|
echo "Vous avez annule"
|
||
|
fi
|
||
|
|
||
|
echo -e "${VERT}Installation NEXTION terminée${NORMAL}"
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
install_hamnet() {
|
||
|
|
||
|
echo "---------------------------------------------------------------------"
|
||
|
echo -e "${JAUNE}Installation HamNet${NORMAL}"
|
||
|
|
||
|
|
||
|
# https://f5nlg.wordpress.com/2018/03/09/routeur-hamnet-sur-orangepi-0/
|
||
|
|
||
|
# HAMNET
|
||
|
apt_install pptp-linux
|
||
|
|
||
|
IP_ROUTEUR=""
|
||
|
IP_GATEWAY=""
|
||
|
USER=""
|
||
|
PWD=""
|
||
|
SERVEUR_PPTP=""
|
||
|
|
||
|
cd /etc/ppp/peers
|
||
|
|
||
|
wget ftp://rrf.f5nlg.ovh/HAMNET/hamnet
|
||
|
|
||
|
cd /etc/ppp/ip-up.d
|
||
|
|
||
|
wget ftp://rrf.f5nlg.ovh/HAMNET/ip-up.d/hamnet
|
||
|
chmod +x hamnet
|
||
|
|
||
|
#pon hamnet
|
||
|
|
||
|
#cd $WD
|
||
|
|
||
|
#wget ftp://rrf.f5nlg.ovh/HAMNET/Hamnet.sh
|
||
|
|
||
|
#chmod +x Hamnet.sh
|
||
|
|
||
|
|
||
|
#/etc/dhcp/dhcpd.conf
|
||
|
|
||
|
echo -e "${VERT}Installation HamNet terminée${NORMAL}"
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
install_Dwservice() {
|
||
|
|
||
|
cd $WD
|
||
|
|
||
|
wget https://www.dwservice.net/download/dwagent_generic.sh
|
||
|
|
||
|
chmod +x dwagent_generic.sh
|
||
|
|
||
|
./dwagent_generic.sh -silent logpath=/var/log/dwservice.log
|
||
|
|
||
|
rm dwagent_generic.sh
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
install_all() {
|
||
|
update_upgrade
|
||
|
#install_mainpackage
|
||
|
install_nodejs
|
||
|
install_svxlink
|
||
|
install_spotnik
|
||
|
install_hamnet
|
||
|
install_SPOTNIK2HMI
|
||
|
#install_NEXTION
|
||
|
install_Dwservice
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
while : ; do
|
||
|
|
||
|
choix=$(whiptail --title "Installation Spotnik V$SPOTNIK_VERSION sur $HDW" --menu " Votre choix: " 20 60 12 \
|
||
|
1 " Installation complète" \
|
||
|
2 " Installation NodeJS" \
|
||
|
3 " Installation SvxLink" \
|
||
|
4 " Configuration du Spotnik" \
|
||
|
5 " SPOTNIK2HMI Gestion Nextion avec Spotnik " \
|
||
|
6 " NEXTION Programmation ecran Nextion " \
|
||
|
7 " Installation DwService" \
|
||
|
8 " Reboot" 3>&1 1>&2 2>&3)
|
||
|
|
||
|
exitstatus=$?
|
||
|
|
||
|
if [ $exitstatus = 0 ]; then
|
||
|
echo "Your chosen option:" $choix
|
||
|
else
|
||
|
break;
|
||
|
fi
|
||
|
|
||
|
cd $WD
|
||
|
|
||
|
case $choix in
|
||
|
|
||
|
|
||
|
1)
|
||
|
update_upgrade
|
||
|
install_all;;
|
||
|
|
||
|
2)
|
||
|
install_nodejs ;;
|
||
|
|
||
|
|
||
|
3)
|
||
|
update_upgrade
|
||
|
install_svxlink
|
||
|
if (whiptail --title "Reboot necessaire" --yesno "Voulez vous redemarrer maintenant ?" 10 60) then
|
||
|
reboot
|
||
|
fi
|
||
|
;;
|
||
|
|
||
|
4)
|
||
|
install_spotnik ;;
|
||
|
|
||
|
5)
|
||
|
update_upgrade
|
||
|
install_SPOTNIK2HMI ;;
|
||
|
|
||
|
6)
|
||
|
install_NEXTION ;;
|
||
|
|
||
|
7)
|
||
|
install_Dwservice ;;
|
||
|
|
||
|
8)
|
||
|
reboot
|
||
|
|
||
|
esac
|
||
|
|
||
|
done
|
||
|
exit 0
|
||
|
|