mirror of https://gitlab.com/hp3icc/emq-TE1.git
Update raspberry.sh
This commit is contained in:
parent
a7ab4a07f3
commit
ebee4acc01
|
|
@ -5,11 +5,38 @@ SCRIPT_NAME="raspberry.sh"
|
||||||
# Registra el inicio en /opt/curl.txt
|
# Registra el inicio en /opt/curl.txt
|
||||||
echo "Inicio: $SCRIPT_NAME" >> /opt/curl.txt
|
echo "Inicio: $SCRIPT_NAME" >> /opt/curl.txt
|
||||||
if [ "$(cat /proc/cpuinfo | grep 'Raspberry')" != "" ]; then
|
if [ "$(cat /proc/cpuinfo | grep 'Raspberry')" != "" ]; then
|
||||||
sudo rfkill unblock wlan
|
# Agregar nuevo if aquí
|
||||||
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
|
# Archivos posibles
|
||||||
sudo chmod +x /etc/init.d/move_nmconnection.sh
|
files=("/boot/firmware/cmdline.txt" "/boot/cmdline.txt")
|
||||||
sudo update-rc.d move_nmconnection.sh defaults
|
|
||||||
|
# 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
|
||||||
|
sudo 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
|
else
|
||||||
#systemctl disable autoap.service
|
#systemctl disable autoap.service
|
||||||
echo ""
|
echo ""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue