network-manager-prepare-conf-dir 1.2 KB

123456789101112131415161718192021222324252627282930
  1. #!/bin/sh
  2. NM_CONFIG_DIR=/etc/NetworkManager/system-connections
  3. if [ -d $NM_CONFIG_DIR ] && [ ! -h $NM_CONFIG_DIR ]; then
  4. mkdir -p /rw/config/NM-system-connections
  5. mv $NM_CONFIG_DIR/* /rw/config/NM-system-connections/ 2> /dev/null || true
  6. rmdir $NM_CONFIG_DIR
  7. ln -s /rw/config/NM-system-connections $NM_CONFIG_DIR
  8. fi
  9. # Do not manage xen-provided network devices
  10. unmanaged_devices=mac:fe:ff:ff:ff:ff:ff
  11. #for mac in `xenstore-ls device/vif | grep mac | cut -d= -f2 | tr -d '" '`; do
  12. # unmanaged_devices="$unmanaged_devices;mac:$mac"
  13. #done
  14. sed -r -i -e "s/^#?unmanaged-devices=.*/unmanaged-devices=$unmanaged_devices/" /etc/NetworkManager/NetworkManager.conf
  15. sed -r -i -e "s/^#?plugins=.*/plugins=keyfile/" /etc/NetworkManager/NetworkManager.conf
  16. # setup uplink configuration if applicable - this needs to be done before
  17. # starting NetworkManager, otherwise it will try default DHCP configuration
  18. # first and only after a timeout fallback to static one - introducing delay in
  19. # network connectivity
  20. export INTERFACE=eth0
  21. if qubesdb-read /qubes-ip >/dev/null 2>/dev/null &&
  22. [ -e /sys/class/net/$INTERFACE ] &&
  23. [ ! -r /etc/NetworkManager/system-connections/qubes-uplink-$INTERFACE ]; then
  24. /usr/lib/qubes/setup-ip
  25. fi
  26. exit 0