mirror of https://gitlab.com/hp3icc/emq-TE1.git
Update move_nmconnection.sh
This commit is contained in:
parent
165ba8a4a3
commit
9523429421
|
|
@ -12,11 +12,17 @@
|
|||
BOOT_DIR="/boot"
|
||||
DEST_DIR="/etc/NetworkManager/system-connections"
|
||||
|
||||
# Verificar si hay archivos .nmconnection en /boot
|
||||
if ! ls "$BOOT_DIR"/*.nmconnection &>/dev/null; then
|
||||
echo "No se encontraron archivos .nmconnection en $BOOT_DIR. Saliendo..."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
get_ssid_from_file() {
|
||||
grep -oP '^ssid=\K.*' "$1"
|
||||
}
|
||||
|
||||
for nm_file in $BOOT_DIR/*.nmconnection; do
|
||||
for nm_file in "$BOOT_DIR"/*.nmconnection; do
|
||||
if [ -f "$nm_file" ]; then
|
||||
new_ssid=$(get_ssid_from_file "$nm_file")
|
||||
if [ -z "$new_ssid" ]; then
|
||||
|
|
@ -31,7 +37,7 @@ for nm_file in $BOOT_DIR/*.nmconnection; do
|
|||
done
|
||||
fi
|
||||
mv -f "$nm_file" "$DEST_DIR/"
|
||||
chmod 600 "$DEST_DIR/$(basename $nm_file)"
|
||||
chmod 600 "$DEST_DIR/$(basename "$nm_file")"
|
||||
fi
|
||||
done
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue