2015-11-28 17:00:36 +01:00
|
|
|
#!/bin/sh
|
|
|
|
FILE=/etc/NetworkManager/NetworkManager.conf
|
|
|
|
VIFMAC=mac:fe:ff:ff:ff:ff:ff
|
2017-09-30 03:17:14 +02:00
|
|
|
if ! grep -q '^plugins.*keyfile' $FILE ; then
|
2015-11-28 17:00:36 +01:00
|
|
|
sed -i 's/^plugins.*$/&,keyfile/' $FILE
|
|
|
|
fi
|
2017-09-30 03:17:14 +02:00
|
|
|
if grep -q '^plugins.*ifcfg-rh' $FILE ; then
|
2015-11-28 17:00:36 +01:00
|
|
|
sed -i 's/^plugins=\(.*\)ifcfg-rh,\(.*\)$/plugins=\1\2/' $FILE
|
|
|
|
fi
|
|
|
|
if ! grep -q '^\[keyfile\]$' $FILE ; then
|
|
|
|
echo '[keyfile]' >> $FILE
|
|
|
|
fi
|
2017-09-30 03:17:14 +02:00
|
|
|
if ! grep -q '^unmanaged-devices' $FILE ; then
|
2015-11-28 17:00:36 +01:00
|
|
|
sed -i 's/^\[keyfile\]$/\[keyfile\]\x0aunmanaged-devices='$VIFMAC/ $FILE
|
|
|
|
fi
|
2017-09-30 03:17:14 +02:00
|
|
|
if ! grep -q "^unmanaged-devices.*$VIFMAC" $FILE ; then
|
2015-11-28 17:00:36 +01:00
|
|
|
sed -i 's/^unmanaged-devices.*$/&,'$VIFMAC/ $FILE
|
|
|
|
fi
|
2019-08-16 16:21:13 +02:00
|
|
|
if ! grep -q "^dns=" $FILE ; then
|
2020-07-28 16:02:34 +02:00
|
|
|
sed -i '/\[main\]/a dns=default' $FILE
|
2019-08-16 16:21:13 +02:00
|
|
|
fi
|
2015-11-28 17:00:36 +01:00
|
|
|
exit 0
|