diff options
Diffstat (limited to 'meta/recipes-core/systemd/systemd/0010-Make-root-s-home-directory-configurable.patch')
-rw-r--r-- | meta/recipes-core/systemd/systemd/0010-Make-root-s-home-directory-configurable.patch | 181 |
1 files changed, 181 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/0010-Make-root-s-home-directory-configurable.patch b/meta/recipes-core/systemd/systemd/0010-Make-root-s-home-directory-configurable.patch new file mode 100644 index 0000000000..41b903951e --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0010-Make-root-s-home-directory-configurable.patch | |||
@@ -0,0 +1,181 @@ | |||
1 | From 3dc731c1d270e2e143de621db9bd898299fd849d Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Fri, 20 Feb 2015 05:24:49 +0000 | ||
4 | Subject: [PATCH 10/11] 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: Pending | ||
11 | |||
12 | Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca> | ||
13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
14 | --- | ||
15 | Makefile.am | 2 ++ | ||
16 | configure.ac | 7 +++++++ | ||
17 | src/core/unit-printf.c | 2 +- | ||
18 | src/nspawn/nspawn.c | 4 ++-- | ||
19 | src/shared/util.c | 4 ++-- | ||
20 | units/console-shell.service.m4.in | 4 ++-- | ||
21 | units/emergency.service.in | 4 ++-- | ||
22 | units/rescue.service.in | 4 ++-- | ||
23 | 8 files changed, 20 insertions(+), 11 deletions(-) | ||
24 | |||
25 | diff --git a/Makefile.am b/Makefile.am | ||
26 | index 0fb3f9f..4623963 100644 | ||
27 | --- a/Makefile.am | ||
28 | +++ b/Makefile.am | ||
29 | @@ -199,6 +199,7 @@ AM_CPPFLAGS = \ | ||
30 | -DKEXEC=\"$(KEXEC)\" \ | ||
31 | -DLIBDIR=\"$(libdir)\" \ | ||
32 | -DROOTLIBDIR=\"$(rootlibdir)\" \ | ||
33 | + -DROOTHOMEDIR=\"$(roothomedir)\" \ | ||
34 | -DTEST_DIR=\"$(abs_top_srcdir)/test\" \ | ||
35 | -I $(top_srcdir)/src \ | ||
36 | -I $(top_builddir)/src/shared \ | ||
37 | @@ -6342,6 +6343,7 @@ EXTRA_DIST += \ | ||
38 | substitutions = \ | ||
39 | '|rootlibexecdir=$(rootlibexecdir)|' \ | ||
40 | '|rootbindir=$(rootbindir)|' \ | ||
41 | + '|roothomedir=$(roothomedir)|' \ | ||
42 | '|bindir=$(bindir)|' \ | ||
43 | '|SYSTEMCTL=$(rootbindir)/systemctl|' \ | ||
44 | '|SYSTEMD_NOTIFY=$(rootbindir)/systemd-notify|' \ | ||
45 | diff --git a/configure.ac b/configure.ac | ||
46 | index a5b2e6e..55bb7d8 100644 | ||
47 | --- a/configure.ac | ||
48 | +++ b/configure.ac | ||
49 | @@ -1428,6 +1428,11 @@ AC_ARG_WITH([rootlibdir], | ||
50 | [], | ||
51 | [with_rootlibdir=${libdir}]) | ||
52 | |||
53 | +AC_ARG_WITH([roothomedir], | ||
54 | + AS_HELP_STRING([--with-roothomedir=DIR], [Home directory for the root user]), | ||
55 | + [], | ||
56 | + [with_roothomedir=/root]) | ||
57 | + | ||
58 | AC_ARG_WITH([pamlibdir], | ||
59 | AS_HELP_STRING([--with-pamlibdir=DIR], [Directory for PAM modules]), | ||
60 | [], | ||
61 | @@ -1518,6 +1523,7 @@ AC_SUBST([pamlibdir], [$with_pamlibdir]) | ||
62 | AC_SUBST([pamconfdir], [$with_pamconfdir]) | ||
63 | AC_SUBST([rootprefix], [$with_rootprefix]) | ||
64 | AC_SUBST([rootlibdir], [$with_rootlibdir]) | ||
65 | +AC_SUBST([roothomedir], [$with_roothomedir]) | ||
66 | |||
67 | AC_CONFIG_FILES([ | ||
68 | Makefile po/Makefile.in | ||
69 | @@ -1617,6 +1623,7 @@ AC_MSG_RESULT([ | ||
70 | include_prefix: ${INCLUDE_PREFIX} | ||
71 | lib dir: ${libdir} | ||
72 | rootlib dir: ${with_rootlibdir} | ||
73 | + root home dir: ${with_roothomedir} | ||
74 | SysV init scripts: ${SYSTEM_SYSVINIT_PATH} | ||
75 | SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH} | ||
76 | Build Python: ${PYTHON} | ||
77 | diff --git a/src/core/unit-printf.c b/src/core/unit-printf.c | ||
78 | index 97135db..14d12f1 100644 | ||
79 | --- a/src/core/unit-printf.c | ||
80 | +++ b/src/core/unit-printf.c | ||
81 | @@ -259,7 +259,7 @@ static int specifier_user_home(char specifier, void *data, void *userdata, char | ||
82 | * best of it if we can, but fail if we can't */ | ||
83 | |||
84 | if (!c->user || streq(c->user, "root") || streq(c->user, "0")) | ||
85 | - n = strdup("/root"); | ||
86 | + n = strdup(ROOTHOMEDIR); | ||
87 | else | ||
88 | return -ENOTSUP; | ||
89 | |||
90 | diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c | ||
91 | index b597edb..0b32673 100644 | ||
92 | --- a/src/nspawn/nspawn.c | ||
93 | +++ b/src/nspawn/nspawn.c | ||
94 | @@ -4192,7 +4192,7 @@ int main(int argc, char *argv[]) { | ||
95 | if (r < 0) | ||
96 | _exit(EXIT_FAILURE); | ||
97 | |||
98 | - if ((asprintf((char**)(envp + n_env++), "HOME=%s", home ? home: "/root") < 0) || | ||
99 | + if ((asprintf((char**)(envp + n_env++), "HOME=%s", home ? home: ROOTHOMEDIR) < 0) || | ||
100 | (asprintf((char**)(envp + n_env++), "USER=%s", arg_user ? arg_user : "root") < 0) || | ||
101 | (asprintf((char**)(envp + n_env++), "LOGNAME=%s", arg_user ? arg_user : "root") < 0)) { | ||
102 | log_oom(); | ||
103 | @@ -4266,7 +4266,7 @@ int main(int argc, char *argv[]) { | ||
104 | execvp(argv[optind], argv + optind); | ||
105 | #endif /* HAVE_EXECVPE */ | ||
106 | else { | ||
107 | - chdir(home ? home : "/root"); | ||
108 | + chdir(home ? home : ROOTHOMEDIR); | ||
109 | execle("/bin/bash", "-bash", NULL, env_use); | ||
110 | execle("/bin/sh", "-sh", NULL, env_use); | ||
111 | } | ||
112 | diff --git a/src/shared/util.c b/src/shared/util.c | ||
113 | index cbbe3b1..a0e3cc5 100644 | ||
114 | --- a/src/shared/util.c | ||
115 | +++ b/src/shared/util.c | ||
116 | @@ -4609,7 +4609,7 @@ int get_user_creds( | ||
117 | *gid = 0; | ||
118 | |||
119 | if (home) | ||
120 | - *home = "/root"; | ||
121 | + *home = ROOTHOMEDIR; | ||
122 | |||
123 | if (shell) | ||
124 | *shell = "/bin/sh"; | ||
125 | @@ -5611,7 +5611,7 @@ int get_home_dir(char **_h) { | ||
126 | /* Hardcode home directory for root to avoid NSS */ | ||
127 | u = getuid(); | ||
128 | if (u == 0) { | ||
129 | - h = strdup("/root"); | ||
130 | + h = strdup(ROOTHOMEDIR); | ||
131 | if (!h) | ||
132 | return -ENOMEM; | ||
133 | |||
134 | diff --git a/units/console-shell.service.m4.in b/units/console-shell.service.m4.in | ||
135 | index 5c80722..efde5f0 100644 | ||
136 | --- a/units/console-shell.service.m4.in | ||
137 | +++ b/units/console-shell.service.m4.in | ||
138 | @@ -15,8 +15,8 @@ After=rc-local.service | ||
139 | Before=getty.target | ||
140 | |||
141 | [Service] | ||
142 | -Environment=HOME=/root | ||
143 | -WorkingDirectory=/root | ||
144 | +Environment=HOME=@roothomedir@ | ||
145 | +WorkingDirectory=@roothomedir@ | ||
146 | ExecStart=-@SULOGIN@ | ||
147 | ExecStopPost=-@SYSTEMCTL@ poweroff | ||
148 | Type=idle | ||
149 | diff --git a/units/emergency.service.in b/units/emergency.service.in | ||
150 | index 2695d7b..7f47b73 100644 | ||
151 | --- a/units/emergency.service.in | ||
152 | +++ b/units/emergency.service.in | ||
153 | @@ -14,8 +14,8 @@ Conflicts=rescue.service | ||
154 | Before=shutdown.target | ||
155 | |||
156 | [Service] | ||
157 | -Environment=HOME=/root | ||
158 | -WorkingDirectory=/root | ||
159 | +Environment=HOME=@roothomedir@ | ||
160 | +WorkingDirectory=@roothomedir@ | ||
161 | ExecStartPre=-/bin/plymouth quit | ||
162 | 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.' | ||
163 | ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --fail --no-block default" | ||
164 | diff --git a/units/rescue.service.in b/units/rescue.service.in | ||
165 | index de73fee..47f3593 100644 | ||
166 | --- a/units/rescue.service.in | ||
167 | +++ b/units/rescue.service.in | ||
168 | @@ -14,8 +14,8 @@ After=sysinit.target plymouth-start.service | ||
169 | Before=shutdown.target | ||
170 | |||
171 | [Service] | ||
172 | -Environment=HOME=/root | ||
173 | -WorkingDirectory=/root | ||
174 | +Environment=HOME=@roothomedir@ | ||
175 | +WorkingDirectory=@roothomedir@ | ||
176 | ExecStartPre=-/bin/plymouth quit | ||
177 | 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.' | ||
178 | ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --fail --no-block default" | ||
179 | -- | ||
180 | 2.1.4 | ||
181 | |||