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