summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd/systemd/0014-Make-root-s-home-directory-configurable.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/systemd/systemd/0014-Make-root-s-home-directory-configurable.patch')
-rw-r--r--meta/recipes-core/systemd/systemd/0014-Make-root-s-home-directory-configurable.patch62
1 files changed, 30 insertions, 32 deletions
diff --git a/meta/recipes-core/systemd/systemd/0014-Make-root-s-home-directory-configurable.patch b/meta/recipes-core/systemd/systemd/0014-Make-root-s-home-directory-configurable.patch
index 4a576aa7d6..2eea0ff9a6 100644
--- a/meta/recipes-core/systemd/systemd/0014-Make-root-s-home-directory-configurable.patch
+++ b/meta/recipes-core/systemd/systemd/0014-Make-root-s-home-directory-configurable.patch
@@ -1,6 +1,3 @@
1From 786883cfa13e21f060ee6da6cabb94845f4349a0 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 14 Dec 2015 05:18:20 +0000
4Subject: [PATCH 14/36] Make root's home directory configurable 1Subject: [PATCH 14/36] Make root's home directory configurable
5 2
6OpenEmbedded has a configurable home directory for root. Allow 3OpenEmbedded has a configurable home directory for root. Allow
@@ -14,6 +11,7 @@ https://github.com/systemd/systemd/issues/541
14 11
15Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca> 12Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca>
16Signed-off-by: Khem Raj <raj.khem@gmail.com> 13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14
17--- 15---
18 Makefile.am | 2 ++ 16 Makefile.am | 2 ++
19 configure.ac | 7 +++++++ 17 configure.ac | 7 +++++++
@@ -26,10 +24,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
26 8 files changed, 20 insertions(+), 11 deletions(-) 24 8 files changed, 20 insertions(+), 11 deletions(-)
27 25
28diff --git a/Makefile.am b/Makefile.am 26diff --git a/Makefile.am b/Makefile.am
29index b3f3343..a99e8eb 100644 27index 305099a..88c1250 100644
30--- a/Makefile.am 28--- a/Makefile.am
31+++ b/Makefile.am 29+++ b/Makefile.am
32@@ -202,6 +202,7 @@ AM_CPPFLAGS = \ 30@@ -206,6 +206,7 @@ AM_CPPFLAGS = \
33 -DLIBDIR=\"$(libdir)\" \ 31 -DLIBDIR=\"$(libdir)\" \
34 -DROOTLIBDIR=\"$(rootlibdir)\" \ 32 -DROOTLIBDIR=\"$(rootlibdir)\" \
35 -DROOTLIBEXECDIR=\"$(rootlibexecdir)\" \ 33 -DROOTLIBEXECDIR=\"$(rootlibexecdir)\" \
@@ -37,7 +35,7 @@ index b3f3343..a99e8eb 100644
37 -DTEST_DIR=\"$(abs_top_srcdir)/test\" \ 35 -DTEST_DIR=\"$(abs_top_srcdir)/test\" \
38 -I $(top_srcdir)/src \ 36 -I $(top_srcdir)/src \
39 -I $(top_builddir)/src/basic \ 37 -I $(top_builddir)/src/basic \
40@@ -5713,6 +5714,7 @@ EXTRA_DIST += \ 38@@ -5863,6 +5864,7 @@ EXTRA_DIST += \
41 substitutions = \ 39 substitutions = \
42 '|rootlibexecdir=$(rootlibexecdir)|' \ 40 '|rootlibexecdir=$(rootlibexecdir)|' \
43 '|rootbindir=$(rootbindir)|' \ 41 '|rootbindir=$(rootbindir)|' \
@@ -46,10 +44,10 @@ index b3f3343..a99e8eb 100644
46 '|SYSTEMCTL=$(rootbindir)/systemctl|' \ 44 '|SYSTEMCTL=$(rootbindir)/systemctl|' \
47 '|SYSTEMD_NOTIFY=$(rootbindir)/systemd-notify|' \ 45 '|SYSTEMD_NOTIFY=$(rootbindir)/systemd-notify|' \
48diff --git a/configure.ac b/configure.ac 46diff --git a/configure.ac b/configure.ac
49index c5ab9d0..16c83bb 100644 47index 329861a..01764f5 100644
50--- a/configure.ac 48--- a/configure.ac
51+++ b/configure.ac 49+++ b/configure.ac
52@@ -1470,6 +1470,11 @@ AC_ARG_WITH([rootlibdir], 50@@ -1478,6 +1478,11 @@ AC_ARG_WITH([rootlibdir],
53 [with_rootlibdir=${libdir}]) 51 [with_rootlibdir=${libdir}])
54 AX_NORMALIZE_PATH([with_rootlibdir]) 52 AX_NORMALIZE_PATH([with_rootlibdir])
55 53
@@ -61,7 +59,7 @@ index c5ab9d0..16c83bb 100644
61 AC_ARG_WITH([pamlibdir], 59 AC_ARG_WITH([pamlibdir],
62 AS_HELP_STRING([--with-pamlibdir=DIR], [Directory for PAM modules]), 60 AS_HELP_STRING([--with-pamlibdir=DIR], [Directory for PAM modules]),
63 [], 61 [],
64@@ -1553,6 +1558,7 @@ AC_SUBST([pamlibdir], [$with_pamlibdir]) 62@@ -1562,6 +1567,7 @@ AC_SUBST([pamlibdir], [$with_pamlibdir])
65 AC_SUBST([pamconfdir], [$with_pamconfdir]) 63 AC_SUBST([pamconfdir], [$with_pamconfdir])
66 AC_SUBST([rootprefix], [$with_rootprefix]) 64 AC_SUBST([rootprefix], [$with_rootprefix])
67 AC_SUBST([rootlibdir], [$with_rootlibdir]) 65 AC_SUBST([rootlibdir], [$with_rootlibdir])
@@ -69,19 +67,19 @@ index c5ab9d0..16c83bb 100644
69 67
70 AC_CONFIG_FILES([ 68 AC_CONFIG_FILES([
71 Makefile 69 Makefile
72@@ -1643,6 +1649,7 @@ AC_MSG_RESULT([ 70@@ -1653,6 +1659,7 @@ AC_MSG_RESULT([
73 includedir: ${includedir} 71 includedir: ${includedir}
74 lib dir: ${libdir} 72 lib dir: ${libdir}
75 rootlib dir: ${with_rootlibdir} 73 rootlib dir: ${with_rootlibdir}
76+ root home dir: ${with_roothomedir} 74+ root home dir: ${with_roothomedir}
77 SysV init scripts: ${SYSTEM_SYSVINIT_PATH} 75 SysV init scripts: ${SYSTEM_SYSVINIT_PATH}
78 SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH} 76 SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH}
79 Build Python: ${PYTHON} 77 Build Python: ${PYTHON}
80diff --git a/src/basic/user-util.c b/src/basic/user-util.c 78diff --git a/src/basic/user-util.c b/src/basic/user-util.c
81index 19155bc..55672b3 100644 79index f65ca3e..da1101a 100644
82--- a/src/basic/user-util.c 80--- a/src/basic/user-util.c
83+++ b/src/basic/user-util.c 81+++ b/src/basic/user-util.c
84@@ -122,7 +122,7 @@ int get_user_creds( 82@@ -123,7 +123,7 @@ int get_user_creds(
85 *gid = 0; 83 *gid = 0;
86 84
87 if (home) 85 if (home)
@@ -90,7 +88,7 @@ index 19155bc..55672b3 100644
90 88
91 if (shell) 89 if (shell)
92 *shell = "/bin/sh"; 90 *shell = "/bin/sh";
93@@ -353,7 +353,7 @@ int get_home_dir(char **_h) { 91@@ -354,7 +354,7 @@ int get_home_dir(char **_h) {
94 /* Hardcode home directory for root to avoid NSS */ 92 /* Hardcode home directory for root to avoid NSS */
95 u = getuid(); 93 u = getuid();
96 if (u == 0) { 94 if (u == 0) {
@@ -100,10 +98,10 @@ index 19155bc..55672b3 100644
100 return -ENOMEM; 98 return -ENOMEM;
101 99
102diff --git a/src/core/namespace.c b/src/core/namespace.c 100diff --git a/src/core/namespace.c b/src/core/namespace.c
103index b573f00..0f70b14 100644 101index 203d122..45c0d11 100644
104--- a/src/core/namespace.c 102--- a/src/core/namespace.c
105+++ b/src/core/namespace.c 103+++ b/src/core/namespace.c
106@@ -409,7 +409,7 @@ int setup_namespace( 104@@ -415,7 +415,7 @@ int setup_namespace(
107 home_dir = strjoina("-", home_dir); 105 home_dir = strjoina("-", home_dir);
108 run_user_dir = prefix_roota(root_directory, "/run/user"); 106 run_user_dir = prefix_roota(root_directory, "/run/user");
109 run_user_dir = strjoina("-", run_user_dir); 107 run_user_dir = strjoina("-", run_user_dir);
@@ -113,24 +111,24 @@ index b573f00..0f70b14 100644
113 111
114 r = append_mounts(&m, STRV_MAKE(home_dir, run_user_dir, root_dir), 112 r = append_mounts(&m, STRV_MAKE(home_dir, run_user_dir, root_dir),
115diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c 113diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
116index 65e65ec..12f0ee8 100644 114index 8ec0584..51df00b 100644
117--- a/src/nspawn/nspawn.c 115--- a/src/nspawn/nspawn.c
118+++ b/src/nspawn/nspawn.c 116+++ b/src/nspawn/nspawn.c
119@@ -2564,7 +2564,7 @@ static int inner_child( 117@@ -2739,7 +2739,7 @@ static int inner_child(
120 if (envp[n_env]) 118 if (envp[n_env])
121 n_env ++; 119 n_env++;
122 120
123- if ((asprintf((char**)(envp + n_env++), "HOME=%s", home ? home: "/root") < 0) || 121- 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) || 122+ 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) || 123 (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)) 124 (asprintf((char**)(envp + n_env++), "LOGNAME=%s", arg_user ? arg_user : "root") < 0))
127 return log_oom(); 125 return log_oom();
128@@ -2647,7 +2647,7 @@ static int inner_child( 126@@ -2816,7 +2816,7 @@ static int inner_child(
129 #endif /* HAVE_EXECVPE */
130 else { 127 else {
131 if (!arg_chdir) 128 if (!arg_chdir)
132- chdir(home ?: "/root"); 129 /* If we cannot change the directory, we'll end up in /, that is expected. */
133+ chdir(home ?: ROOTHOMEDIR); 130- (void) chdir(home ?: "/root");
131+ (void) chdir(home ?: ROOTHOMEDIR);
134 132
135 execle("/bin/bash", "-bash", NULL, env_use); 133 execle("/bin/bash", "-bash", NULL, env_use);
136 execle("/bin/sh", "-sh", NULL, env_use); 134 execle("/bin/sh", "-sh", NULL, env_use);
@@ -150,10 +148,10 @@ index a345ec2..3caae7d 100644
150 ExecStopPost=-@SYSTEMCTL@ poweroff 148 ExecStopPost=-@SYSTEMCTL@ poweroff
151 Type=idle 149 Type=idle
152diff --git a/units/emergency.service.in b/units/emergency.service.in 150diff --git a/units/emergency.service.in b/units/emergency.service.in
153index fb390ea..5623a57 100644 151index 0de16f2..4826062 100644
154--- a/units/emergency.service.in 152--- a/units/emergency.service.in
155+++ b/units/emergency.service.in 153+++ b/units/emergency.service.in
156@@ -14,8 +14,8 @@ Conflicts=rescue.service 154@@ -15,8 +15,8 @@ Conflicts=syslog.socket
157 Before=shutdown.target 155 Before=shutdown.target
158 156
159 [Service] 157 [Service]
@@ -180,5 +178,5 @@ index 92553f6..590ae17 100644
180 ExecStartPre=-/bin/echo -e 'Welcome to rescue 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 ExecStartPre=-/bin/echo -e 'Welcome to rescue 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" 179 ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --job-mode=fail --no-block default"
182-- 180--
1831.8.3.1 1812.8.3
184 182