Update menu

This commit is contained in:
Esteban Mackay Q 2023-10-05 01:23:19 -05:00
parent 8dab333d57
commit fc4269fa5c
1 changed files with 92 additions and 88 deletions

180
menu/menu
View File

@ -1,12 +1,87 @@
#!/bin/bash
###menu
if [ "$(cat /proc/cpuinfo | grep 'Raspberry')" != "" ]; then
sudo tee /bin/menu <<- "EOFX1"
if [ ! "$(cat /proc/cpuinfo | grep 'Raspberry')" != "" ]; then
sudo cat > /bin/menu <<- "EOFX2"
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
whiptail --title "sudo su" --msgbox "Se requieren permisos de usuario root, escriba (sudo su) antes de ingresar al menú / Root user permissions required, type (sudo su) before entering the menu" 0 50
whiptail --title "sudo su" --msgbox "Se requieren privilegios de superusuario. Ejecute 'sudo su' antes de ingresar al menú." 0 50
exit 0
fi
while : ; do
choix=$(whiptail --title "Proyecto emq-TE1+ Rev: R00ab / Raspbian Proyecto por HP3ICC 73." --menu "Suba o Baje con las flechas del teclado y seleccione el número de opción:" 24 70 17 \
1 " APRS " \
2 " MMDVMHost " \
3 " Dvswitch " \
4 " pYSFReflector3 " \
5 " NXDN2DMR " \
6 " YSF2DMR " \
7 " YSF2YSF " \
8 " HBLink3 Server " \
9 " FreeDMR Server " \
10 " DDNS NoIP " \
11 " GoTTY " \
12 " Firewall " \
13 " Update " \
14 " Reiniciar Equipo " \
15 " Set Time Zone " \
16 " Salir del menú " 3>&1 1>&2 2>&3)
exitstatus=$?
if [ $exitstatus = 0 ]; then
echo "Your chosen option:" $choix
else
echo "You chose cancel."
break
fi
case $choix in
1)
menu-aprs;;
2)
menu-mmdvm;;
3)
menu-dvs;;
4)
menu-ysf;;
5)
menu-nxdn2dmr;;
6)
menu-ysf2dmr;;
7)
menu-ysf2ysf;;
8)
menu-hbl;;
9)
menu-fdmr;;
10)
menu-noip ;;
11)
menu-web ;;
12)
menu-ufw ;;
13)
bash -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/update.sh)" ;;
14)
menu-reboot ;;
15)
dpkg-reconfigure tzdata ;;
16)
break
;;
esac
done
exit 0
EOFX2
fi
if [ "$(cat /proc/cpuinfo | grep 'Raspberry')" != "" ]; then
sudo cat > /bin/menu <<- "EOFX1"
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
whiptail --title "sudo su" --msgbox "Se requieren privilegios de superusuario. Ejecute 'sudo su' antes de ingresar al menú." 0 50
exit 0
fi
while : ; do
choix=$(whiptail --title "Proyecto emq-TE1+ Rev: R00ab / Proyecto Raspbian por HP3ICC 73." --menu "Use las flechas del teclado para subir o bajar y seleccione el número de opción:" 24 70 17 \
1 " APRS " \
@ -26,16 +101,16 @@ while : ; do
15 " Reiniciar Equipo " \
16 " Set Time Zone " \
17 " Salir del menú " 3>&1 1>&2 2>&3)
exitstatus=$?
# Recuperar la opción seleccionada
# exitstatus=$?
if [ $exitstatus = 0 ]; then
echo "La opción seleccionada:" $choix
else
echo "Usted eligió cancelar."; break;
fi
# Caso: acción en función de la opción seleccionada
case $choix in
exitstatus=$?
if [ $exitstatus = 0 ]; then
echo "Your chosen option:" $choix
else
echo "You chose cancel."
break
fi
case $choix in
1)
menu-aprs;;
2)
@ -69,84 +144,13 @@ while : ; do
16)
dpkg-reconfigure tzdata ;;
17)
break;
esac
break
;;
esac
done
exit 0
EOFX1
else
sudo tee /bin/menu <<EOFX2
#!/bin/bash
if [[ \$EUID -ne 0 ]]; then
whiptail --title "sudo su" --msgbox "requiere ser usuario root, escriba (sudo su) antes de entrar al menú / requires root user, type (sudo su) before entering menu" 0 50
exit 0
fi
while : ; do
choix=\$(whiptail --title "Proyecto emq-TE1+ Rev: R00ab / Raspbian Proyecto por HP3ICC 73." --menu "Suba o Baje con las flechas del teclado y seleccione el número de opción:" 24 70 17 \
1 " APRS " \
2 " MMDVMHost " \
3 " Dvswitch " \
4 " pYSFReflector3 " \
5 " NXDN2DMR " \
6 " YSF2DMR " \
7 " YSF2YSF " \
8 " HBLink3 Server " \
9 " FreeDMR Server " \
10 " DDNS NoIP " \
11 " GoTTY " \
12 " Firewall " \
13 " Update " \
14 " Reiniciar Equipo " \
15 " Set Time Zone " \
16 " Salir del menú " 3>&1 1>&2 2>&3)
exitstatus=\$?
# Recuperamos la opción elegida
# exitstatus=\$?
if [ \$exitstatus = 0 ]; then
echo "Your chosen option:" \$choix
else
echo "You chose cancel."; break;
fi
# Caso: acción en función de la opción elegida
case \$choix in
1)
menu-aprs;;
2)
menu-mmdvm;;
3)
menu-dvs;;
4)
menu-ysf;;
5)
menu-nxdn2dmr;;
6)
menu-ysf2dmr;;
7)
menu-ysf2ysf;;
8)
menu-hbl;;
9)
menu-fdmr;;
10)
menu-noip ;;
11)
menu-web ;;
12)
menu-ufw ;;
13)
bash -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/update.sh)" ;;
14)
menu-reboot ;;
15)
dpkg-reconfigure tzdata ;;
16)
break;
esac
done
exit 0
EOFX2
#
EOFX1
fi
variable22=$(grep "EMQ-VER:" /opt/emq-ver | grep -Eo '[A.0-9]{1,9}')
sudo sed -i "s/R00ab/$variable22/g" /bin/menu