suspend-prepare: call NM D-Bus interface directly

nmcli doesn't seem to have stable API, especially "nmcli nm sleep"
doesn't work anymore in Fedora 20.
This commit is contained in:
Marek Marczykowski-Górecki 2014-02-21 18:42:12 +01:00
parent 9d618cac15
commit 0d3ed747b4

View File

@ -12,7 +12,11 @@ if [ -r /rw/config/suspend-module-blacklist ]; then
fi
if [ x"$action" == x"suspend" ]; then
nmcli nm sleep true || service NetworkManager stop
dbus_send --system --print-reply \
--dest=org.freedesktop.NetworkManager \
/org/freedesktop/NetworkManager \
org.freedesktop.NetworkManager.Sleep boolean:true || \
service NetworkManager stop
# Force interfaces down, just in case when NM didn't done it
for if in `ls /sys/class/net|grep -v "lo\|vif"`; do
ip l s $if down
@ -29,5 +33,9 @@ else
for mod in `cat /var/run/qubes/suspend-modules-loaded`; do
modprobe $mod
done
nmcli nm sleep false || { [ -x /bin/systemctl ] && systemctl start NetworkManager.service; } || service qubes-core-netvm start
dbus_send --system --print-reply \
--dest=org.freedesktop.NetworkManager \
/org/freedesktop/NetworkManager \
org.freedesktop.NetworkManager.Sleep boolean:false || \
{ [ -x /bin/systemctl ] && systemctl start NetworkManager.service; } || service qubes-core-netvm start
fi