mirror of https://gitlab.com/hp3icc/emq-TE1.git
67 lines
2.2 KiB
Bash
67 lines
2.2 KiB
Bash
#!/bin/bash
|
|
if [ "$(cat /proc/cpuinfo | grep 'Raspberry')" != "" ]; then
|
|
# menu-ap
|
|
sudo cat > /bin/menu-ap <<- "EOF"
|
|
#!/bin/bash
|
|
|
|
if [ "$(cat /proc/cpuinfo | grep 'Raspberry')" != "" ]; then
|
|
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 "Salir" 3>&1 1>&2 2>&3)
|
|
|
|
exitstatus=$?
|
|
|
|
if [ $exitstatus = 0 ]; then
|
|
echo "Opción seleccionada:" $choix
|
|
else
|
|
echo "Has elegido cancelar. Saliendo..."
|
|
break
|
|
fi
|
|
|
|
case $choix in
|
|
1)
|
|
# Disable auto AP mode
|
|
servicios=("autoap.service")
|
|
for servicio in "${servicios[@]}"; do
|
|
if systemctl is-enabled "$servicio" >/dev/null 2>&1; then
|
|
echo "Disabling $servicio"
|
|
sudo systemctl disable "$servicio"
|
|
sudo systemctl stop "$servicio"
|
|
fi
|
|
done
|
|
;;
|
|
2)
|
|
# Enable auto AP mode
|
|
servicios=("autoap.service")
|
|
for servicio in "${servicios[@]}"; do
|
|
if systemctl is-enabled "$servicio" >/dev/null 2>&1; then
|
|
echo "Restarting $servicio"
|
|
sudo systemctl restart "$servicio"
|
|
else
|
|
echo "Starting and enabling $servicio"
|
|
sudo systemctl start "$servicio"
|
|
sudo systemctl enable "$servicio"
|
|
fi
|
|
done
|
|
;;
|
|
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
|
|
fi
|
|
EOF
|
|
|
|
chmod +x /bin/menu-ap
|
|
ln -sf /bin/menu-ap /bin/MENU-AP
|
|
chmod +x /bin/MENU*
|
|
fi
|