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 @@ +From 3dc731c1d270e2e143de621db9bd898299fd849d Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 20 Feb 2015 05:24:49 +0000 +Subject: [PATCH 10/11] Make root's home directory configurable + +OpenEmbedded has a configurable home directory for root. Allow +systemd to be built using its idea of what root's home directory +should be. + +Upstream-Status: Pending + +Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca> +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + Makefile.am | 2 ++ + configure.ac | 7 +++++++ + src/core/unit-printf.c | 2 +- + src/nspawn/nspawn.c | 4 ++-- + src/shared/util.c | 4 ++-- + units/console-shell.service.m4.in | 4 ++-- + units/emergency.service.in | 4 ++-- + units/rescue.service.in | 4 ++-- + 8 files changed, 20 insertions(+), 11 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 0fb3f9f..4623963 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -199,6 +199,7 @@ AM_CPPFLAGS = \ + -DKEXEC=\"$(KEXEC)\" \ + -DLIBDIR=\"$(libdir)\" \ + -DROOTLIBDIR=\"$(rootlibdir)\" \ ++ -DROOTHOMEDIR=\"$(roothomedir)\" \ + -DTEST_DIR=\"$(abs_top_srcdir)/test\" \ + -I $(top_srcdir)/src \ + -I $(top_builddir)/src/shared \ +@@ -6342,6 +6343,7 @@ EXTRA_DIST += \ + substitutions = \ + '|rootlibexecdir=$(rootlibexecdir)|' \ + '|rootbindir=$(rootbindir)|' \ ++ '|roothomedir=$(roothomedir)|' \ + '|bindir=$(bindir)|' \ + '|SYSTEMCTL=$(rootbindir)/systemctl|' \ + '|SYSTEMD_NOTIFY=$(rootbindir)/systemd-notify|' \ +diff --git a/configure.ac b/configure.ac +index a5b2e6e..55bb7d8 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1428,6 +1428,11 @@ AC_ARG_WITH([rootlibdir], + [], + [with_rootlibdir=${libdir}]) + ++AC_ARG_WITH([roothomedir], ++ AS_HELP_STRING([--with-roothomedir=DIR], [Home directory for the root user]), ++ [], ++ [with_roothomedir=/root]) ++ + AC_ARG_WITH([pamlibdir], + AS_HELP_STRING([--with-pamlibdir=DIR], [Directory for PAM modules]), + [], +@@ -1518,6 +1523,7 @@ AC_SUBST([pamlibdir], [$with_pamlibdir]) + AC_SUBST([pamconfdir], [$with_pamconfdir]) + AC_SUBST([rootprefix], [$with_rootprefix]) + AC_SUBST([rootlibdir], [$with_rootlibdir]) ++AC_SUBST([roothomedir], [$with_roothomedir]) + + AC_CONFIG_FILES([ + Makefile po/Makefile.in +@@ -1617,6 +1623,7 @@ AC_MSG_RESULT([ + include_prefix: ${INCLUDE_PREFIX} + lib dir: ${libdir} + rootlib dir: ${with_rootlibdir} ++ root home dir: ${with_roothomedir} + SysV init scripts: ${SYSTEM_SYSVINIT_PATH} + SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH} + Build Python: ${PYTHON} +diff --git a/src/core/unit-printf.c b/src/core/unit-printf.c +index 97135db..14d12f1 100644 +--- a/src/core/unit-printf.c ++++ b/src/core/unit-printf.c +@@ -259,7 +259,7 @@ static int specifier_user_home(char specifier, void *data, void *userdata, char + * best of it if we can, but fail if we can't */ + + if (!c->user || streq(c->user, "root") || streq(c->user, "0")) +- n = strdup("/root"); ++ n = strdup(ROOTHOMEDIR); + else + return -ENOTSUP; + +diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c +index b597edb..0b32673 100644 +--- a/src/nspawn/nspawn.c ++++ b/src/nspawn/nspawn.c +@@ -4192,7 +4192,7 @@ int main(int argc, char *argv[]) { + if (r < 0) + _exit(EXIT_FAILURE); + +- if ((asprintf((char**)(envp + n_env++), "HOME=%s", home ? home: "/root") < 0) || ++ if ((asprintf((char**)(envp + n_env++), "HOME=%s", home ? home: ROOTHOMEDIR) < 0) || + (asprintf((char**)(envp + n_env++), "USER=%s", arg_user ? arg_user : "root") < 0) || + (asprintf((char**)(envp + n_env++), "LOGNAME=%s", arg_user ? arg_user : "root") < 0)) { + log_oom(); +@@ -4266,7 +4266,7 @@ int main(int argc, char *argv[]) { + execvp(argv[optind], argv + optind); + #endif /* HAVE_EXECVPE */ + else { +- chdir(home ? home : "/root"); ++ chdir(home ? home : ROOTHOMEDIR); + execle("/bin/bash", "-bash", NULL, env_use); + execle("/bin/sh", "-sh", NULL, env_use); + } +diff --git a/src/shared/util.c b/src/shared/util.c +index cbbe3b1..a0e3cc5 100644 +--- a/src/shared/util.c ++++ b/src/shared/util.c +@@ -4609,7 +4609,7 @@ int get_user_creds( + *gid = 0; + + if (home) +- *home = "/root"; ++ *home = ROOTHOMEDIR; + + if (shell) + *shell = "/bin/sh"; +@@ -5611,7 +5611,7 @@ int get_home_dir(char **_h) { + /* Hardcode home directory for root to avoid NSS */ + u = getuid(); + if (u == 0) { +- h = strdup("/root"); ++ h = strdup(ROOTHOMEDIR); + if (!h) + return -ENOMEM; + +diff --git a/units/console-shell.service.m4.in b/units/console-shell.service.m4.in +index 5c80722..efde5f0 100644 +--- a/units/console-shell.service.m4.in ++++ b/units/console-shell.service.m4.in +@@ -15,8 +15,8 @@ After=rc-local.service + Before=getty.target + + [Service] +-Environment=HOME=/root +-WorkingDirectory=/root ++Environment=HOME=@roothomedir@ ++WorkingDirectory=@roothomedir@ + ExecStart=-@SULOGIN@ + ExecStopPost=-@SYSTEMCTL@ poweroff + Type=idle +diff --git a/units/emergency.service.in b/units/emergency.service.in +index 2695d7b..7f47b73 100644 +--- a/units/emergency.service.in ++++ b/units/emergency.service.in +@@ -14,8 +14,8 @@ Conflicts=rescue.service + Before=shutdown.target + + [Service] +-Environment=HOME=/root +-WorkingDirectory=/root ++Environment=HOME=@roothomedir@ ++WorkingDirectory=@roothomedir@ + ExecStartPre=-/bin/plymouth quit + 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.' + ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --fail --no-block default" +diff --git a/units/rescue.service.in b/units/rescue.service.in +index de73fee..47f3593 100644 +--- a/units/rescue.service.in ++++ b/units/rescue.service.in +@@ -14,8 +14,8 @@ After=sysinit.target plymouth-start.service + Before=shutdown.target + + [Service] +-Environment=HOME=/root +-WorkingDirectory=/root ++Environment=HOME=@roothomedir@ ++WorkingDirectory=@roothomedir@ + ExecStartPre=-/bin/plymouth quit + 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.' + ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --fail --no-block default" +-- +2.1.4 + |