1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
diff -r -u a/src/ck-sysdeps-linux.c b/src/ck-sysdeps-linux.c
--- a/src/ck-sysdeps-linux.c 2021-07-04 11:36:33.000000000 +0100
+++ b/src/ck-sysdeps-linux.c 2022-08-13 16:36:37.713469926 +0100
@@ -884,8 +884,7 @@
GError *error = NULL;
gint exit_status;
- /* run script from pm-utils */
- command = g_strdup_printf ("/usr/bin/pm-is-supported --%s", state);
+ command = g_strdup_printf ("/usr/bin/grep -q %s /sys/power/state", state);
g_debug ("excuting command: %s", command);
ret = g_spawn_command_line_sync (command, NULL, NULL, &exit_status, &error);
if (!ret) {
@@ -904,13 +903,13 @@
gboolean
ck_system_can_suspend (void)
{
- return linux_supports_sleep_state ("suspend");
+ return linux_supports_sleep_state ("mem");
}
gboolean
ck_system_can_hibernate (void)
{
- if (linux_supports_sleep_state ("hibernate"))
+ if (linux_supports_sleep_state ("disk"))
return linux_check_enough_swap() ;
return FALSE;
}
diff -r -u a/tools/linux/ck-system-hibernate b/tools/linux/ck-system-hibernate
--- a/tools/linux/ck-system-hibernate 2021-07-04 11:36:33.000000000 +0100
+++ b/tools/linux/ck-system-hibernate 2022-08-13 16:31:31.156794292 +0100
@@ -1,12 +1,3 @@
#!/bin/sh
-#Try for common tools
-if [ -x "/sbin/pm-hibernate" ] ; then
- /sbin/pm-hibernate
- exit $?
-elif [ -x "/usr/sbin/pm-hibernate" ] ; then
- /usr/sbin/pm-hibernate
- exit $?
-else
- exit 1
-fi
+echo disk > /sys/power/state
diff -r -u a/tools/linux/ck-system-restart b/tools/linux/ck-system-restart
--- a/tools/linux/ck-system-restart 2021-07-04 11:36:33.000000000 +0100
+++ b/tools/linux/ck-system-restart 2022-08-13 16:31:31.156794292 +0100
@@ -1,12 +1,3 @@
#!/bin/sh
-#Try for common tools
-if [ -x "/sbin/shutdown" ] ; then
- /sbin/shutdown -r now
- exit $?
-elif [ -x "/usr/sbin/shutdown" ] ; then
- /usr/sbin/shutdown -r now
- exit $?
-else
- exit 1
-fi
+/usr/bin/reboot
diff -r -u a/tools/linux/ck-system-stop b/tools/linux/ck-system-stop
--- a/tools/linux/ck-system-stop 2021-07-04 11:36:33.000000000 +0100
+++ b/tools/linux/ck-system-stop 2022-08-13 16:31:31.156794292 +0100
@@ -1,12 +1,3 @@
#!/bin/sh
-#Try for common tools
-if [ -x "/sbin/shutdown" ] ; then
- /sbin/shutdown -h now
- exit $?
-elif [ -x "/usr/sbin/shutdown" ] ; then
- /usr/sbin/shutdown -h now
- exit $?
-else
- exit 1
-fi
+/usr/bin/poweroff
diff -r -u a/tools/linux/ck-system-suspend b/tools/linux/ck-system-suspend
--- a/tools/linux/ck-system-suspend 2021-07-04 11:36:33.000000000 +0100
+++ b/tools/linux/ck-system-suspend 2022-08-13 16:31:31.156794292 +0100
@@ -1,12 +1,3 @@
#!/bin/sh
-#Try for common tools
-if [ -x "/sbin/pm-suspend" ] ; then
- /sbin/pm-suspend
- exit $?
-elif [ -x "/usr/sbin/pm-suspend" ] ; then
- /usr/sbin/pm-suspend
- exit $?
-else
- exit 1
-fi
+echo mem > /sys/power/state
|