emq-TE1/install.sh

107 lines
4.5 KiB
Bash

#!/bin/sh
echo Actualizando sistema
apt-get update -y
sudo apt-get install sed sudo git wavemon -y
####################
sudo cat > /opt/emq-ver <<- "EOF"
EMQ-VER: 22
EOF
####################
sudo timedatectl set-timezone America/Panama
######################################################################################################################
# Cronedit
######################################################################################################################
cat > /usr/local/bin/cronedit.sh <<- "EOF"
cronjob_editor () {
# usage: cronjob_editor '<interval>' '<command>' <add|remove>
if [[ -z "$1" ]] ;then printf " no interval specified\n" ;fi
if [[ -z "$2" ]] ;then printf " no command specified\n" ;fi
if [[ -z "$3" ]] ;then printf " no action specified\n" ;fi
if [[ "$3" == add ]] ;then
# add cronjob, no duplication:
( sudo crontab -l | grep -v -F -w "$2" ; echo "$1 $2" ) | sudo crontab -
elif [[ "$3" == remove ]] ;then
# remove cronjob:
( sudo crontab -l | grep -v -F -w "$2" ) | sudo crontab -
fi
}
cronjob_editor "$1" "$2" "$3"
EOF
sudo chmod +x /usr/local/bin/cronedit.sh
####################
echo iniciando instalacion
sh -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/install/direwolf.sh)"
sh -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/install/pymultimonng.sh)"
sh -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/install/ysfreflector.sh)"
sh -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/install/mmdvm.sh)"
sh -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/install/dvswitch.sh)"
sh -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/install/ysfgateway2.sh)"
sh -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/install/fdmr.sh)"
sh -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/install/gotty.sh)"
sh -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/install/daprs.sh)"
sh -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/install/noip.sh)"
sh -c "$(curl -fsSL https://gitlab.com/hp3icc/shell-aprs/-/raw/main/shell.sh)"
sh -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/install/rebooters.sh)"
sh -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/install/ysf2dmr.sh)"
sh -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/install/dmrgw.sh)"
###########################
echo install menu
sh -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/menu/menu)"
sh -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/menu/menu-aprs)"
sh -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/menu/menu-bcon)"
sh -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/menu/menu-dvs)"
sh -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/menu/menu-dw)"
sh -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/menu/menu-fdmr)"
sh -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/menu/menu-mm-rtl)"
sh -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/menu/menu-mmdvm)"
sh -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/menu/menu-noip)"
sh -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/menu/menu-reboot)"
sh -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/menu/menu-web)"
sh -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/menu/menu-wifi)"
sh -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/menu/menu-ysf)"
sh -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/menu/menu-ysf2dmr)"
############################
(crontab -l; echo "* */1 * * * sync ; echo 3 > /proc/sys/vm/drop_caches >/dev/null 2>&1")|awk '!x[$0]++'|crontab -
sudo systemctl enable gotty.service
sudo systemctl stop webproxy.service
sudo systemctl disable webproxy.service
#############################################################################################################################
cat > /tmp/completado.sh <<- "EOF"
#!/bin/bash
while : ; do
choix=$(whiptail --title "Raspbian Proyect HP3ICC Esteban Mackay 73." --menu " Precione enter (return o intro) para finalizar la instalacion y reiniciar" 11 85 3 \
1 " Iniciar Reinicio de equipo " 3>&1 1>&2 2>&3)
exitstatus=$?
#on recupere ce choix
#exitstatus=$?
if [ $exitstatus = 0 ]; then
echo "Your chosen option:" $choix
else
echo "You chose cancel."; break;
fi
# case : action en fonction du choix
case $choix in
1)
sudo reboot
;;
esac
done
exit 0
EOF
###
sudo chmod +x /tmp/completado.sh
sh /tmp/completado.sh