mirror of https://gitlab.com/hp3icc/emq-TE1.git
45 lines
1.6 KiB
Bash
45 lines
1.6 KiB
Bash
#!/bin/bash
|
|
# Nombre del script
|
|
SCRIPT_NAME="raspberry.sh"
|
|
|
|
# Registra el inicio en /opt/curl.txt
|
|
echo "Inicio: $SCRIPT_NAME" >> /opt/curl.txt
|
|
if [ "$(cat /proc/cpuinfo | grep 'Raspberry')" != "" ]; then
|
|
# Agregar nuevo if aquí
|
|
|
|
# Archivos posibles
|
|
files=("/boot/firmware/cmdline.txt" "/boot/cmdline.txt")
|
|
|
|
# Línea que queremos agregar si no existe
|
|
line_to_add="cfg80211.ieee80211_regdom=US"
|
|
|
|
# Función para añadir la línea al final de la última línea no comentada
|
|
add_regdom_line() {
|
|
local file=$1
|
|
# Verificar si el archivo existe
|
|
if [ -f "$file" ]; then
|
|
# Comprobar si la configuración ya existe
|
|
if ! grep -q "cfg80211\.ieee80211_regdom" "$file"; then
|
|
# Si no existe, modificar la última línea no comentada agregando un espacio y la configuración
|
|
sudo sed -i -e '/^[^#]/s/$/ '"$line_to_add"'/' "$file"
|
|
fi
|
|
fi
|
|
}
|
|
|
|
# Recorrer los archivos y aplicar la función solo si el archivo existe
|
|
for file in "${files[@]}"; do
|
|
add_regdom_line "$file"
|
|
done
|
|
|
|
# Ahora desbloquear el Wi-Fi y realizar otras configuraciones
|
|
rfkill unblock wlan
|
|
sudo apt-get install raspi-config -y
|
|
sudo wget --no-cache -O /etc/init.d/move_nmconnection.sh https://gitlab.com/hp3icc/emq-TE1/-/raw/main/install/move_nmconnection.sh
|
|
sudo chmod +x /etc/init.d/move_nmconnection.sh
|
|
sudo update-rc.d move_nmconnection.sh defaults
|
|
else
|
|
#systemctl disable autoap.service
|
|
echo ""
|
|
fi
|
|
# Registra el final en /opt/curl.txt
|
|
echo "Finalizado: $SCRIPT_NAME" >> /opt/curl.txt |