[systemd-commits] 4 commits - TODO man/systemd-nspawn.xml src/nspawn src/shared units/fsck-root.service.in units/serial-getty at .service.m4 units/systemd-modules-load.service.in
Lennart Poettering
lennart at kemper.freedesktop.org
Sun Apr 22 05:14:25 PDT 2012
TODO | 2 ++
man/systemd-nspawn.xml | 10 ++++++++++
src/nspawn/nspawn.c | 29 +++++++++++++++++++++++++++--
src/shared/util.c | 2 +-
src/shared/util.h | 2 ++
units/fsck-root.service.in | 1 +
units/serial-getty at .service.m4 | 2 +-
units/systemd-modules-load.service.in | 1 +
8 files changed, 45 insertions(+), 4 deletions(-)
New commits:
commit 5cd6eef69b926175b889799d80bd9deb33a904d1
Author: Lennart Poettering <lennart at poettering.net>
Date: Sun Apr 22 13:39:18 2012 +0200
units: don't try to load kernel modules if CAP_SYS_MODULE is missing
diff --git a/units/systemd-modules-load.service.in b/units/systemd-modules-load.service.in
index 72e1d70..243afad 100644
--- a/units/systemd-modules-load.service.in
+++ b/units/systemd-modules-load.service.in
@@ -11,6 +11,7 @@ DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-readahead-collect.service systemd-readahead-replay.service
Before=sysinit.target shutdown.target
+ConditionCapability=CAP_SYS_MODULE
ConditionDirectoryNotEmpty=|/lib/modules-load.d
ConditionDirectoryNotEmpty=|/usr/lib/modules-load.d
ConditionDirectoryNotEmpty=|/usr/local/lib/modules-load.d
commit 2c8049f3d31e4022845c1997a474925872ecea8f
Author: Lennart Poettering <lennart at poettering.net>
Date: Sun Apr 22 13:38:46 2012 +0200
units: skip root fsck if the root directory is writable
diff --git a/units/fsck-root.service.in b/units/fsck-root.service.in
index f2870bd..517dee7 100644
--- a/units/fsck-root.service.in
+++ b/units/fsck-root.service.in
@@ -13,6 +13,7 @@ Before=local-fs.target shutdown.target
# Dracut informs us with this flag file if the root fsck was already run
ConditionPathExists=!/run/initramfs/root-fsck
+ConditionPathIsReadWrite=!/
[Service]
Type=oneshot
commit 0f0dbc46ccf5aaaf3131446d0a4d78bc97a37295
Author: Lennart Poettering <lennart at poettering.net>
Date: Sun Apr 22 13:37:24 2012 +0200
nspawn: add -b switch to automatically look for an init binary
diff --git a/TODO b/TODO
index 62b5ebf..2569b41 100644
--- a/TODO
+++ b/TODO
@@ -21,6 +21,8 @@ Bugfixes:
Features:
+* fix utmp for console logins in containers
+
* Add pretty name for seats in logind
* nspawn wants dev_setup() for /dev/fd/ and friends?
diff --git a/man/systemd-nspawn.xml b/man/systemd-nspawn.xml
index f63f72c..28e5035 100644
--- a/man/systemd-nspawn.xml
+++ b/man/systemd-nspawn.xml
@@ -142,6 +142,16 @@
</varlistentry>
<varlistentry>
+ <term><option>--boot</option></term>
+ <term><option>-b</option></term>
+
+ <listitem><para>Automatically search
+ for an init binary and invoke it
+ instead of a shell or a user supplied
+ program.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>--user=</option></term>
<term><option>-u</option></term>
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 50f2c59..7050c05 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -56,6 +56,7 @@ static char *arg_directory = NULL;
static char *arg_user = NULL;
static char **arg_controllers = NULL;
static bool arg_private_network = false;
+static bool arg_boot = false;
static int help(void) {
@@ -63,6 +64,7 @@ static int help(void) {
"Spawn a minimal namespace container for debugging, testing and building.\n\n"
" -h --help Show this help\n"
" -D --directory=NAME Root directory for the container\n"
+ " -b --boot Boot up full system (i.e. invoke init)\n"
" -u --user=USER Run the command under specified user or uid\n"
" -C --controllers=LIST Put the container in specified comma-separated cgroup hierarchies\n"
" --private-network Disable network in container\n",
@@ -83,6 +85,7 @@ static int parse_argv(int argc, char *argv[]) {
{ "user", required_argument, NULL, 'u' },
{ "controllers", required_argument, NULL, 'C' },
{ "private-network", no_argument, NULL, ARG_PRIVATE_NETWORK },
+ { "boot", no_argument, NULL, 'b' },
{ NULL, 0, NULL, 0 }
};
@@ -91,7 +94,7 @@ static int parse_argv(int argc, char *argv[]) {
assert(argc >= 0);
assert(argv);
- while ((c = getopt_long(argc, argv, "+hD:u:C:", options, NULL)) >= 0) {
+ while ((c = getopt_long(argc, argv, "+hD:u:C:b", options, NULL)) >= 0) {
switch (c) {
@@ -133,6 +136,10 @@ static int parse_argv(int argc, char *argv[]) {
arg_private_network = true;
break;
+ case 'b':
+ arg_boot = true;
+ break;
+
case '?':
return -EINVAL;
@@ -1024,7 +1031,25 @@ int main(int argc, char *argv[]) {
setup_hostname();
- if (argc > optind)
+ if (arg_boot) {
+ char **a;
+ size_t l;
+
+ /* Automatically search for the init system */
+
+ l = 1 + argc - optind;
+ a = newa(char*, l + 1);
+ memcpy(a + 1, argv + optind, l * sizeof(char*));
+
+ a[0] = (char*) "/usr/lib/systemd/systemd";
+ execve(a[0], a, (char**) envp);
+
+ a[0] = (char*) "/lib/systemd/systemd";
+ execve(a[0], a, (char**) envp);
+
+ a[0] = (char*) "/sbin/init";
+ execve(a[0], a, (char**) envp);
+ } else if (argc > optind)
execvpe(argv[optind], argv + optind, (char**) envp);
else {
chdir(home ? home : "/root");
diff --git a/src/shared/util.h b/src/shared/util.h
index 35ba005..a26c1d9 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -100,6 +100,8 @@ bool streq_ptr(const char *a, const char *b);
#define new0(t, n) ((t*) calloc((n), sizeof(t)))
+#define newa(t, n) ((t*) alloca(sizeof(t)*(n)))
+
#define newdup(t, p, n) ((t*) memdup(p, sizeof(t)*(n))
#define malloc0(n) (calloc((n), 1))
commit acda6a054fb131dbab9b7b16e4148e05a03ce66b
Author: Lennart Poettering <lennart at poettering.net>
Date: Sun Apr 22 02:45:39 2012 +0200
default to v102 everywhere, instead of vt100, to synchronize with agetty
diff --git a/src/shared/util.c b/src/shared/util.c
index def576d..317abb8 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -4352,7 +4352,7 @@ bool tty_is_vc_resolve(const char *tty) {
const char *default_term_for_tty(const char *tty) {
assert(tty);
- return tty_is_vc_resolve(tty) ? "TERM=linux" : "TERM=vt100";
+ return tty_is_vc_resolve(tty) ? "TERM=linux" : "TERM=vt102";
}
bool dirent_is_file(const struct dirent *de) {
diff --git a/units/serial-getty at .service.m4 b/units/serial-getty at .service.m4
index ed6912d..93bc643 100644
--- a/units/serial-getty at .service.m4
+++ b/units/serial-getty at .service.m4
@@ -35,7 +35,7 @@ Before=getty.target
IgnoreOnIsolate=yes
[Service]
-Environment=TERM=vt100
+Environment=TERM=vt102
ExecStart=-/sbin/agetty -s %I 115200,38400,9600
Restart=always
RestartSec=0
More information about the systemd-commits
mailing list