forked from pool/systemd
Accepting request 198171 from home:fcrozat:branches:Base:System
- Add exclude-dev-from-tmpfiles.patch: allow to exclude /dev from tmpfiles (bnc#835813). OBS-URL: https://build.opensuse.org/request/show/198171 OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=428
This commit is contained in:
parent
6e5dac7003
commit
a5b9036967
253
exclude-dev-from-tmpfiles.patch
Normal file
253
exclude-dev-from-tmpfiles.patch
Normal file
@ -0,0 +1,253 @@
|
||||
From a2aced4add1964f82cfd250f1fee8de9d974b507 Mon Sep 17 00:00:00 2001
|
||||
From: Dave Reisner <dreisner@archlinux.org>
|
||||
Date: Wed, 24 Jul 2013 11:10:05 -0400
|
||||
Subject: [PATCH 1/3] tmpfiles: support passing --prefix multiple times
|
||||
|
||||
---
|
||||
man/systemd-tmpfiles.xml | 3 ++-
|
||||
src/tmpfiles/tmpfiles.c | 24 +++++++++++++++++++++---
|
||||
2 files changed, 23 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/man/systemd-tmpfiles.xml b/man/systemd-tmpfiles.xml
|
||||
index 405a9f1..b0f2d9c 100644
|
||||
--- a/man/systemd-tmpfiles.xml
|
||||
+++ b/man/systemd-tmpfiles.xml
|
||||
@@ -121,7 +121,8 @@
|
||||
<term><option>--prefix=PATH</option></term>
|
||||
<listitem><para>Only apply rules that
|
||||
apply to paths with the specified
|
||||
- prefix.</para></listitem>
|
||||
+ prefix. This option can be specified
|
||||
+ multiple times.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
|
||||
index eae993e..cb15133 100644
|
||||
--- a/src/tmpfiles/tmpfiles.c
|
||||
+++ b/src/tmpfiles/tmpfiles.c
|
||||
@@ -105,7 +105,7 @@ static bool arg_create = false;
|
||||
static bool arg_clean = false;
|
||||
static bool arg_remove = false;
|
||||
|
||||
-static const char *arg_prefix = NULL;
|
||||
+static char **include_prefixes = NULL;
|
||||
|
||||
static const char conf_file_dirs[] =
|
||||
"/etc/tmpfiles.d\0"
|
||||
@@ -1018,6 +1018,21 @@ static bool item_equal(Item *a, Item *b) {
|
||||
return true;
|
||||
}
|
||||
|
||||
+static bool should_include_path(const char *path) {
|
||||
+ char **prefix;
|
||||
+
|
||||
+ /* no explicit paths specified for inclusion, so everything is valid */
|
||||
+ if (strv_length(include_prefixes) == 0)
|
||||
+ return true;
|
||||
+
|
||||
+ STRV_FOREACH(prefix, include_prefixes) {
|
||||
+ if (path_startswith(path, *prefix))
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
static int parse_line(const char *fname, unsigned line, const char *buffer) {
|
||||
_cleanup_item_free_ Item *i = NULL;
|
||||
Item *existing;
|
||||
@@ -1119,7 +1134,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
|
||||
|
||||
path_kill_slashes(i->path);
|
||||
|
||||
- if (arg_prefix && !path_startswith(i->path, arg_prefix))
|
||||
+ if (!should_include_path(i->path))
|
||||
return 0;
|
||||
|
||||
if (user && !streq(user, "-")) {
|
||||
@@ -1258,7 +1273,8 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
case ARG_PREFIX:
|
||||
- arg_prefix = optarg;
|
||||
+ if (strv_extend(&include_prefixes, optarg) < 0)
|
||||
+ return log_oom();
|
||||
break;
|
||||
|
||||
case '?':
|
||||
@@ -1423,6 +1439,8 @@ finish:
|
||||
hashmap_free(items);
|
||||
hashmap_free(globs);
|
||||
|
||||
+ strv_free(include_prefixes);
|
||||
+
|
||||
set_free_free(unix_sockets);
|
||||
|
||||
label_finish();
|
||||
--
|
||||
1.8.4
|
||||
|
||||
|
||||
From 5c7951141fa9f33e1b97de97586cc16bce2776e0 Mon Sep 17 00:00:00 2001
|
||||
From: Dave Reisner <dreisner@archlinux.org>
|
||||
Date: Wed, 24 Jul 2013 11:19:24 -0400
|
||||
Subject: [PATCH 2/3] tmpfiles: introduce --exclude-prefix
|
||||
|
||||
The opposite of --prefix, allows specifying path prefixes which should
|
||||
be skipped when processing rules.
|
||||
---
|
||||
man/systemd-tmpfiles.xml | 7 +++++
|
||||
shell-completion/systemd-zsh-completion.zsh | 1 +
|
||||
src/tmpfiles/tmpfiles.c | 44 ++++++++++++++++++-----------
|
||||
3 files changed, 36 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/man/systemd-tmpfiles.xml b/man/systemd-tmpfiles.xml
|
||||
index b0f2d9c..403592d 100644
|
||||
--- a/man/systemd-tmpfiles.xml
|
||||
+++ b/man/systemd-tmpfiles.xml
|
||||
@@ -124,6 +124,13 @@
|
||||
prefix. This option can be specified
|
||||
multiple times.</para></listitem>
|
||||
</varlistentry>
|
||||
+ <varlistentry>
|
||||
+ <term><option>--exclude-prefix=PATH</option></term>
|
||||
+ <listitem><para>Ignore rules that
|
||||
+ apply to paths with the specified
|
||||
+ prefix. This option can be specified
|
||||
+ multiple times.</para></listitem>
|
||||
+ </varlistentry>
|
||||
|
||||
|
||||
<varlistentry>
|
||||
diff --git a/shell-completion/systemd-zsh-completion.zsh b/shell-completion/systemd-zsh-completion.zsh
|
||||
index b62b6df..1ab1311 100644
|
||||
--- a/shell-completion/systemd-zsh-completion.zsh
|
||||
+++ b/shell-completion/systemd-zsh-completion.zsh
|
||||
@@ -249,6 +249,7 @@ _ctls()
|
||||
'--clean[Clean up all files and directories with an age parameter configured.]' \
|
||||
'--remove[All files and directories marked with r, R in the configuration files are removed.]' \
|
||||
'--prefix=[Only apply rules that apply to paths with the specified prefix.]' \
|
||||
+ '--exclude-prefix=[Ignore rules that apply to paths with the specified prefix.]' \
|
||||
'--help[Prints a short help text and exits.]' \
|
||||
'*::files:_files'
|
||||
;;
|
||||
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
|
||||
index cb15133..5eca82a 100644
|
||||
--- a/src/tmpfiles/tmpfiles.c
|
||||
+++ b/src/tmpfiles/tmpfiles.c
|
||||
@@ -106,6 +106,7 @@ static bool arg_clean = false;
|
||||
static bool arg_remove = false;
|
||||
|
||||
static char **include_prefixes = NULL;
|
||||
+static char **exclude_prefixes = NULL;
|
||||
|
||||
static const char conf_file_dirs[] =
|
||||
"/etc/tmpfiles.d\0"
|
||||
@@ -1021,16 +1022,19 @@ static bool item_equal(Item *a, Item *b) {
|
||||
static bool should_include_path(const char *path) {
|
||||
char **prefix;
|
||||
|
||||
- /* no explicit paths specified for inclusion, so everything is valid */
|
||||
- if (strv_length(include_prefixes) == 0)
|
||||
- return true;
|
||||
+ STRV_FOREACH(prefix, exclude_prefixes) {
|
||||
+ if (path_startswith(path, *prefix))
|
||||
+ return false;
|
||||
+ }
|
||||
|
||||
STRV_FOREACH(prefix, include_prefixes) {
|
||||
if (path_startswith(path, *prefix))
|
||||
return true;
|
||||
}
|
||||
|
||||
- return false;
|
||||
+ /* no matches, so we should include this path only if we
|
||||
+ * have no whitelist at all */
|
||||
+ return strv_length(include_prefixes) == 0;
|
||||
}
|
||||
|
||||
static int parse_line(const char *fname, unsigned line, const char *buffer) {
|
||||
@@ -1219,11 +1223,12 @@ static int help(void) {
|
||||
|
||||
printf("%s [OPTIONS...] [CONFIGURATION FILE...]\n\n"
|
||||
"Creates, deletes and cleans up volatile and temporary files and directories.\n\n"
|
||||
- " -h --help Show this help\n"
|
||||
- " --create Create marked files/directories\n"
|
||||
- " --clean Clean up marked directories\n"
|
||||
- " --remove Remove marked files/directories\n"
|
||||
- " --prefix=PATH Only apply rules that apply to paths with the specified prefix\n",
|
||||
+ " -h --help Show this help\n"
|
||||
+ " --create Create marked files/directories\n"
|
||||
+ " --clean Clean up marked directories\n"
|
||||
+ " --remove Remove marked files/directories\n"
|
||||
+ " --prefix=PATH Only apply rules that apply to paths with the specified prefix\n"
|
||||
+ " --exclude-prefix=PATH Ignore rules that apply to paths with the specified prefix\n",
|
||||
program_invocation_short_name);
|
||||
|
||||
return 0;
|
||||
@@ -1235,16 +1240,18 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
ARG_CREATE,
|
||||
ARG_CLEAN,
|
||||
ARG_REMOVE,
|
||||
- ARG_PREFIX
|
||||
+ ARG_PREFIX,
|
||||
+ ARG_EXCLUDE_PREFIX,
|
||||
};
|
||||
|
||||
static const struct option options[] = {
|
||||
- { "help", no_argument, NULL, 'h' },
|
||||
- { "create", no_argument, NULL, ARG_CREATE },
|
||||
- { "clean", no_argument, NULL, ARG_CLEAN },
|
||||
- { "remove", no_argument, NULL, ARG_REMOVE },
|
||||
- { "prefix", required_argument, NULL, ARG_PREFIX },
|
||||
- { NULL, 0, NULL, 0 }
|
||||
+ { "help", no_argument, NULL, 'h' },
|
||||
+ { "create", no_argument, NULL, ARG_CREATE },
|
||||
+ { "clean", no_argument, NULL, ARG_CLEAN },
|
||||
+ { "remove", no_argument, NULL, ARG_REMOVE },
|
||||
+ { "prefix", required_argument, NULL, ARG_PREFIX },
|
||||
+ { "exclude-prefix", required_argument, NULL, ARG_EXCLUDE_PREFIX },
|
||||
+ { NULL, 0, NULL, 0 }
|
||||
};
|
||||
|
||||
int c;
|
||||
@@ -1277,6 +1284,11 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return log_oom();
|
||||
break;
|
||||
|
||||
+ case ARG_EXCLUDE_PREFIX:
|
||||
+ if (strv_extend(&exclude_prefixes, optarg) < 0)
|
||||
+ return log_oom();
|
||||
+ break;
|
||||
+
|
||||
case '?':
|
||||
return -EINVAL;
|
||||
|
||||
--
|
||||
1.8.4
|
||||
|
||||
|
||||
From ec99834cb0e76a9e7096bd42249053712db9c32d Mon Sep 17 00:00:00 2001
|
||||
From: Dave Reisner <dreisner@archlinux.org>
|
||||
Date: Wed, 24 Jul 2013 11:58:35 -0400
|
||||
Subject: [PATCH 3/3] tmpfiles-setup: exclude /dev prefixes files
|
||||
|
||||
Fixes Arch Linux bug: https://bugs.archlinux.org/task/36259
|
||||
---
|
||||
units/systemd-tmpfiles-setup.service.in | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/units/systemd-tmpfiles-setup.service.in b/units/systemd-tmpfiles-setup.service.in
|
||||
index 67c7d4a..6f98063 100644
|
||||
--- a/units/systemd-tmpfiles-setup.service.in
|
||||
+++ b/units/systemd-tmpfiles-setup.service.in
|
||||
@@ -21,4 +21,4 @@ ConditionDirectoryNotEmpty=|/run/tmpfiles.d
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
-ExecStart=@rootbindir@/systemd-tmpfiles --create --remove
|
||||
+ExecStart=@rootbindir@/systemd-tmpfiles --create --remove --exclude-prefix=/dev
|
||||
--
|
||||
1.8.4
|
||||
|
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Sep 9 14:39:46 UTC 2013 - fcrozat@suse.com
|
||||
|
||||
- Add exclude-dev-from-tmpfiles.patch: allow to exclude /dev from
|
||||
tmpfiles (bnc#835813).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Sep 6 15:02:08 UTC 2013 - fcrozat@suse.com
|
||||
|
||||
|
@ -172,6 +172,8 @@ Patch38: rules-add-lid-switch-of-ARM-based-Chromebook-as-a-power-sw.patch
|
||||
Patch46: use-usr-sbin-sulogin-for-emergency-service.patch
|
||||
# PATCH-FIX-UPSTREAM logind_update_state_file_after_generating_the_session_fifo_not_before.patch -- fdo#67273
|
||||
Patch47: logind_update_state_file_after_generating_the_session_fifo_not_before.patch
|
||||
# PATCH-FIX-UPSTREAM exclude-dev-from-tmpfiles.patch bnc#835813 fcrozat@suse.com -- allow to exclude /dev from tmpfiles
|
||||
Patch48: exclude-dev-from-tmpfiles.patch
|
||||
|
||||
# udev patches
|
||||
# PATCH-FIX-OPENSUSE 1001-re-enable-by_path-links-for-ata-devices.patch
|
||||
@ -416,6 +418,7 @@ cp %{SOURCE7} m4/
|
||||
%patch41 -p1
|
||||
%patch46 -p1
|
||||
%patch47 -p1
|
||||
%patch48 -p1
|
||||
|
||||
# udev patches
|
||||
%patch1001 -p1
|
||||
|
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Sep 9 14:39:46 UTC 2013 - fcrozat@suse.com
|
||||
|
||||
- Add exclude-dev-from-tmpfiles.patch: allow to exclude /dev from
|
||||
tmpfiles (bnc#835813).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Sep 6 15:02:08 UTC 2013 - fcrozat@suse.com
|
||||
|
||||
|
@ -167,6 +167,8 @@ Patch38: rules-add-lid-switch-of-ARM-based-Chromebook-as-a-power-sw.patch
|
||||
Patch46: use-usr-sbin-sulogin-for-emergency-service.patch
|
||||
# PATCH-FIX-UPSTREAM logind_update_state_file_after_generating_the_session_fifo_not_before.patch -- fdo#67273
|
||||
Patch47: logind_update_state_file_after_generating_the_session_fifo_not_before.patch
|
||||
# PATCH-FIX-UPSTREAM exclude-dev-from-tmpfiles.patch bnc#835813 fcrozat@suse.com -- allow to exclude /dev from tmpfiles
|
||||
Patch48: exclude-dev-from-tmpfiles.patch
|
||||
|
||||
# udev patches
|
||||
# PATCH-FIX-OPENSUSE 1001-re-enable-by_path-links-for-ata-devices.patch
|
||||
@ -411,6 +413,7 @@ cp %{SOURCE7} m4/
|
||||
%patch41 -p1
|
||||
%patch46 -p1
|
||||
%patch47 -p1
|
||||
%patch48 -p1
|
||||
|
||||
# udev patches
|
||||
%patch1001 -p1
|
||||
|
Loading…
Reference in New Issue
Block a user