Update menu-ap

This commit is contained in:
Esteban Mackay Q. 2024-05-29 10:10:45 -05:00
parent 04f0fb0d74
commit 174ceddfb9
1 changed files with 26 additions and 26 deletions

View File

@ -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