summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd/systemd/0013-Make-root-s-home-directory-configurable.patch
diff options
context:
space:
mode:
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.patch155
1 files changed, 0 insertions, 155 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
deleted file mode 100644
index aeebbfb8fe..0000000000
--- a/meta/recipes-core/systemd/systemd/0013-Make-root-s-home-directory-configurable.patch
+++ /dev/null
@@ -1,155 +0,0 @@
1From 479e1f4aa2b9f1c911a4d0dd18e222d241a978ea Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 9 Nov 2016 20:35:30 -0800
4Subject: [PATCH 42/48] Make root's home directory configurable
5
6OpenEmbedded has a configurable home directory for root. Allow
7systemd to be built using its idea of what root's home directory
8should be.
9
10Upstream-Status: Denied
11Upstream wants to have a unified hierarchy where everyone is
12using the same root folder.
13https://github.com/systemd/systemd/issues/541
14
15Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca>
16Signed-off-by: Khem Raj <raj.khem@gmail.com>
17
18---
19 Makefile.am | 2 ++
20 configure.ac | 7 +++++++
21 src/basic/user-util.c | 4 ++--
22 src/nspawn/nspawn.c | 4 ++--
23 units/emergency.service.in | 4 ++--
24 units/rescue.service.in | 4 ++--
25 6 files changed, 17 insertions(+), 8 deletions(-)
26
27diff --git a/Makefile.am b/Makefile.am
28index 1bcd932c2..c2b4a99d2 100644
29--- a/Makefile.am
30+++ b/Makefile.am
31@@ -226,6 +226,7 @@ AM_CPPFLAGS = \
32 -DLIBDIR=\"$(libdir)\" \
33 -DROOTLIBDIR=\"$(rootlibdir)\" \
34 -DROOTLIBEXECDIR=\"$(rootlibexecdir)\" \
35+ -DROOTHOMEDIR=\"$(roothomedir)\" \
36 -I $(top_srcdir)/src \
37 -I $(top_builddir)/src/basic \
38 -I $(top_srcdir)/src/basic \
39@@ -6356,6 +6357,7 @@ substitutions = \
40 '|rootlibdir=$(rootlibdir)|' \
41 '|rootlibexecdir=$(rootlibexecdir)|' \
42 '|rootbindir=$(rootbindir)|' \
43+ '|roothomedir=$(roothomedir)|' \
44 '|bindir=$(bindir)|' \
45 '|SYSTEMCTL=$(rootbindir)/systemctl|' \
46 '|SYSTEMD_NOTIFY=$(rootbindir)/systemd-notify|' \
47diff --git a/configure.ac b/configure.ac
48index 0354ffe6a..b53ca1f1a 100644
49--- a/configure.ac
50+++ b/configure.ac
51@@ -1641,6 +1641,11 @@ AC_ARG_WITH([rootlibdir],
52 [with_rootlibdir=${libdir}])
53 AX_NORMALIZE_PATH([with_rootlibdir])
54
55+AC_ARG_WITH([roothomedir],
56+ AS_HELP_STRING([--with-roothomedir=DIR], [Home directory for the root user]),
57+ [],
58+ [with_roothomedir=/root])
59+
60 AC_ARG_WITH([pamlibdir],
61 AS_HELP_STRING([--with-pamlibdir=DIR], [directory for PAM modules]),
62 [],
63@@ -1733,6 +1738,7 @@ AC_SUBST([pamconfdir], [$with_pamconfdir])
64 AC_SUBST([rpmmacrosdir], [$with_rpmmacrosdir])
65 AC_SUBST([rootprefix], [$with_rootprefix])
66 AC_SUBST([rootlibdir], [$with_rootlibdir])
67+AC_SUBST([roothomedir], [$with_roothomedir])
68
69 AC_CONFIG_FILES([
70 Makefile
71@@ -1829,6 +1835,7 @@ AC_MSG_RESULT([
72 includedir: ${includedir}
73 lib dir: ${libdir}
74 rootlib dir: ${with_rootlibdir}
75+ root home dir: ${with_roothomedir}
76 SysV init scripts: ${SYSTEM_SYSVINIT_PATH}
77 SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH}
78 build Python: ${PYTHON}
79diff --git a/src/basic/user-util.c b/src/basic/user-util.c
80index c619dad52..662682adf 100644
81--- a/src/basic/user-util.c
82+++ b/src/basic/user-util.c
83@@ -129,7 +129,7 @@ int get_user_creds(
84 *gid = 0;
85
86 if (home)
87- *home = "/root";
88+ *home = ROOTHOMEDIR;
89
90 if (shell)
91 *shell = "/bin/sh";
92@@ -389,7 +389,7 @@ int get_home_dir(char **_h) {
93 /* Hardcode home directory for root to avoid NSS */
94 u = getuid();
95 if (u == 0) {
96- h = strdup("/root");
97+ h = strdup(ROOTHOMEDIR);
98 if (!h)
99 return -ENOMEM;
100
101diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
102index 8a5fedd4b..7b01ec078 100644
103--- a/src/nspawn/nspawn.c
104+++ b/src/nspawn/nspawn.c
105@@ -2291,7 +2291,7 @@ static int inner_child(
106 if (envp[n_env])
107 n_env++;
108
109- if ((asprintf((char**)(envp + n_env++), "HOME=%s", home ? home: "/root") < 0) ||
110+ if ((asprintf((char**)(envp + n_env++), "HOME=%s", home ? home: ROOTHOMEDIR) < 0) ||
111 (asprintf((char**)(envp + n_env++), "USER=%s", arg_user ? arg_user : "root") < 0) ||
112 (asprintf((char**)(envp + n_env++), "LOGNAME=%s", arg_user ? arg_user : "root") < 0))
113 return log_oom();
114@@ -2373,7 +2373,7 @@ static int inner_child(
115 } else {
116 if (!arg_chdir)
117 /* If we cannot change the directory, we'll end up in /, that is expected. */
118- (void) chdir(home ?: "/root");
119+ (void) chdir(home ?: ROOTHOMEDIR);
120
121 execle("/bin/bash", "-bash", NULL, env_use);
122 execle("/bin/sh", "-sh", NULL, env_use);
123diff --git a/units/emergency.service.in b/units/emergency.service.in
124index e9eb238b9..32588e48a 100644
125--- a/units/emergency.service.in
126+++ b/units/emergency.service.in
127@@ -15,8 +15,8 @@ Conflicts=syslog.socket
128 Before=shutdown.target
129
130 [Service]
131-Environment=HOME=/root
132-WorkingDirectory=-/root
133+Environment=HOME=@roothomedir@
134+WorkingDirectory=-@roothomedir@
135 ExecStart=-@rootlibexecdir@/systemd-sulogin-shell emergency
136 Type=idle
137 StandardInput=tty-force
138diff --git a/units/rescue.service.in b/units/rescue.service.in
139index 4ab66f485..bd9898f2c 100644
140--- a/units/rescue.service.in
141+++ b/units/rescue.service.in
142@@ -14,8 +14,8 @@ After=sysinit.target plymouth-start.service
143 Before=shutdown.target
144
145 [Service]
146-Environment=HOME=/root
147-WorkingDirectory=-/root
148+Environment=HOME=@roothomedir@
149+WorkingDirectory=-@roothomedir@
150 ExecStart=-@rootlibexecdir@/systemd-sulogin-shell rescue
151 Type=idle
152 StandardInput=tty-force
153--
1542.13.2
155