diff options
Diffstat (limited to 'meta/recipes-core/systemd/systemd/0013-Make-root-s-home-directory-configurable.patch')
-rw-r--r-- | meta/recipes-core/systemd/systemd/0013-Make-root-s-home-directory-configurable.patch | 184 |
1 files changed, 184 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/0013-Make-root-s-home-directory-configurable.patch b/meta/recipes-core/systemd/systemd/0013-Make-root-s-home-directory-configurable.patch new file mode 100644 index 0000000000..ea0b3e250f --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0013-Make-root-s-home-directory-configurable.patch | |||
@@ -0,0 +1,184 @@ | |||
1 | From 1ba00ff6ed3f0626892f57cdd8d9788692c7bf14 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Mon, 14 Dec 2015 05:18:20 +0000 | ||
4 | Subject: [PATCH 13/16] Make root's home directory configurable | ||
5 | |||
6 | OpenEmbedded has a configurable home directory for root. Allow | ||
7 | systemd to be built using its idea of what root's home directory | ||
8 | should be. | ||
9 | |||
10 | Upstream-Status: Denied | ||
11 | Upstream wants to have a unified hierarchy where everyone is | ||
12 | using the same root folder. | ||
13 | https://github.com/systemd/systemd/issues/541 | ||
14 | |||
15 | Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca> | ||
16 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
17 | --- | ||
18 | Makefile.am | 2 ++ | ||
19 | configure.ac | 7 +++++++ | ||
20 | src/basic/user-util.c | 4 ++-- | ||
21 | src/core/namespace.c | 2 +- | ||
22 | src/nspawn/nspawn.c | 4 ++-- | ||
23 | units/console-shell.service.m4.in | 4 ++-- | ||
24 | units/emergency.service.in | 4 ++-- | ||
25 | units/rescue.service.in | 4 ++-- | ||
26 | 8 files changed, 20 insertions(+), 11 deletions(-) | ||
27 | |||
28 | diff --git a/Makefile.am b/Makefile.am | ||
29 | index cf559be..a511c3d 100644 | ||
30 | --- a/Makefile.am | ||
31 | +++ b/Makefile.am | ||
32 | @@ -210,6 +210,7 @@ AM_CPPFLAGS = \ | ||
33 | -DLIBDIR=\"$(libdir)\" \ | ||
34 | -DROOTLIBDIR=\"$(rootlibdir)\" \ | ||
35 | -DROOTLIBEXECDIR=\"$(rootlibexecdir)\" \ | ||
36 | + -DROOTHOMEDIR=\"$(roothomedir)\" \ | ||
37 | -DTEST_DIR=\"$(abs_top_srcdir)/test\" \ | ||
38 | -I $(top_srcdir)/src \ | ||
39 | -I $(top_builddir)/src/basic \ | ||
40 | @@ -5876,6 +5877,7 @@ EXTRA_DIST += \ | ||
41 | substitutions = \ | ||
42 | '|rootlibexecdir=$(rootlibexecdir)|' \ | ||
43 | '|rootbindir=$(rootbindir)|' \ | ||
44 | + '|roothomedir=$(roothomedir)|' \ | ||
45 | '|bindir=$(bindir)|' \ | ||
46 | '|SYSTEMCTL=$(rootbindir)/systemctl|' \ | ||
47 | '|SYSTEMD_NOTIFY=$(rootbindir)/systemd-notify|' \ | ||
48 | diff --git a/configure.ac b/configure.ac | ||
49 | index 49f73a4..a3e639d 100644 | ||
50 | --- a/configure.ac | ||
51 | +++ b/configure.ac | ||
52 | @@ -1434,6 +1434,11 @@ AC_ARG_WITH([rootlibdir], | ||
53 | [with_rootlibdir=${libdir}]) | ||
54 | AX_NORMALIZE_PATH([with_rootlibdir]) | ||
55 | |||
56 | +AC_ARG_WITH([roothomedir], | ||
57 | + AS_HELP_STRING([--with-roothomedir=DIR], [Home directory for the root user]), | ||
58 | + [], | ||
59 | + [with_roothomedir=/root]) | ||
60 | + | ||
61 | AC_ARG_WITH([pamlibdir], | ||
62 | AS_HELP_STRING([--with-pamlibdir=DIR], [Directory for PAM modules]), | ||
63 | [], | ||
64 | @@ -1517,6 +1522,7 @@ AC_SUBST([pamlibdir], [$with_pamlibdir]) | ||
65 | AC_SUBST([pamconfdir], [$with_pamconfdir]) | ||
66 | AC_SUBST([rootprefix], [$with_rootprefix]) | ||
67 | AC_SUBST([rootlibdir], [$with_rootlibdir]) | ||
68 | +AC_SUBST([roothomedir], [$with_roothomedir]) | ||
69 | |||
70 | AC_CONFIG_FILES([ | ||
71 | Makefile | ||
72 | @@ -1606,6 +1612,7 @@ AC_MSG_RESULT([ | ||
73 | includedir: ${includedir} | ||
74 | lib dir: ${libdir} | ||
75 | rootlib dir: ${with_rootlibdir} | ||
76 | + root home dir: ${with_roothomedir} | ||
77 | SysV init scripts: ${SYSTEM_SYSVINIT_PATH} | ||
78 | SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH} | ||
79 | Build Python: ${PYTHON} | ||
80 | diff --git a/src/basic/user-util.c b/src/basic/user-util.c | ||
81 | index 56e1a3b..c3d0ec3 100644 | ||
82 | --- a/src/basic/user-util.c | ||
83 | +++ b/src/basic/user-util.c | ||
84 | @@ -124,7 +124,7 @@ int get_user_creds( | ||
85 | *gid = 0; | ||
86 | |||
87 | if (home) | ||
88 | - *home = "/root"; | ||
89 | + *home = ROOTHOMEDIR; | ||
90 | |||
91 | if (shell) | ||
92 | *shell = "/bin/sh"; | ||
93 | @@ -355,7 +355,7 @@ int get_home_dir(char **_h) { | ||
94 | /* Hardcode home directory for root to avoid NSS */ | ||
95 | u = getuid(); | ||
96 | if (u == 0) { | ||
97 | - h = strdup("/root"); | ||
98 | + h = strdup(ROOTHOMEDIR); | ||
99 | if (!h) | ||
100 | return -ENOMEM; | ||
101 | |||
102 | diff --git a/src/core/namespace.c b/src/core/namespace.c | ||
103 | index 81ba09e..1a1f276 100644 | ||
104 | --- a/src/core/namespace.c | ||
105 | +++ b/src/core/namespace.c | ||
106 | @@ -494,7 +494,7 @@ int setup_namespace( | ||
107 | home_dir = strjoina("-", home_dir); | ||
108 | run_user_dir = prefix_roota(root_directory, "/run/user"); | ||
109 | run_user_dir = strjoina("-", run_user_dir); | ||
110 | - root_dir = prefix_roota(root_directory, "/root"); | ||
111 | + root_dir = prefix_roota(root_directory, ROOTHOMEDIR); | ||
112 | root_dir = strjoina("-", root_dir); | ||
113 | |||
114 | r = append_mounts(&m, STRV_MAKE(home_dir, run_user_dir, root_dir), | ||
115 | diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c | ||
116 | index 4def6ba..2081953 100644 | ||
117 | --- a/src/nspawn/nspawn.c | ||
118 | +++ b/src/nspawn/nspawn.c | ||
119 | @@ -2530,7 +2530,7 @@ static int inner_child( | ||
120 | if (envp[n_env]) | ||
121 | n_env ++; | ||
122 | |||
123 | - if ((asprintf((char**)(envp + n_env++), "HOME=%s", home ? home: "/root") < 0) || | ||
124 | + if ((asprintf((char**)(envp + n_env++), "HOME=%s", home ? home: ROOTHOMEDIR) < 0) || | ||
125 | (asprintf((char**)(envp + n_env++), "USER=%s", arg_user ? arg_user : "root") < 0) || | ||
126 | (asprintf((char**)(envp + n_env++), "LOGNAME=%s", arg_user ? arg_user : "root") < 0)) | ||
127 | return log_oom(); | ||
128 | @@ -2604,7 +2604,7 @@ static int inner_child( | ||
129 | execvp(arg_parameters[0], arg_parameters); | ||
130 | #endif /* HAVE_EXECVPE */ | ||
131 | else { | ||
132 | - chdir(home ?: "/root"); | ||
133 | + chdir(home ?: ROOTHOMEDIR); | ||
134 | execle("/bin/bash", "-bash", NULL, env_use); | ||
135 | execle("/bin/sh", "-sh", NULL, env_use); | ||
136 | } | ||
137 | diff --git a/units/console-shell.service.m4.in b/units/console-shell.service.m4.in | ||
138 | index 5c80722..efde5f0 100644 | ||
139 | --- a/units/console-shell.service.m4.in | ||
140 | +++ b/units/console-shell.service.m4.in | ||
141 | @@ -15,8 +15,8 @@ After=rc-local.service | ||
142 | Before=getty.target | ||
143 | |||
144 | [Service] | ||
145 | -Environment=HOME=/root | ||
146 | -WorkingDirectory=/root | ||
147 | +Environment=HOME=@roothomedir@ | ||
148 | +WorkingDirectory=@roothomedir@ | ||
149 | ExecStart=-@SULOGIN@ | ||
150 | ExecStopPost=-@SYSTEMCTL@ poweroff | ||
151 | Type=idle | ||
152 | diff --git a/units/emergency.service.in b/units/emergency.service.in | ||
153 | index 8dc3cbd..eb046c2 100644 | ||
154 | --- a/units/emergency.service.in | ||
155 | +++ b/units/emergency.service.in | ||
156 | @@ -14,8 +14,8 @@ Conflicts=rescue.service | ||
157 | Before=shutdown.target | ||
158 | |||
159 | [Service] | ||
160 | -Environment=HOME=/root | ||
161 | -WorkingDirectory=/root | ||
162 | +Environment=HOME=@roothomedir@ | ||
163 | +WorkingDirectory=@roothomedir@ | ||
164 | ExecStartPre=-/bin/plymouth --wait quit | ||
165 | ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" or ^D to\\ntry again to boot into default mode.' | ||
166 | ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --job-mode=fail --no-block default" | ||
167 | diff --git a/units/rescue.service.in b/units/rescue.service.in | ||
168 | index 432e4f3..afa3e82 100644 | ||
169 | --- a/units/rescue.service.in | ||
170 | +++ b/units/rescue.service.in | ||
171 | @@ -14,8 +14,8 @@ After=sysinit.target plymouth-start.service | ||
172 | Before=shutdown.target | ||
173 | |||
174 | [Service] | ||
175 | -Environment=HOME=/root | ||
176 | -WorkingDirectory=/root | ||
177 | +Environment=HOME=@roothomedir@ | ||
178 | +WorkingDirectory=@roothomedir@ | ||
179 | ExecStartPre=-/bin/plymouth quit | ||
180 | ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" or ^D to\\nboot into default mode.' | ||
181 | ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --job-mode=fail --no-block default" | ||
182 | -- | ||
183 | 2.6.4 | ||
184 | |||