Update menu-ap

This commit is contained in:
Esteban Mackay Q. 2024-05-29 10:19:58 -05:00
parent 16e43d6bf3
commit 26f09ed616
1 changed files with 57 additions and 57 deletions

View File

@ -1,66 +1,66 @@
#!/bin/bash #!/bin/bash
if [ "$(cat /proc/cpuinfo | grep 'Raspberry')" != "" ]; then if [ "$(cat /proc/cpuinfo | grep 'Raspberry')" != "" ]; then
# menu-ap # menu-ap
sudo cat > /bin/menu-ap <<- "EOF" sudo cat > /bin/menu-ap <<- "EOF"
if [ "$(cat /proc/cpuinfo | grep 'Raspberry')" != "" ]; then #!/bin/bash
#!/bin/bash
while : if [ "$(cat /proc/cpuinfo | grep 'Raspberry')" != "" ]; then
do while :
choix=$(whiptail --title "IP Tools" --menu "Selecciona una opción:" 15 60 6 \ do
1 "Disable auto AP mode" \ choix=$(whiptail --title "IP Tools" --menu "Selecciona una opción:" 15 60 6 \
2 "Enable auto AP mode" \ 1 "Disable auto AP mode" \
3 "Salir" 3>&1 1>&2 2>&3) 2 "Enable auto AP mode" \
3 "Salir" 3>&1 1>&2 2>&3)
exitstatus=$? exitstatus=$?
if [ $exitstatus = 0 ]; then if [ $exitstatus = 0 ]; then
echo "Opción seleccionada:" $choix echo "Opción seleccionada:" $choix
else else
echo "Has elegido cancelar. Saliendo..." echo "Has elegido cancelar. Saliendo..."
break break
fi fi
case $choix in case $choix in
1) 1)
# Disable auto AP mode # Disable auto AP mode
servicios=("autoap.service") servicios=("autoap.service")
for servicio in "${servicios[@]}"; do for servicio in "${servicios[@]}"; do
if systemctl is-enabled "$servicio" >/dev/null 2>&1; then if systemctl is-enabled "$servicio" >/dev/null 2>&1; then
echo "Disabling $servicio" echo "Disabling $servicio"
sudo systemctl disable "$servicio" sudo systemctl disable "$servicio"
sudo systemctl stop "$servicio" sudo systemctl stop "$servicio"
fi fi
done done
;; ;;
2) 2)
# Enable auto AP mode # Enable auto AP mode
servicios=("autoap.service") servicios=("autoap.service")
for servicio in "${servicios[@]}"; do for servicio in "${servicios[@]}"; do
if systemctl is-enabled "$servicio" >/dev/null 2>&1; then if systemctl is-enabled "$servicio" >/dev/null 2>&1; then
echo "Restarting $servicio" echo "Restarting $servicio"
sudo systemctl restart "$servicio" sudo systemctl restart "$servicio"
else else
echo "Starting and enabling $servicio" echo "Starting and enabling $servicio"
sudo systemctl start "$servicio" sudo systemctl start "$servicio"
sudo systemctl enable "$servicio" sudo systemctl enable "$servicio"
fi fi
done done
;; ;;
3) 3)
break break
;; ;;
esac esac
done 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 exit 0
fi else
EOF whiptail --title "IP Tools" --msgbox "Esta opcion solo esta disponible para Raspberry / This option is only available for Raspberry" 0 50
exit 0
fi
EOF
chmod +x /bin/menu-ap chmod +x /bin/menu-ap
ln -sf /bin/menu-ap /bin/MENU-AP ln -sf /bin/menu-ap /bin/MENU-AP
chmod +x /bin/MENU* chmod +x /bin/MENU*
fi fi