diff options
Diffstat (limited to 'generic-power-commands.diff')
-rw-r--r-- | generic-power-commands.diff | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/generic-power-commands.diff b/generic-power-commands.diff new file mode 100644 index 000000000000..fb05d3d93067 --- /dev/null +++ b/generic-power-commands.diff @@ -0,0 +1,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 |