void-packages/srcpkgs/xfce4-power-manager/patches/void.patch
Đoàn Trần Công Danh 3353bf4722 srcpkgs/x*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.-][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.-][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

78 lines
2 KiB
Diff

--- a/src/xfpm-pm-helper.c 2019-08-13 12:17:22.787621859 +0200
+++ b/src/xfpm-pm-helper.c 2019-08-13 12:18:31.946471555 +0200
@@ -69,11 +69,8 @@
#define UP_BACKEND_SUSPEND_COMMAND "/usr/sbin/acpiconf -s 3"
#define UP_BACKEND_HIBERNATE_COMMAND "/usr/sbin/acpiconf -s 4"
#endif
-#ifdef BACKEND_TYPE_LINUX
-#define UP_BACKEND_SUSPEND_COMMAND "/usr/sbin/pm-suspend"
-#define UP_BACKEND_HIBERNATE_COMMAND "/usr/sbin/pm-hibernate"
-#endif
-#ifdef BACKEND_TYPE_OPENBSD
+/* voidlinux and openbsd use zzz(8) */
+#if defined(BACKEND_TYPE_LINUX) || defined(BACKEND_TYPE_OPENBSD)
#define UP_BACKEND_SUSPEND_COMMAND "/usr/sbin/zzz"
#define UP_BACKEND_HIBERNATE_COMMAND "/usr/sbin/ZZZ"
#endif
--- a/src/xfpm-suspend.c 2020-12-22 20:56:08.139119371 -0500
+++ b/src/xfpm-suspend.c 2020-12-22 20:56:52.359241485 -0500
@@ -105,40 +105,6 @@
}
#endif
-#ifdef BACKEND_TYPE_LINUX
-static gboolean
-linux_supports_sleep_state (const gchar *state)
-{
- gboolean ret = FALSE;
- gchar *command;
- GError *error = NULL;
- gint exit_status;
-
- XFPM_DEBUG("entering");
-
- /* run script from pm-utils */
- command = g_strdup_printf ("/usr/bin/pm-is-supported --%s", state);
- g_debug ("executing command: %s", command);
- ret = g_spawn_command_line_sync (command, NULL, NULL, &exit_status, &error);
-
- if (!ret) {
- if (error)
- {
- g_warning ("failed to run script: %s", error->message);
- g_error_free (error);
- }
- goto out;
- }
- ret = (WIFEXITED(exit_status) && (WEXITSTATUS(exit_status) == EXIT_SUCCESS));
-
-out:
- g_free (command);
-
- return ret;
-}
-#endif
-
-
gboolean
xfpm_suspend_can_suspend (void)
{
@@ -147,7 +113,7 @@
return freebsd_supports_sleep_state ("S3");
#endif
#ifdef BACKEND_TYPE_LINUX
- return linux_supports_sleep_state ("suspend");
+ return TRUE;
#endif
#ifdef BACKEND_TYPE_OPENBSD
return TRUE;
@@ -164,7 +130,7 @@
return freebsd_supports_sleep_state ("S4");
#endif
#ifdef BACKEND_TYPE_LINUX
- return linux_supports_sleep_state ("hibernate");
+ return TRUE;
#endif
#ifdef BACKEND_TYPE_OPENBSD
return TRUE;