summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd/systemd/0001-Make-root-s-home-directory-configurable.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/systemd/systemd/0001-Make-root-s-home-directory-configurable.patch')
-rw-r--r--meta/recipes-core/systemd/systemd/0001-Make-root-s-home-directory-configurable.patch121
1 files changed, 59 insertions, 62 deletions
diff --git a/meta/recipes-core/systemd/systemd/0001-Make-root-s-home-directory-configurable.patch b/meta/recipes-core/systemd/systemd/0001-Make-root-s-home-directory-configurable.patch
index c5ad29174c..a86c8410df 100644
--- a/meta/recipes-core/systemd/systemd/0001-Make-root-s-home-directory-configurable.patch
+++ b/meta/recipes-core/systemd/systemd/0001-Make-root-s-home-directory-configurable.patch
@@ -21,11 +21,11 @@ Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca>
21 units/rescue.service.m4.in | 4 ++-- 21 units/rescue.service.m4.in | 4 ++--
22 8 files changed, 20 insertions(+), 11 deletions(-) 22 8 files changed, 20 insertions(+), 11 deletions(-)
23 23
24diff --git a/Makefile.am b/Makefile.am 24Index: git/Makefile.am
25index 4028112..5d18f5c 100644 25===================================================================
26--- a/Makefile.am 26--- git.orig/Makefile.am
27+++ b/Makefile.am 27+++ git/Makefile.am
28@@ -191,6 +191,7 @@ AM_CPPFLAGS = \ 28@@ -195,6 +195,7 @@ AM_CPPFLAGS = \
29 -DKEXEC=\"$(KEXEC)\" \ 29 -DKEXEC=\"$(KEXEC)\" \
30 -DLIBDIR=\"$(libdir)\" \ 30 -DLIBDIR=\"$(libdir)\" \
31 -DROOTLIBDIR=\"$(rootlibdir)\" \ 31 -DROOTLIBDIR=\"$(rootlibdir)\" \
@@ -33,7 +33,7 @@ index 4028112..5d18f5c 100644
33 -DTEST_DIR=\"$(abs_top_srcdir)/test\" \ 33 -DTEST_DIR=\"$(abs_top_srcdir)/test\" \
34 -I $(top_srcdir)/src \ 34 -I $(top_srcdir)/src \
35 -I $(top_builddir)/src/shared \ 35 -I $(top_builddir)/src/shared \
36@@ -5584,6 +5585,7 @@ EXTRA_DIST += \ 36@@ -5830,6 +5831,7 @@ EXTRA_DIST += \
37 substitutions = \ 37 substitutions = \
38 '|rootlibexecdir=$(rootlibexecdir)|' \ 38 '|rootlibexecdir=$(rootlibexecdir)|' \
39 '|rootbindir=$(rootbindir)|' \ 39 '|rootbindir=$(rootbindir)|' \
@@ -41,14 +41,14 @@ index 4028112..5d18f5c 100644
41 '|bindir=$(bindir)|' \ 41 '|bindir=$(bindir)|' \
42 '|SYSTEMCTL=$(rootbindir)/systemctl|' \ 42 '|SYSTEMCTL=$(rootbindir)/systemctl|' \
43 '|SYSTEMD_NOTIFY=$(rootbindir)/systemd-notify|' \ 43 '|SYSTEMD_NOTIFY=$(rootbindir)/systemd-notify|' \
44diff --git a/configure.ac b/configure.ac 44Index: git/configure.ac
45index 18b7198..365bc73 100644 45===================================================================
46--- a/configure.ac 46--- git.orig/configure.ac
47+++ b/configure.ac 47+++ git/configure.ac
48@@ -1272,6 +1272,11 @@ AC_ARG_WITH([rootlibdir], 48@@ -1310,6 +1310,11 @@ AC_ARG_WITH([rootlibdir],
49 [], 49 [],
50 [with_rootlibdir=${libdir}]) 50 [with_rootlibdir=${libdir}])
51 51
52+AC_ARG_WITH([roothomedir], 52+AC_ARG_WITH([roothomedir],
53+ AS_HELP_STRING([--with-roothomedir=DIR], [Home directory for the root user]), 53+ AS_HELP_STRING([--with-roothomedir=DIR], [Home directory for the root user]),
54+ [], 54+ [],
@@ -57,15 +57,15 @@ index 18b7198..365bc73 100644
57 AC_ARG_WITH([pamlibdir], 57 AC_ARG_WITH([pamlibdir],
58 AS_HELP_STRING([--with-pamlibdir=DIR], [Directory for PAM modules]), 58 AS_HELP_STRING([--with-pamlibdir=DIR], [Directory for PAM modules]),
59 [], 59 [],
60@@ -1317,6 +1322,7 @@ AC_SUBST([pamlibdir], [$with_pamlibdir]) 60@@ -1362,6 +1367,7 @@ AC_SUBST([pamlibdir], [$with_pamlibdir])
61 AC_SUBST([pamconfdir], [$with_pamconfdir]) 61 AC_SUBST([pamconfdir], [$with_pamconfdir])
62 AC_SUBST([rootprefix], [$with_rootprefix]) 62 AC_SUBST([rootprefix], [$with_rootprefix])
63 AC_SUBST([rootlibdir], [$with_rootlibdir]) 63 AC_SUBST([rootlibdir], [$with_rootlibdir])
64+AC_SUBST([roothomedir], [$with_roothomedir]) 64+AC_SUBST([roothomedir], [$with_roothomedir])
65 65
66 AC_CONFIG_FILES([ 66 AC_CONFIG_FILES([
67 Makefile po/Makefile.in 67 Makefile po/Makefile.in
68@@ -1400,6 +1406,7 @@ AC_MSG_RESULT([ 68@@ -1446,6 +1452,7 @@ AC_MSG_RESULT([
69 include_prefix: ${INCLUDE_PREFIX} 69 include_prefix: ${INCLUDE_PREFIX}
70 lib dir: ${libdir} 70 lib dir: ${libdir}
71 rootlib dir: ${with_rootlibdir} 71 rootlib dir: ${with_rootlibdir}
@@ -73,55 +73,55 @@ index 18b7198..365bc73 100644
73 SysV init scripts: ${SYSTEM_SYSVINIT_PATH} 73 SysV init scripts: ${SYSTEM_SYSVINIT_PATH}
74 SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH} 74 SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH}
75 Build Python: ${PYTHON} 75 Build Python: ${PYTHON}
76diff --git a/src/core/unit-printf.c b/src/core/unit-printf.c 76Index: git/src/core/unit-printf.c
77index 62599d0..852d34c 100644 77===================================================================
78--- a/src/core/unit-printf.c 78--- git.orig/src/core/unit-printf.c
79+++ b/src/core/unit-printf.c 79+++ git/src/core/unit-printf.c
80@@ -259,7 +259,7 @@ static int specifier_user_home(char specifier, void *data, void *userdata, char 80@@ -259,7 +259,7 @@ static int specifier_user_home(char spec
81 * best of it if we can, but fail if we can't */ 81 * best of it if we can, but fail if we can't */
82 82
83 if (!c->user || streq(c->user, "root") || streq(c->user, "0")) 83 if (!c->user || streq(c->user, "root") || streq(c->user, "0"))
84- n = strdup("/root"); 84- n = strdup("/root");
85+ n = strdup(ROOTHOMEDIR); 85+ n = strdup(ROOTHOMEDIR);
86 else 86 else
87 return -ENOTSUP; 87 return -ENOTSUP;
88 88
89diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c 89Index: git/src/nspawn/nspawn.c
90index d01da45..3e876d5 100644 90===================================================================
91--- a/src/nspawn/nspawn.c 91--- git.orig/src/nspawn/nspawn.c
92+++ b/src/nspawn/nspawn.c 92+++ git/src/nspawn/nspawn.c
93@@ -3312,7 +3312,7 @@ int main(int argc, char *argv[]) { 93@@ -3183,7 +3183,7 @@ int main(int argc, char *argv[]) {
94 if (r < 0) 94 if (r < 0)
95 _exit(EXIT_FAILURE); 95 _exit(EXIT_FAILURE);
96 96
97- if ((asprintf((char**)(envp + n_env++), "HOME=%s", home ? home: "/root") < 0) || 97- if ((asprintf((char**)(envp + n_env++), "HOME=%s", home ? home: "/root") < 0) ||
98+ if ((asprintf((char**)(envp + n_env++), "HOME=%s", home ? home: ROOTHOMEDIR) < 0) || 98+ if ((asprintf((char**)(envp + n_env++), "HOME=%s", home ? home: ROOTHOMEDIR) < 0) ||
99 (asprintf((char**)(envp + n_env++), "USER=%s", arg_user ? arg_user : "root") < 0) || 99 (asprintf((char**)(envp + n_env++), "USER=%s", arg_user ? arg_user : "root") < 0) ||
100 (asprintf((char**)(envp + n_env++), "LOGNAME=%s", arg_user ? arg_user : "root") < 0)) { 100 (asprintf((char**)(envp + n_env++), "LOGNAME=%s", arg_user ? arg_user : "root") < 0)) {
101 log_oom(); 101 log_oom();
102@@ -3402,7 +3402,7 @@ int main(int argc, char *argv[]) { 102@@ -3278,7 +3278,7 @@ int main(int argc, char *argv[]) {
103 } else if (argc > optind) 103 execvp(argv[optind], argv + optind);
104 execvpe(argv[optind], argv + optind, env_use); 104 #endif /* HAVE_EXECVPE */
105 else { 105 else {
106- chdir(home ? home : "/root"); 106- chdir(home ? home : "/root");
107+ chdir(home ? home : ROOTHOMEDIR); 107+ chdir(home ? home : ROOTHOMEDIR);
108 execle("/bin/bash", "-bash", NULL, env_use); 108 execle("/bin/bash", "-bash", NULL, env_use);
109 execle("/bin/sh", "-sh", NULL, env_use); 109 execle("/bin/sh", "-sh", NULL, env_use);
110 } 110 }
111diff --git a/src/shared/util.c b/src/shared/util.c 111Index: git/src/shared/util.c
112index 85a570a..aef6033 100644 112===================================================================
113--- a/src/shared/util.c 113--- git.orig/src/shared/util.c
114+++ b/src/shared/util.c 114+++ git/src/shared/util.c
115@@ -4377,7 +4377,7 @@ int get_user_creds( 115@@ -4523,7 +4523,7 @@ int get_user_creds(
116 *gid = 0; 116 *gid = 0;
117 117
118 if (home) 118 if (home)
119- *home = "/root"; 119- *home = "/root";
120+ *home = ROOTHOMEDIR; 120+ *home = ROOTHOMEDIR;
121 121
122 if (shell) 122 if (shell)
123 *shell = "/bin/sh"; 123 *shell = "/bin/sh";
124@@ -5363,7 +5363,7 @@ int get_home_dir(char **_h) { 124@@ -5491,7 +5491,7 @@ int get_home_dir(char **_h) {
125 /* Hardcode home directory for root to avoid NSS */ 125 /* Hardcode home directory for root to avoid NSS */
126 u = getuid(); 126 u = getuid();
127 if (u == 0) { 127 if (u == 0) {
@@ -129,14 +129,14 @@ index 85a570a..aef6033 100644
129+ h = strdup(ROOTHOMEDIR); 129+ h = strdup(ROOTHOMEDIR);
130 if (!h) 130 if (!h)
131 return -ENOMEM; 131 return -ENOMEM;
132 132
133diff --git a/units/console-shell.service.m4.in b/units/console-shell.service.m4.in 133Index: git/units/console-shell.service.m4.in
134index 3f4904a..e2af652 100644 134===================================================================
135--- a/units/console-shell.service.m4.in 135--- git.orig/units/console-shell.service.m4.in
136+++ b/units/console-shell.service.m4.in 136+++ git/units/console-shell.service.m4.in
137@@ -15,8 +15,8 @@ After=rc-local.service 137@@ -15,8 +15,8 @@ After=rc-local.service
138 Before=getty.target 138 Before=getty.target
139 139
140 [Service] 140 [Service]
141-Environment=HOME=/root 141-Environment=HOME=/root
142-WorkingDirectory=/root 142-WorkingDirectory=/root
@@ -145,36 +145,33 @@ index 3f4904a..e2af652 100644
145 ExecStart=-/sbin/sulogin 145 ExecStart=-/sbin/sulogin
146 ExecStopPost=-@SYSTEMCTL@ poweroff 146 ExecStopPost=-@SYSTEMCTL@ poweroff
147 Type=idle 147 Type=idle
148diff --git a/units/emergency.service.in b/units/emergency.service.in 148Index: git/units/emergency.service.in
149index 91fc1bb..659547e 100644 149===================================================================
150--- a/units/emergency.service.in 150--- git.orig/units/emergency.service.in
151+++ b/units/emergency.service.in 151+++ git/units/emergency.service.in
152@@ -13,8 +13,8 @@ Conflicts=shutdown.target 152@@ -14,8 +14,8 @@ Conflicts=rescue.service
153 Before=shutdown.target 153 Before=shutdown.target
154 154
155 [Service] 155 [Service]
156-Environment=HOME=/root 156-Environment=HOME=/root
157-WorkingDirectory=/root 157-WorkingDirectory=/root
158+Environment=HOME=@roothomedir@ 158+Environment=HOME=@roothomedir@
159+WorkingDirectory=@roothomedir@ 159+WorkingDirectory=@roothomedir@
160 ExecStartPre=-/bin/plymouth quit 160 ExecStartPre=-/bin/plymouth quit
161 ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" to try again\\nto boot into default mode.' 161 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.'
162 ExecStart=-/bin/sh -c "/sbin/sulogin; @SYSTEMCTL@ --fail --no-block default" 162 ExecStart=-/bin/sh -c "/sbin/sulogin; @SYSTEMCTL@ --fail --no-block default"
163diff --git a/units/rescue.service.m4.in b/units/rescue.service.m4.in 163Index: git/units/rescue.service.in
164index ef54369..7aad86f 100644 164===================================================================
165--- a/units/rescue.service.m4.in 165--- git.orig/units/rescue.service.in
166+++ b/units/rescue.service.m4.in 166+++ git/units/rescue.service.in
167@@ -14,8 +14,8 @@ After=sysinit.target plymouth-start.service 167@@ -14,8 +14,8 @@ After=sysinit.target plymouth-start.serv
168 Before=shutdown.target 168 Before=shutdown.target
169 169
170 [Service] 170 [Service]
171-Environment=HOME=/root 171-Environment=HOME=/root
172-WorkingDirectory=/root 172-WorkingDirectory=/root
173+Environment=HOME=@roothomedir@ 173+Environment=HOME=@roothomedir@
174+WorkingDirectory=@roothomedir@ 174+WorkingDirectory=@roothomedir@
175 ExecStartPre=-/bin/plymouth quit 175 ExecStartPre=-/bin/plymouth quit
176 ExecStartPre=-/bin/echo -e 'Welcome to rescue mode! Type "systemctl default" or ^D to enter default mode.\\nType "journalctl -xb" to view system logs. Type "systemctl reboot" to reboot.' 176 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.'
177 ExecStart=-/bin/sh -c "/sbin/sulogin; @SYSTEMCTL@ --fail --no-block default" 177 ExecStart=-/bin/sh -c "/sbin/sulogin; @SYSTEMCTL@ --fail --no-block default"
178--
1791.9.3
180