mirror of https://gitlab.com/hp3icc/emq-TE1.git
Update menu-ap
This commit is contained in:
parent
04f0fb0d74
commit
174ceddfb9
50
menu/menu-ap
50
menu/menu-ap
|
|
@ -1,29 +1,27 @@
|
|||
#!/bin/bash
|
||||
if [ "$(cat /proc/cpuinfo | grep 'Raspberry')" != "" ]; then
|
||||
# menu-ap
|
||||
sudo cat > /bin/menu-ap <<- "EOF"
|
||||
#!/bin/bash
|
||||
|
||||
# Check if the script is running on a Raspberry Pi
|
||||
if [ "$(grep 'Raspberry' /proc/cpuinfo)" != "" ]; then
|
||||
# Create the menu-ap script
|
||||
sudo cat > /bin/menu-ap <<- "EOF"
|
||||
#!/bin/bash
|
||||
|
||||
while : ; do
|
||||
choix=$(whiptail --title "WiFi auto AP option" --menu "Select enable or disable auto AP mode." 20 75 11 \
|
||||
while :
|
||||
do
|
||||
choix=$(whiptail --title "IP Tools" --menu "Selecciona una opción:" 15 60 6 \
|
||||
1 "Disable auto AP mode" \
|
||||
2 "Enable auto AP mode" \
|
||||
3 "Menu Principal" 3>&1 1>&2 2>&3)
|
||||
3 "Salir" 3>&1 1>&2 2>&3)
|
||||
|
||||
exitstatus=$?
|
||||
|
||||
# Check if the user selected an option
|
||||
if [ $exitstatus = 0 ]; then
|
||||
echo "Your chosen option:" $choix
|
||||
echo "Opción seleccionada:" $choix
|
||||
else
|
||||
echo "You chose cancel."
|
||||
echo "Has elegido cancelar. Saliendo..."
|
||||
break
|
||||
fi
|
||||
|
||||
# Perform actions based on user choice
|
||||
case $choix in
|
||||
1)
|
||||
1)
|
||||
# Disable auto AP mode
|
||||
servicios=("autoap.service")
|
||||
for servicio in "${servicios[@]}"; do
|
||||
|
|
@ -33,8 +31,8 @@ while : ; do
|
|||
sudo systemctl stop "$servicio"
|
||||
fi
|
||||
done
|
||||
;;
|
||||
2)
|
||||
;;
|
||||
2)
|
||||
# Enable auto AP mode
|
||||
servicios=("autoap.service")
|
||||
for servicio in "${servicios[@]}"; do
|
||||
|
|
@ -47,19 +45,21 @@ while : ; do
|
|||
sudo systemctl enable "$servicio"
|
||||
fi
|
||||
done
|
||||
;;
|
||||
3)
|
||||
# Exit the menu
|
||||
break
|
||||
;;
|
||||
;;
|
||||
3)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
exit 0
|
||||
else
|
||||
whiptail --title "IP Tools" --msgbox "Esta opcion solo esta disponible para Raspberry / This option is only available for Raspberry" 0 50
|
||||
exit 0
|
||||
|
||||
EOF
|
||||
|
||||
# Make the script executable
|
||||
chmod +x /bin/menu-ap
|
||||
ln -sf /bin/menu-ap /bin/MENU-AP
|
||||
chmod +x /bin/MENU-AP
|
||||
chmod +x /bin/menu-ap
|
||||
ln -sf /bin/menu-ap /bin/MENU-AP
|
||||
chmod +x /bin/MENU*
|
||||
fi
|
||||
Loading…
Reference in New Issue