qubes-fix-nm-conf.sh 591 B

12345678910111213141516171819
  1. #!/bin/sh
  2. FILE=/etc/NetworkManager/NetworkManager.conf
  3. VIFMAC=mac:fe:ff:ff:ff:ff:ff
  4. if ! grep -q ^plugins.*keyfile $FILE ; then
  5. sed -i 's/^plugins.*$/&,keyfile/' $FILE
  6. fi
  7. if grep -q ^plugins.*ifcfg-rh $FILE ; then
  8. sed -i 's/^plugins=\(.*\)ifcfg-rh,\(.*\)$/plugins=\1\2/' $FILE
  9. fi
  10. if ! grep -q '^\[keyfile\]$' $FILE ; then
  11. echo '[keyfile]' >> $FILE
  12. fi
  13. if ! grep -q ^unmanaged-devices $FILE ; then
  14. sed -i 's/^\[keyfile\]$/\[keyfile\]\x0aunmanaged-devices='$VIFMAC/ $FILE
  15. fi
  16. if ! grep -q ^unmanaged-devices.*$VIFMAC $FILE ; then
  17. sed -i 's/^unmanaged-devices.*$/&,'$VIFMAC/ $FILE
  18. fi
  19. exit 0