[systemd-commits] 12 commits - man/hostnamectl.xml man/localectl.xml man/loginctl.xml man/machinectl.xml man/systemctl.xml man/systemd-analyze.xml man/systemd-halt.service.xml man/systemd.mount.xml man/systemd-run.xml man/systemd.service.xml man/systemd-socket-proxyd.xml man/systemd.socket.xml man/systemd.swap.xml man/systemd-system.conf.xml man/timedatectl.xml shell-completion/zsh src/core src/python-systemd src/shared src/systemctl src/test src/udev test/TEST-01-BASIC test/TEST-02-CRYPTSETUP test/TEST-03-JOBS test/test-functions TODO
Zbigniew JÄdrzejewski-Szmek
zbyszek at kemper.freedesktop.org
Thu Nov 7 07:24:38 CET 2013
TODO | 2
man/hostnamectl.xml | 2
man/localectl.xml | 2
man/loginctl.xml | 2
man/machinectl.xml | 6
man/systemctl.xml | 20 ++
man/systemd-analyze.xml | 4
man/systemd-halt.service.xml | 10 +
man/systemd-run.xml | 4
man/systemd-socket-proxyd.xml | 2
man/systemd-system.conf.xml | 6
man/systemd.mount.xml | 4
man/systemd.service.xml | 6
man/systemd.socket.xml | 2
man/systemd.swap.xml | 2
man/timedatectl.xml | 2
shell-completion/zsh/_systemd-run | 17 ++
src/core/shutdown.c | 15 +-
src/python-systemd/journal.py | 2
src/shared/acpi-fpdt.c | 2
src/shared/def.h | 2
src/shared/sleep-config.c | 2
src/systemctl/systemctl.c | 49 +++++--
src/test/test-strv.c | 49 +++++++
src/udev/udevadm-settle.c | 24 ++-
src/udev/udevadm-trigger.c | 17 ++
test/TEST-01-BASIC/test.sh | 190 +---------------------------
test/TEST-02-CRYPTSETUP/test.sh | 192 ++--------------------------
test/TEST-03-JOBS/test.sh | 184 +--------------------------
test/test-functions | 254 ++++++++++++++++++++++++++++++++++++++
30 files changed, 489 insertions(+), 586 deletions(-)
New commits:
commit aed2ebfed00acdc5db1542be499f6a0d71a76f08
Author: Daniel Buch <boogiewasthere at gmail.com>
Date: Thu Oct 31 10:03:08 2013 +0100
test-strv: add strv_split, strv_split_newline, strv_remove_prefix
diff --git a/src/test/test-strv.c b/src/test/test-strv.c
index f32d02e..e468859 100644
--- a/src/test/test-strv.c
+++ b/src/test/test-strv.c
@@ -156,6 +156,36 @@ static void test_strv_quote_unquote(const char* const *split, const char *quoted
}
}
+static void test_strv_split(void) {
+ char **s;
+ unsigned i = 0;
+ _cleanup_strv_free_ char **l = NULL;
+ const char str[] = "one,two,three";
+
+ l = strv_split(str, ",");
+
+ assert(l);
+
+ STRV_FOREACH(s, l) {
+ assert_se(streq(*s, input_table_multiple[i++]));
+ }
+}
+
+static void test_strv_split_newlines(void) {
+ unsigned i = 0;
+ char **s;
+ _cleanup_strv_free_ char **l = NULL;
+ const char str[] = "one\ntwo\nthree";
+
+ l = strv_split_newlines(str);
+
+ assert(l);
+
+ STRV_FOREACH(s, l) {
+ assert_se(streq(*s, input_table_multiple[i++]));
+ }
+}
+
static void test_strv_split_nulstr(void) {
_cleanup_strv_free_ char **l = NULL;
const char nulstr[] = "str0\0str1\0str2\0str3\0";
@@ -169,6 +199,22 @@ static void test_strv_split_nulstr(void) {
assert_se(streq(l[3], "str3"));
}
+static void test_strv_remove_prefix(void) {
+ unsigned i = 0;
+ char **s;
+ _cleanup_strv_free_ char **l = NULL;
+
+ l = strv_new("_one", "_two", "_three", NULL);
+ assert(l);
+
+ l = strv_remove_prefix(l, "_");
+ assert(l);
+
+ STRV_FOREACH(s, l) {
+ assert_se(streq(*s, input_table_multiple[i++]));
+ }
+}
+
static void test_strv_parse_nulstr(void) {
_cleanup_strv_free_ char **l = NULL;
const char nulstr[] = "fuck\0fuck2\0fuck3\0\0fuck5\0\0xxx";
@@ -359,8 +405,11 @@ int main(int argc, char *argv[]) {
test_strv_quote_unquote(input_table_quotes, QUOTES_STRING);
test_strv_quote_unquote(input_table_spaces, SPACES_STRING);
+ test_strv_split();
+ test_strv_split_newlines();
test_strv_split_nulstr();
test_strv_parse_nulstr();
+ test_strv_remove_prefix();
test_strv_overlap();
test_strv_sort();
test_strv_merge();
commit 0c6f1f4ea4980ff719979d36f10bd6ea3e464c02
Author: Jan Janssen <medhefgo at web.de>
Date: Thu Oct 31 17:22:03 2013 +0100
Make hibernation test work for swap files
Suspend to disk works for swap files too (even if it is located
on an ecrypted file system):
https://www.kernel.org/doc/Documentation/power/swsusp-and-swap-files.txt
diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c
index d068bfc..2bb0493 100644
--- a/src/shared/sleep-config.c
+++ b/src/shared/sleep-config.c
@@ -206,7 +206,7 @@ static int hibernation_partition_size(size_t *size, size_t *used) {
if (!d)
return -ENOMEM;
- if (!streq(type, "partition")) {
+ if (!streq(type, "partition") && !streq(type, "file")) {
log_debug("Partition %s has type %s, ignoring.", d, type);
continue;
}
commit f49e8bc4722aa581f655f81b87608709b6bcda38
Author: Ronny Chevalier <chevalier.ronny at gmail.com>
Date: Thu Oct 31 20:46:29 2013 +0100
zsh-completion: add missing options for systemd-run
diff --git a/shell-completion/zsh/_systemd-run b/shell-completion/zsh/_systemd-run
index 0c81c54..4bfbd19 100644
--- a/shell-completion/zsh/_systemd-run
+++ b/shell-completion/zsh/_systemd-run
@@ -18,10 +18,27 @@ __slices () {
_describe 'slices' _slices
}
+__get_machines () {
+ machinectl --full --no-pager list | {while read -r a b; do echo $a; done;};
+}
+
+__machines () {
+ local -a _machines
+ _machines=("${(fo)$(__get_machines)}")
+ typeset -U _machines
+ if [[ -n "$_machines" ]]; then
+ _describe 'machines' _machines
+ else
+ _message 'no machines'
+ fi
+}
+
_arguments \
{-h,--help}'[Show help message]' \
'--version[Show package version]' \
'--user[Run as user unit]' \
+ {-H+,--host=}'[Operate on remote host]:[user@]host:_sd_hosts_or_user_at_host' \
+ {-M+,--machine=}'[Operate on local container]:machines:__machines' \
'--scope[Run this as scope rather than service]' \
'--unit=[Run under the specified unit name]:unit name' \
'--description=[Description for unit]:description' \
commit c5383e7942e5d7323406feec2f35ff25a7771919
Author: Yang Zhiyong <yangzy.fnst at cn.fujitsu.com>
Date: Sun Nov 3 19:50:58 2013 +0800
udevadm-trigger: add parameters checking
diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c
index f472996..d10ca59 100644
--- a/src/udev/udevadm-trigger.c
+++ b/src/udev/udevadm-trigger.c
@@ -32,6 +32,7 @@
#include <sys/un.h>
#include "udev.h"
+#include "util.h"
static int verbose;
static int dry_run;
@@ -111,8 +112,14 @@ static int adm_trigger(struct udev *udev, int argc, char *argv[])
char buf[UTIL_PATH_SIZE];
option = getopt_long(argc, argv, "vng:o:t:hc:p:s:S:a:A:y:b:", options, NULL);
- if (option == -1)
+ if (option == -1) {
+ if (optind < argc) {
+ fprintf(stderr, "Extraneous argument: '%s'\n", argv[optind]);
+ rc = 1;
+ goto exit;
+ }
break;
+ }
switch (option) {
case 'v':
@@ -133,7 +140,13 @@ static int adm_trigger(struct udev *udev, int argc, char *argv[])
}
break;
case 'c':
- action = optarg;
+ if (!nulstr_contains("add\0" "remove\0" "change\0", optarg)) {
+ log_error("unknown action '%s'\n", optarg);
+ rc = 2;
+ goto exit;
+ } else {
+ action = optarg;
+ }
break;
case 's':
udev_enumerate_add_match_subsystem(udev_enumerate, optarg);
commit 4e93793da8919a10adc9c96eb82f47c6b134abf2
Author: Yang Zhiyong <yangzy.fnst at cn.fujitsu.com>
Date: Mon Nov 4 11:26:07 2013 +0800
udevadm-settle: add parameters checking
diff --git a/src/udev/udevadm-settle.c b/src/udev/udevadm-settle.c
index c4fc4ee..65508d8 100644
--- a/src/udev/udevadm-settle.c
+++ b/src/udev/udevadm-settle.c
@@ -35,6 +35,7 @@
#include <sys/types.h>
#include "udev.h"
+#include "util.h"
static int adm_settle(struct udev *udev, int argc, char *argv[])
{
@@ -59,11 +60,15 @@ static int adm_settle(struct udev *udev, int argc, char *argv[])
for (;;) {
int option;
- int seconds;
option = getopt_long(argc, argv, "s:e:t:E:qh", options, NULL);
- if (option == -1)
+ if (option == -1) {
+ if (optind < argc) {
+ fprintf(stderr, "Extraneous argument: '%s'\n", argv[optind]);
+ exit(EXIT_FAILURE);
+ }
break;
+ }
switch (option) {
case 's':
@@ -72,12 +77,15 @@ static int adm_settle(struct udev *udev, int argc, char *argv[])
case 'e':
end = strtoull(optarg, NULL, 0);
break;
- case 't':
- seconds = atoi(optarg);
- if (seconds >= 0)
- timeout = seconds;
- else
- fprintf(stderr, "invalid timeout value\n");
+ case 't': {
+ int r;
+
+ r = safe_atou(optarg, &timeout);
+ if (r < 0) {
+ fprintf(stderr, "Invalid timeout value '%s': %s\n",
+ optarg, strerror(-r));
+ exit(EXIT_FAILURE);
+ };
break;
case 'q':
quiet = 1;
commit a1074881b43416018aef2fb8f62ef62f92f0bae7
Author: Mantas MikulÄnas <grawity at gmail.com>
Date: Mon Nov 4 23:01:17 2013 +0200
systemctl: make LOAD column width dynamic
Otherwise 'not-found' overflows into the ACTIVE column.
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 6170cc9..b75f335 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -289,14 +289,16 @@ static bool output_show_unit(const struct unit_info *u) {
}
static void output_units_list(const struct unit_info *unit_infos, unsigned c) {
- unsigned id_len, max_id_len, active_len, sub_len, job_len, desc_len, n_shown = 0;
+ unsigned id_len, max_id_len, load_len, active_len, sub_len, job_len, desc_len;
+ unsigned n_shown = 0;
const struct unit_info *u;
int job_count = 0;
- max_id_len = sizeof("UNIT")-1;
- active_len = sizeof("ACTIVE")-1;
- sub_len = sizeof("SUB")-1;
- job_len = sizeof("JOB")-1;
+ max_id_len = strlen("UNIT");
+ load_len = strlen("LOAD");
+ active_len = strlen("ACTIVE");
+ sub_len = strlen("SUB");
+ job_len = strlen("JOB");
desc_len = 0;
for (u = unit_infos; u < unit_infos + c; u++) {
@@ -304,6 +306,7 @@ static void output_units_list(const struct unit_info *unit_infos, unsigned c) {
continue;
max_id_len = MAX(max_id_len, strlen(u->id));
+ load_len = MAX(load_len, strlen(u->load_state));
active_len = MAX(active_len, strlen(u->active_state));
sub_len = MAX(sub_len, strlen(u->sub_state));
if (u->job_id != 0) {
@@ -346,7 +349,7 @@ static void output_units_list(const struct unit_info *unit_infos, unsigned c) {
continue;
if (!n_shown && !arg_no_legend) {
- printf("%-*s %-6s %-*s %-*s ", id_len, "UNIT", "LOAD",
+ printf("%-*s %-*s %-*s %-*s ", id_len, "UNIT", load_len, "LOAD",
active_len, "ACTIVE", sub_len, "SUB");
if (job_count)
printf("%-*s ", job_len, "JOB");
@@ -373,9 +376,9 @@ static void output_units_list(const struct unit_info *unit_infos, unsigned c) {
e = arg_full ? NULL : ellipsize(u->id, id_len, 33);
- printf("%s%-*s%s %s%-6s%s %s%-*s %-*s%s %-*s",
+ printf("%s%-*s%s %s%-*s%s %s%-*s %-*s%s %-*s",
on, id_len, e ? e : u->id, off,
- on_loaded, u->load_state, off_loaded,
+ on_loaded, load_len, u->load_state, off_loaded,
on_active, active_len, u->active_state,
sub_len, u->sub_state, off_active,
job_count ? job_len + 1 : 0, u->job_id ? u->job_type : "");
commit 8ff8ee837357c54bb8845df2c7a30ec05da02367
Author: Richard Marko <rmarko at fedoraproject.org>
Date: Tue Nov 5 15:41:20 2013 +0100
systemd-python: convert keyword value to string
Allows using journal.send('msg', PRIORITY=journal.LOG_CRIT)
Before this commit this results in
TypeError: cannot concatenate 'str' and 'int' objects
and requires passing PRIORITY value as string to work.
diff --git a/src/python-systemd/journal.py b/src/python-systemd/journal.py
index d0bcd24..9c7e004 100644
--- a/src/python-systemd/journal.py
+++ b/src/python-systemd/journal.py
@@ -352,6 +352,8 @@ def get_catalog(mid):
def _make_line(field, value):
if isinstance(value, bytes):
return field.encode('utf-8') + b'=' + value
+ elif isinstance(value, int):
+ return field + '=' + str(value)
else:
return field + '=' + value
commit 889a90422dd47284dffa32b9234a6e58991b000c
Author: Ronny Chevalier <chevalier.ronny at gmail.com>
Date: Tue Nov 5 23:32:56 2013 +0100
test: remove duplicated code
diff --git a/TODO b/TODO
index 2386897..9cdeabb 100644
--- a/TODO
+++ b/TODO
@@ -223,7 +223,7 @@ Features:
* test/:
- add 'set -e' to scripts in test/
- make stuff in test/ work with separate output dir
- - remove all the duplicated code in test/
+ - qemu wrapper script: http://www.spinics.net/lists/kvm/msg72389.html
* systemctl delete x.snapshot leaves no trace in logs (at least at default level).
diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh
index 9b55a27..aaf63f4 100755
--- a/test/TEST-01-BASIC/test.sh
+++ b/test/TEST-01-BASIC/test.sh
@@ -7,51 +7,31 @@ TEST_DESCRIPTION="Basic systemd setup"
# Uncomment this to debug failures
#DEBUGFAIL="systemd.unit=multi-user.target"
-DEBUGTOOLS="df free ls stty cat ps ln ip route dmesg dhclient mkdir cp ping dhclient strace less grep id tty touch du sort"
-
-run_qemu() {
- # TODO: qemu wrapper script: http://www.spinics.net/lists/kvm/msg72389.html
- qemu-kvm \
- -hda $TESTDIR/rootdisk.img \
- -m 512M -nographic \
- -net none -kernel /boot/vmlinuz-$KERNEL_VER \
- -append "root=/dev/sda1 systemd.log_level=debug raid=noautodetect loglevel=2 init=/usr/lib/systemd/systemd ro console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" || return 1
+check_result_qemu() {
ret=1
mkdir -p $TESTDIR/root
mount ${LOOPDEV}p1 $TESTDIR/root
[[ -e $TESTDIR/root/testok ]] && ret=0
- cp -a $TESTDIR/root/failed $TESTDIR
- cp -a $TESTDIR/root/var/log/journal $TESTDIR
+ [[ -f $TESTDIR/root/failed ]] && cp -a $TESTDIR/root/failed $TESTDIR
+ [[ -f $TESTDIR/root/var/log/journal ]] && cp -a $TESTDIR/root/var/log/journal $TESTDIR
umount $TESTDIR/root
- cat $TESTDIR/failed
+ [[ -f $TESTDIR/failed ]] && cat $TESTDIR/failed
ls -l $TESTDIR/journal/*/*.journal
test -s $TESTDIR/failed && ret=$(($ret+1))
return $ret
}
-
-run_nspawn() {
- ../../systemd-nspawn -b -D $TESTDIR/nspawn-root /usr/lib/systemd/systemd
- ret=1
- [[ -e $TESTDIR/nspawn-root/testok ]] && ret=0
- cp -a $TESTDIR/nspawn-root/failed $TESTDIR
- cp -a $TESTDIR/nspawn-root/var/log/journal $TESTDIR
- cat $TESTDIR/failed
- ls -l $TESTDIR/journal/*/*.journal
- test -s $TESTDIR/failed && ret=$(($ret+1))
- return $ret
-}
-
-
test_run() {
if check_qemu ; then
- run_qemu || return 1
+ run_qemu
+ check_result_qemu || return 1
else
dwarn "can't run qemu-kvm, skipping"
fi
if check_nspawn; then
- run_nspawn || return 1
+ run_nspawn
+ check_result_nspawn || return 1
else
dwarn "can't run systemd-nspawn, skipping"
fi
@@ -59,71 +39,16 @@ test_run() {
}
test_setup() {
- rm -f $TESTDIR/rootdisk.img
- # Create the blank file to use as a root filesystem
- dd if=/dev/null of=$TESTDIR/rootdisk.img bs=1M seek=200
- LOOPDEV=$(losetup --show -P -f $TESTDIR/rootdisk.img)
- [ -b $LOOPDEV ] || return 1
- echo "LOOPDEV=$LOOPDEV" >> $STATEFILE
- sfdisk -C 6400 -H 2 -S 32 -L $LOOPDEV <<EOF
-,3200
-,
-EOF
-
- mkfs.ext3 -L systemd ${LOOPDEV}p1
- echo -n test >$TESTDIR/keyfile
+ create_empty_image
mkdir -p $TESTDIR/root
mount ${LOOPDEV}p1 $TESTDIR/root
- mkdir -p $TESTDIR/root/run
# Create what will eventually be our root filesystem onto an overlay
(
LOG_LEVEL=5
- initdir=$TESTDIR/root
-
- # create the basic filesystem layout
- setup_basic_dirs
-
- # install compiled files
- (cd ../..; make DESTDIR=$initdir install)
-
- # remove unneeded documentation
- rm -fr $initdir/usr/share/{man,doc,gtk-doc}
-
- # install possible missing libraries
- for i in $initdir/{sbin,bin}/* $initdir/lib/systemd/*; do
- inst_libs $i
- done
-
- # make a journal directory
- mkdir -p $initdir/var/log/journal
-
- # install some basic config files
- inst /etc/sysconfig/init
- inst /etc/passwd
- inst /etc/shadow
- inst /etc/group
- inst /etc/shells
- inst /etc/nsswitch.conf
- inst /etc/pam.conf
- inst /etc/securetty
- inst /etc/os-release
- inst /etc/localtime
- # we want an empty environment
- > $initdir/etc/environment
- > $initdir/etc/machine-id
-
- # set the hostname
- echo systemd-testsuite > $initdir/etc/hostname
-
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
- cat >$initdir/etc/fstab <<EOF
-LABEL=systemd / ext3 rw 0 1
-EOF
-
- # setup the testsuite target and the test ending service
- cp $TEST_BASE_DIR/{testsuite.target,end.service} $initdir/etc/systemd/system/
+ setup_basic_environment
# setup the testsuite service
cat >$initdir/etc/systemd/system/testsuite.service <<EOF
@@ -136,100 +61,9 @@ ExecStart=/bin/bash -c 'set -x; ( systemctl --failed --no-legend --no-pager; sys
Type=oneshot
EOF
- mkdir -p $initdir/etc/systemd/system/testsuite.target.wants
- ln -fs ../testsuite.service $initdir/etc/systemd/system/testsuite.target.wants/testsuite.service
- ln -fs ../end.service $initdir/etc/systemd/system/testsuite.target.wants/end.service
-
- # make the testsuite the default target
- ln -fs testsuite.target $initdir/etc/systemd/system/default.target
- mkdir -p $initdir/etc/rc.d
- cat >$initdir/etc/rc.d/rc.local <<EOF
-#!/bin/bash
-exit 0
-EOF
- chmod 0755 $initdir/etc/rc.d/rc.local
- # install basic tools needed
- dracut_install sh bash setsid loadkeys setfont \
- login sushell sulogin gzip sleep echo mount umount cryptsetup
- dracut_install dmsetup modprobe
-
- # install libnss_files for login
- inst_libdir_file "libnss_files*"
-
- # install dbus and pam
- find \
- /etc/dbus-1 \
- /etc/pam.d \
- /etc/security \
- /lib64/security \
- /lib/security -xtype f \
- | while read file; do
- inst $file
- done
-
- # install dbus socket and service file
- inst /usr/lib/systemd/system/dbus.socket
- inst /usr/lib/systemd/system/dbus.service
-
- # install basic keyboard maps and fonts
- for i in \
- /usr/lib/kbd/consolefonts/latarcyrheb-sun16* \
- /usr/lib/kbd/keymaps/include/* \
- /usr/lib/kbd/keymaps/i386/include/* \
- /usr/lib/kbd/keymaps/i386/qwerty/us.*; do
- [[ -f $i ]] || continue
- inst $i
- done
-
- # some basic terminfo files
- for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
- [ -f ${_terminfodir}/l/linux ] && break
- done
- dracut_install -o ${_terminfodir}/l/linux
-
- # softlink mtab
- ln -fs /proc/self/mounts $initdir/etc/mtab
-
- # install any Execs from the service files
- egrep -ho '^Exec[^ ]*=[^ ]+' $initdir/lib/systemd/system/*.service \
- | while read i; do
- i=${i##Exec*=}; i=${i##-}
- inst $i
- done
-
- # install plymouth, if found... else remove plymouth service files
- # if [ -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then
- # PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$TEST_BASE_DIR/test-functions" \
- # /usr/libexec/plymouth/plymouth-populate-initrd -t $initdir
- # dracut_install plymouth plymouthd
- # else
- rm -f $initdir/{usr/lib,etc}/systemd/system/plymouth* $initdir/{usr/lib,etc}/systemd/system/*/plymouth*
- # fi
-
- # some helper tools for debugging
- [[ $DEBUGTOOLS ]] && dracut_install $DEBUGTOOLS
-
- # install ld.so.conf* and run ldconfig
- cp -a /etc/ld.so.conf* $initdir/etc
- ldconfig -r "$initdir"
- ddebug "Strip binaries"
- find "$initdir" -executable -not -path '*/lib/modules/*.ko' -type f | xargs strip --strip-unneeded | ddebug
-
- # copy depmod files
- inst /lib/modules/$KERNEL_VER/modules.order
- inst /lib/modules/$KERNEL_VER/modules.builtin
- # generate module dependencies
- if [[ -d $initdir/lib/modules/$KERNEL_VER ]] && \
- ! depmod -a -b "$initdir" $KERNEL_VER; then
- dfatal "\"depmod -a $KERNEL_VER\" failed."
- exit 1
- fi
+ setup_testsuite
)
- rm -fr $TESTDIR/nspawn-root
- ddebug "cp -ar $TESTDIR/root $TESTDIR/nspawn-root"
- cp -ar $TESTDIR/root $TESTDIR/nspawn-root
- # we don't mount in the nspawn root
- rm -f $TESTDIR/nspawn-root/etc/fstab
+ setup_nspawn_root
ddebug "umount $TESTDIR/root"
umount $TESTDIR/root
diff --git a/test/TEST-02-CRYPTSETUP/test.sh b/test/TEST-02-CRYPTSETUP/test.sh
index b98d238..86617df 100755
--- a/test/TEST-02-CRYPTSETUP/test.sh
+++ b/test/TEST-02-CRYPTSETUP/test.sh
@@ -7,28 +7,20 @@ TEST_DESCRIPTION="cryptsetup systemd setup"
# Uncomment this to debug failures
#DEBUGFAIL="systemd.unit=multi-user.target"
-DEBUGTOOLS="df free ls stty cat ps ln ip route dmesg dhclient mkdir cp ping dhclient strace less grep id tty touch du sort"
-
-run_qemu() {
- # TODO: qemu wrapper script: http://www.spinics.net/lists/kvm/msg72389.html
- qemu-kvm \
- -hda $TESTDIR/rootdisk.img \
- -m 512M -nographic \
- -net none -kernel /boot/vmlinuz-$KERNEL_VER \
- -append "root=/dev/sda1 systemd.log_level=debug raid=noautodetect loglevel=2 init=/usr/lib/systemd/systemd ro console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" || return 1
+check_result_qemu() {
ret=1
mkdir -p $TESTDIR/root
mount ${LOOPDEV}p1 $TESTDIR/root
[[ -e $TESTDIR/root/testok ]] && ret=0
- cp -a $TESTDIR/root/failed $TESTDIR
+ [[ -f $TESTDIR/root/failed ]] && cp -a $TESTDIR/root/failed $TESTDIR
cryptsetup luksOpen ${LOOPDEV}p2 varcrypt <$TESTDIR/keyfile
mount /dev/mapper/varcrypt $TESTDIR/root/var
- cp -a $TESTDIR/root/var/log/journal $TESTDIR
+ [[ -f $TESTDIR/root/var/log/journal ]] && cp -a $TESTDIR/root/var/log/journal $TESTDIR
umount $TESTDIR/root/var
umount $TESTDIR/root
cryptsetup luksClose /dev/mapper/varcrypt
- cat $TESTDIR/failed
+ [[ -f $TESTDIR/failed ]] && cat $TESTDIR/failed
ls -l $TESTDIR/journal/*/*.journal
test -s $TESTDIR/failed && ret=$(($ret+1))
return $ret
@@ -37,7 +29,8 @@ run_qemu() {
test_run() {
if check_qemu ; then
- run_qemu || return 1
+ run_qemu
+ check_result_qemu || return 1
else
dwarn "can't run qemu-kvm, skipping"
fi
@@ -45,84 +38,23 @@ test_run() {
}
test_setup() {
- rm -f $TESTDIR/rootdisk.img
- # Create the blank file to use as a root filesystem
- dd if=/dev/null of=$TESTDIR/rootdisk.img bs=1M seek=200
- LOOPDEV=$(losetup --show -P -f $TESTDIR/rootdisk.img)
- [ -b $LOOPDEV ] || return 1
- echo "LOOPDEV=$LOOPDEV" >> $STATEFILE
- sfdisk -C 6400 -H 2 -S 32 -L $LOOPDEV <<EOF
-,3200
-,
-EOF
-
- mkfs.ext3 -L systemd ${LOOPDEV}p1
+ create_empty_image
echo -n test >$TESTDIR/keyfile
cryptsetup -q luksFormat ${LOOPDEV}p2 $TESTDIR/keyfile
cryptsetup luksOpen ${LOOPDEV}p2 varcrypt <$TESTDIR/keyfile
mkfs.ext3 -L var /dev/mapper/varcrypt
mkdir -p $TESTDIR/root
mount ${LOOPDEV}p1 $TESTDIR/root
- mkdir -p $TESTDIR/root/run
mkdir -p $TESTDIR/root/var
mount /dev/mapper/varcrypt $TESTDIR/root/var
# Create what will eventually be our root filesystem onto an overlay
(
LOG_LEVEL=5
- initdir=$TESTDIR/root
-
- # create the basic filesystem layout
- setup_basic_dirs
-
- # install compiled files
- (cd ../..; make DESTDIR=$initdir install)
-
- # remove unneeded documentation
- rm -fr $initdir/usr/share/{man,doc,gtk-doc}
-
- # install possible missing libraries
- for i in $initdir/{sbin,bin}/* $initdir/lib/systemd/*; do
- inst_libs $i
- done
-
- # make a journal directory
- mkdir -p $initdir/var/log/journal
-
- # install some basic config files
- inst /etc/sysconfig/init
- inst /etc/passwd
- inst /etc/shadow
- inst /etc/group
- inst /etc/shells
- inst /etc/nsswitch.conf
- inst /etc/pam.conf
- inst /etc/securetty
- inst /etc/os-release
- inst /etc/localtime
- # we want an empty environment
- > $initdir/etc/environment
- > $initdir/etc/machine-id
-
- # set the hostname
- echo systemd-testsuite > $initdir/etc/hostname
-
eval $(udevadm info --export --query=env --name=/dev/mapper/varcrypt)
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
- cat >$initdir/etc/crypttab <<EOF
-$DM_NAME UUID=$ID_FS_UUID /etc/varkey
-EOF
- echo -n test > $initdir/etc/varkey
- cat $initdir/etc/crypttab | ddebug
-
- cat >$initdir/etc/fstab <<EOF
-LABEL=systemd / ext3 rw 0 1
-/dev/mapper/varcrypt /var ext3 defaults 0 1
-EOF
-
- # setup the testsuite target and the test ending service
- cp $TEST_BASE_DIR/{testsuite.target,end.service} $initdir/etc/systemd/system/
+ setup_basic_environment
# setup the testsuite service
cat >$initdir/etc/systemd/system/testsuite.service <<EOF
@@ -135,108 +67,20 @@ ExecStart=/bin/bash -c 'set -x; ( systemctl --failed --no-legend --no-pager; sys
Type=oneshot
EOF
- mkdir -p $initdir/etc/systemd/system/testsuite.target.wants
- ln -fs ../testsuite.service $initdir/etc/systemd/system/testsuite.target.wants/testsuite.service
- ln -fs ../end.service $initdir/etc/systemd/system/testsuite.target.wants/end.service
+ setup_testsuite
- # make the testsuite the default target
- ln -fs testsuite.target $initdir/etc/systemd/system/default.target
- mkdir -p $initdir/etc/rc.d
- cat >$initdir/etc/rc.d/rc.local <<EOF
-#!/bin/bash
-exit 0
+ install_dmevent
+ cat >$initdir/etc/crypttab <<EOF
+$DM_NAME UUID=$ID_FS_UUID /etc/varkey
EOF
- chmod 0755 $initdir/etc/rc.d/rc.local
- # install basic tools needed
- dracut_install sh bash setsid loadkeys setfont \
- login sushell sulogin gzip sleep echo mount umount cryptsetup
- dracut_install dmsetup modprobe
-
- instmods dm_crypt =crypto
-
- type -P dmeventd >/dev/null && dracut_install dmeventd
-
- inst_libdir_file "libdevmapper-event.so*"
-
- inst_rules 10-dm.rules 13-dm-disk.rules 95-dm-notify.rules
-
- # install libnss_files for login
- inst_libdir_file "libnss_files*"
-
- # install dbus and pam
- find \
- /etc/dbus-1 \
- /etc/pam.d \
- /etc/security \
- /lib64/security \
- /lib/security -xtype f \
- | while read file; do
- inst $file
- done
-
- # install dbus socket and service file
- inst /usr/lib/systemd/system/dbus.socket
- inst /usr/lib/systemd/system/dbus.service
-
- # install basic keyboard maps and fonts
- for i in \
- /usr/lib/kbd/consolefonts/latarcyrheb-sun16* \
- /usr/lib/kbd/keymaps/include/* \
- /usr/lib/kbd/keymaps/i386/include/* \
- /usr/lib/kbd/keymaps/i386/qwerty/us.*; do
- [[ -f $i ]] || continue
- inst $i
- done
-
- # some basic terminfo files
- for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
- [ -f ${_terminfodir}/l/linux ] && break
- done
- dracut_install -o ${_terminfodir}/l/linux
-
- # softlink mtab
- ln -fs /proc/self/mounts $initdir/etc/mtab
-
- # install any Execs from the service files
- egrep -ho '^Exec[^ ]*=[^ ]+' $initdir/lib/systemd/system/*.service \
- | while read i; do
- i=${i##Exec*=}; i=${i##-}
- inst $i
- done
-
- # install plymouth, if found... else remove plymouth service files
- # if [ -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then
- # PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$TEST_BASE_DIR/test-functions" \
- # /usr/libexec/plymouth/plymouth-populate-initrd -t $initdir
- # dracut_install plymouth plymouthd
- # else
- rm -f $initdir/{usr/lib,etc}/systemd/system/plymouth* $initdir/{usr/lib,etc}/systemd/system/*/plymouth*
- # fi
-
- # some helper tools for debugging
- [[ $DEBUGTOOLS ]] && dracut_install $DEBUGTOOLS
-
- # install ld.so.conf* and run ldconfig
- cp -a /etc/ld.so.conf* $initdir/etc
- ldconfig -r "$initdir"
- ddebug "Strip binaeries"
- find "$initdir" -executable -not -path '*/lib/modules/*.ko' -type f | xargs strip --strip-unneeded | ddebug
+ echo -n test > $initdir/etc/varkey
+ cat $initdir/etc/crypttab | ddebug
- # copy depmod files
- inst /lib/modules/$KERNEL_VER/modules.order
- inst /lib/modules/$KERNEL_VER/modules.builtin
- # generate module dependencies
- if [[ -d $initdir/lib/modules/$KERNEL_VER ]] && \
- ! depmod -a -b "$initdir" $KERNEL_VER; then
- dfatal "\"depmod -a $KERNEL_VER\" failed."
- exit 1
- fi
+ cat >>$initdir/etc/fstab <<EOF
+/dev/mapper/varcrypt /var ext3 defaults 0 1
+EOF
)
- rm -fr $TESTDIR/nspawn-root
- ddebug "cp -ar $TESTDIR/root $TESTDIR/nspawn-root"
- cp -ar $TESTDIR/root $TESTDIR/nspawn-root
- # we don't mount in the nspawn root
- rm -fr $TESTDIR/nspawn-root/etc/fstab
+ setup_nspawn_root
ddebug "umount $TESTDIR/root/var"
umount $TESTDIR/root/var
diff --git a/test/TEST-03-JOBS/test.sh b/test/TEST-03-JOBS/test.sh
index 02fd8b9..6303258 100755
--- a/test/TEST-03-JOBS/test.sh
+++ b/test/TEST-03-JOBS/test.sh
@@ -7,16 +7,8 @@ TEST_DESCRIPTION="Job-related tests"
# Uncomment this to debug failures
#DEBUGFAIL="systemd.unit=multi-user.target"
-DEBUGTOOLS="df free ls stty cat ps ln ip route dmesg dhclient mkdir cp ping dhclient strace less grep id tty touch du sort"
-
-run_qemu() {
- # TODO: qemu wrapper script: http://www.spinics.net/lists/kvm/msg72389.html
- qemu-kvm \
- -hda $TESTDIR/rootdisk.img \
- -m 512M -nographic \
- -net none -kernel /boot/vmlinuz-$KERNEL_VER \
- -append "root=/dev/sda1 systemd.log_level=debug raid=noautodetect loglevel=2 init=/usr/lib/systemd/systemd ro console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" || return 1
+check_result_qemu() {
ret=1
mkdir -p $TESTDIR/root
mount ${LOOPDEV}p1 $TESTDIR/root
@@ -30,28 +22,16 @@ run_qemu() {
return $ret
}
-
-run_nspawn() {
- ../../systemd-nspawn -b -D $TESTDIR/nspawn-root /usr/lib/systemd/systemd
- ret=1
- [[ -e $TESTDIR/nspawn-root/testok ]] && ret=0
- [[ -f $TESTDIR/root/failed ]] && cp -a $TESTDIR/nspawn-root/failed $TESTDIR
- cp -a $TESTDIR/nspawn-root/var/log/journal $TESTDIR
- [[ -f $TESTDIR/failed ]] && cat $TESTDIR/failed
- ls -l $TESTDIR/journal/*/*.journal
- test -s $TESTDIR/failed && ret=$(($ret+1))
- return $ret
-}
-
-
test_run() {
if check_qemu ; then
- run_qemu || return 1
+ run_qemu
+ check_result_qemu || return 1
else
dwarn "can't run qemu-kvm, skipping"
fi
if check_nspawn; then
- run_nspawn || return 1
+ run_nspawn
+ check_result_nspawn || return 1
else
dwarn "can't run systemd-nspawn, skipping"
fi
@@ -59,71 +39,16 @@ test_run() {
}
test_setup() {
- rm -f $TESTDIR/rootdisk.img
- # Create the blank file to use as a root filesystem
- dd if=/dev/null of=$TESTDIR/rootdisk.img bs=1M seek=200
- LOOPDEV=$(losetup --show -P -f $TESTDIR/rootdisk.img)
- [ -b $LOOPDEV ] || return 1
- echo "LOOPDEV=$LOOPDEV" >> $STATEFILE
- sfdisk -C 6400 -H 2 -S 32 -L $LOOPDEV <<EOF
-,3200
-,
-EOF
-
- mkfs.ext3 -L systemd ${LOOPDEV}p1
- echo -n test >$TESTDIR/keyfile
+ create_empty_image
mkdir -p $TESTDIR/root
mount ${LOOPDEV}p1 $TESTDIR/root
- mkdir -p $TESTDIR/root/run
# Create what will eventually be our root filesystem onto an overlay
(
LOG_LEVEL=5
- initdir=$TESTDIR/root
-
- # create the basic filesystem layout
- setup_basic_dirs
-
- # install compiled files
- (cd ../..; make DESTDIR=$initdir install)
-
- # remove unneeded documentation
- rm -fr $initdir/usr/share/{man,doc,gtk-doc}
-
- # install possible missing libraries
- for i in $initdir/{sbin,bin}/* $initdir/lib/systemd/*; do
- inst_libs $i
- done
-
- # make a journal directory
- mkdir -p $initdir/var/log/journal
-
- # install some basic config files
- inst /etc/sysconfig/init
- inst /etc/passwd
- inst /etc/shadow
- inst /etc/group
- inst /etc/shells
- inst /etc/nsswitch.conf
- inst /etc/pam.conf
- inst /etc/securetty
- inst /etc/os-release
- inst /etc/localtime
- # we want an empty environment
- > $initdir/etc/environment
- > $initdir/etc/machine-id
-
- # set the hostname
- echo systemd-testsuite > $initdir/etc/hostname
-
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
- cat >$initdir/etc/fstab <<EOF
-LABEL=systemd / ext3 rw 0 1
-EOF
-
- # setup the testsuite target and the test ending service
- cp $TEST_BASE_DIR/{testsuite.target,end.service} $initdir/etc/systemd/system/
+ setup_basic_environment
# setup the testsuite service
cat >$initdir/etc/systemd/system/testsuite.service <<EOF
@@ -141,100 +66,9 @@ EOF
$initdir/etc/systemd/system
cp test-jobs.sh $initdir/
- mkdir -p $initdir/etc/systemd/system/testsuite.target.wants
- ln -fs ../testsuite.service $initdir/etc/systemd/system/testsuite.target.wants/testsuite.service
- ln -fs ../end.service $initdir/etc/systemd/system/testsuite.target.wants/end.service
-
- # make the testsuite the default target
- ln -fs testsuite.target $initdir/etc/systemd/system/default.target
- mkdir -p $initdir/etc/rc.d
- cat >$initdir/etc/rc.d/rc.local <<EOF
-#!/bin/bash
-exit 0
-EOF
- chmod 0755 $initdir/etc/rc.d/rc.local
- # install basic tools needed
- dracut_install sh bash setsid loadkeys setfont \
- login sushell sulogin gzip sleep echo mount umount cryptsetup date
- dracut_install dmsetup modprobe
-
- # install libnss_files for login
- inst_libdir_file "libnss_files*"
-
- # install dbus and pam
- find \
- /etc/dbus-1 \
- /etc/pam.d \
- /etc/security \
- /lib64/security \
- /lib/security -xtype f \
- | while read file; do
- inst $file
- done
-
- # install dbus socket and service file
- inst /usr/lib/systemd/system/dbus.socket
- inst /usr/lib/systemd/system/dbus.service
-
- # install basic keyboard maps and fonts
- for i in \
- /usr/lib/kbd/consolefonts/latarcyrheb-sun16* \
- /usr/lib/kbd/keymaps/include/* \
- /usr/lib/kbd/keymaps/i386/include/* \
- /usr/lib/kbd/keymaps/i386/qwerty/us.*; do
- [[ -f $i ]] || continue
- inst $i
- done
-
- # some basic terminfo files
- for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
- [ -f ${_terminfodir}/l/linux ] && break
- done
- dracut_install -o ${_terminfodir}/l/linux
-
- # softlink mtab
- ln -fs /proc/self/mounts $initdir/etc/mtab
-
- # install any Exec's from the service files
- egrep -ho '^Exec[^ ]*=[^ ]+' $initdir/lib/systemd/system/*.service \
- | while read i; do
- i=${i##Exec*=}; i=${i##-}
- inst $i
- done
-
- # install plymouth, if found... else remove plymouth service files
- # if [ -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then
- # PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$TEST_BASE_DIR/test-functions" \
- # /usr/libexec/plymouth/plymouth-populate-initrd -t $initdir
- # dracut_install plymouth plymouthd
- # else
- rm -f $initdir/{usr/lib,etc}/systemd/system/plymouth* $initdir/{usr/lib,etc}/systemd/system/*/plymouth*
- # fi
-
- # some helper tools for debugging
- [[ $DEBUGTOOLS ]] && dracut_install $DEBUGTOOLS
-
- # install ld.so.conf* and run ldconfig
- cp -a /etc/ld.so.conf* $initdir/etc
- ldconfig -r "$initdir"
- ddebug "Strip binaeries"
- find "$initdir" -perm +111 -type f | xargs strip --strip-unneeded | ddebug
-
- # copy depmod files
- inst /lib/modules/$KERNEL_VER/modules.order
- inst /lib/modules/$KERNEL_VER/modules.builtin
- # generate module dependencies
- if [[ -d $initdir/lib/modules/$KERNEL_VER ]] && \
- ! depmod -a -b "$initdir" $KERNEL_VER; then
- dfatal "\"depmod -a $KERNEL_VER\" failed."
- exit 1
- fi
+ setup_testsuite
)
- rm -fr $TESTDIR/nspawn-root
- ddebug "cp -ar $TESTDIR/root $TESTDIR/nspawn-root"
- cp -ar $TESTDIR/root $TESTDIR/nspawn-root
- # we don't mount in the nspawn root
- rm -fr $TESTDIR/nspawn-root/etc/fstab
+ setup_nspawn_root
ddebug "umount $TESTDIR/root"
umount $TESTDIR/root
diff --git a/test/test-functions b/test/test-functions
index 0587cd4..a184ed7 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -7,7 +7,255 @@ export PATH
KERNEL_VER=${KERNEL_VER-$(uname -r)}
KERNEL_MODS="/lib/modules/$KERNEL_VER/"
+BASICTOOLS="sh bash setsid loadkeys setfont login sushell sulogin gzip sleep echo mount umount cryptsetup date dmsetup modprobe"
+DEBUGTOOLS="df free ls stty cat ps ln ip route dmesg dhclient mkdir cp ping dhclient strace less grep id tty touch du sort"
+
+run_qemu() {
+ qemu-kvm \
+ -hda $TESTDIR/rootdisk.img \
+ -m 512M -nographic \
+ -net none -kernel /boot/vmlinuz-$KERNEL_VER \
+ -append "root=/dev/sda1 systemd.log_level=debug raid=noautodetect loglevel=2 init=/usr/lib/systemd/systemd ro console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" || return 1
+}
+
+run_nspawn() {
+ ../../systemd-nspawn --boot --directory=$TESTDIR/nspawn-root /usr/lib/systemd/systemd
+}
+
+setup_basic_environment() {
+ # create the basic filesystem layout
+ setup_basic_dirs
+
+ install_systemd
+ install_missing_libraries
+ install_config_files
+ create_rc_local
+ install_basic_tools
+ install_libnss
+ install_pam
+ install_dbus
+ install_fonts
+ install_keymaps
+ install_terminfo
+ install_execs
+ install_plymouth
+ install_debug_tools
+ install_ld_so_conf
+ strip_binaries
+ install_depmod_files
+ generate_module_dependencies
+ # softlink mtab
+ ln -fs /proc/self/mounts $initdir/etc/mtab
+}
+
+install_dmevent() {
+ instmods dm_crypt =crypto
+ type -P dmeventd >/dev/null && dracut_install dmeventd
+ inst_libdir_file "libdevmapper-event.so*"
+ inst_rules 10-dm.rules 13-dm-disk.rules 95-dm-notify.rules
+}
+
+install_systemd() {
+ # install compiled files
+ (cd $TEST_BASE_DIR/..; make DESTDIR=$initdir install)
+ # remove unneeded documentation
+ rm -fr $initdir/usr/share/{man,doc,gtk-doc}
+ # we strip binaries since debug symbols increase binaries size a lot
+ # and it could fill the available space
+ strip_binaries
+}
+
+install_missing_libraries() {
+ # install possible missing libraries
+ for i in $initdir/{sbin,bin}/* $initdir/lib/systemd/*; do
+ inst_libs $i
+ done
+}
+
+create_empty_image() {
+ rm -f $TESTDIR/rootdisk.img
+ # Create the blank file to use as a root filesystem
+ dd if=/dev/null of=$TESTDIR/rootdisk.img bs=1M seek=200
+ LOOPDEV=$(losetup --show -P -f $TESTDIR/rootdisk.img)
+ [ -b $LOOPDEV ] || return 1
+ echo "LOOPDEV=$LOOPDEV" >> $STATEFILE
+ sfdisk -C 6400 -H 2 -S 32 -L $LOOPDEV <<EOF
+,3200
+,
+EOF
+
+ mkfs.ext3 -L systemd ${LOOPDEV}p1
+}
+
+check_result_nspawn() {
+ ret=1
+ [[ -e $TESTDIR/nspawn-root/testok ]] && ret=0
+ [[ -f $TESTDIR/nspawn-root/failed ]] && cp -a $TESTDIR/nspawn-root/failed $TESTDIR
+ cp -a $TESTDIR/nspawn-root/var/log/journal $TESTDIR
+ [[ -f $TESTDIR/failed ]] && cat $TESTDIR/failed
+ ls -l $TESTDIR/journal/*/*.journal
+ test -s $TESTDIR/failed && ret=$(($ret+1))
+ return $ret
+}
+
+strip_binaries() {
+ ddebug "Strip binaries"
+ find "$initdir" -executable -not -path '*/lib/modules/*.ko' -type f | xargs strip --strip-unneeded | ddebug
+}
+
+create_rc_local() {
+ mkdir -p $initdir/etc/rc.d
+ cat >$initdir/etc/rc.d/rc.local <<EOF
+#!/bin/bash
+exit 0
+EOF
+ chmod 0755 $initdir/etc/rc.d/rc.local
+}
+
+install_execs() {
+ # install any Execs from the service files
+ egrep -ho '^Exec[^ ]*=[^ ]+' $initdir/lib/systemd/system/*.service \
+ | while read i; do
+ i=${i##Exec*=}; i=${i##-}
+ inst $i
+ done
+}
+
+generate_module_dependencies() {
+ if [[ -d $initdir/lib/modules/$KERNEL_VER ]] && \
+ ! depmod -a -b "$initdir" $KERNEL_VER; then
+ dfatal "\"depmod -a $KERNEL_VER\" failed."
+ exit 1
+ fi
+}
+
+install_depmod_files() {
+ inst /lib/modules/$KERNEL_VER/modules.order
+ inst /lib/modules/$KERNEL_VER/modules.builtin
+}
+
+install_plymouth() {
+ # install plymouth, if found... else remove plymouth service files
+ # if [ -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then
+ # PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$TEST_BASE_DIR/test-functions" \
+ # /usr/libexec/plymouth/plymouth-populate-initrd -t $initdir
+ # dracut_install plymouth plymouthd
+ # else
+ rm -f $initdir/{usr/lib,etc}/systemd/system/plymouth* $initdir/{usr/lib,etc}/systemd/system/*/plymouth*
+ # fi
+}
+
+install_ld_so_conf() {
+ cp -a /etc/ld.so.conf* $initdir/etc
+ ldconfig -r "$initdir"
+}
+
+install_config_files() {
+ inst /etc/sysconfig/init
+ inst /etc/passwd
+ inst /etc/shadow
+ inst /etc/group
+ inst /etc/shells
+ inst /etc/nsswitch.conf
+ inst /etc/pam.conf
+ inst /etc/securetty
+ inst /etc/os-release
+ inst /etc/localtime
+ # we want an empty environment
+ > $initdir/etc/environment
+ > $initdir/etc/machine-id
+ # set the hostname
+ echo systemd-testsuite > $initdir/etc/hostname
+ # fstab
+ cat >$initdir/etc/fstab <<EOF
+LABEL=systemd / ext3 rw 0 1
+EOF
+}
+
+install_basic_tools() {
+ [[ $BASICTOOLS ]] && dracut_install $BASICTOOLS
+}
+
+install_debug_tools() {
+ [[ $DEBUGTOOLS ]] && dracut_install $DEBUGTOOLS
+}
+
+install_libnss() {
+ # install libnss_files for login
+ inst_libdir_file "libnss_files*"
+}
+
+install_dbus() {
+ inst /usr/lib/systemd/system/dbus.socket
+ inst /usr/lib/systemd/system/dbus.service
+
+ find \
+ /etc/dbus-1 -xtype f \
+ | while read file; do
+ inst $file
+ done
+}
+
+install_pam() {
+ find \
+ /etc/pam.d \
+ /etc/security \
+ /lib64/security \
+ /lib/security -xtype f \
+ | while read file; do
+ inst $file
+ done
+}
+
+install_keymaps() {
+ for i in \
+ /usr/lib/kbd/keymaps/include/* \
+ /usr/lib/kbd/keymaps/i386/include/* \
+ /usr/lib/kbd/keymaps/i386/qwerty/us.*; do
+ [[ -f $i ]] || continue
+ inst $i
+ done
+}
+
+install_fonts() {
+ for i in \
+ /usr/lib/kbd/consolefonts/latarcyrheb-sun16*; do
+ [[ -f $i ]] || continue
+ inst $i
+ done
+}
+
+install_terminfo() {
+ for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
+ [ -f ${_terminfodir}/l/linux ] && break
+ done
+ dracut_install -o ${_terminfodir}/l/linux
+}
+
+setup_testsuite() {
+ cp $TEST_BASE_DIR/{testsuite.target,end.service} $initdir/etc/systemd/system/
+
+ mkdir -p $initdir/etc/systemd/system/testsuite.target.wants
+ ln -fs $TEST_BASE_DIR/testsuite.service $initdir/etc/systemd/system/testsuite.target.wants/testsuite.service
+ ln -fs $TEST_BASE_DIR/end.service $initdir/etc/systemd/system/testsuite.target.wants/end.service
+
+ # make the testsuite the default target
+ ln -fs testsuite.target $initdir/etc/systemd/system/default.target
+}
+
+setup_nspawn_root() {
+ rm -fr $TESTDIR/nspawn-root
+ ddebug "cp -ar $initdir $TESTDIR/nspawn-root"
+ cp -ar $initdir $TESTDIR/nspawn-root
+ # we don't mount in the nspawn root
+ rm -f $TESTDIR/nspawn-root/etc/fstab
+}
+
setup_basic_dirs() {
+ mkdir -p $initdir/run
+ mkdir -p $initdir/etc/systemd/system
+ mkdir -p $initdir/var/log/journal
+
for d in usr/bin usr/sbin bin etc lib "$libdir" sbin tmp usr var var/log dev proc sys sysroot root run run/lock run/initramfs; do
if [ -L "/$d" ]; then
inst_symlink "/$d"
@@ -55,6 +303,11 @@ import_testdir() {
fi
}
+import_initdir() {
+ initdir=$TESTDIR/root
+ export initdir
+}
+
## @brief Converts numeric logging level to the first letter of level name.
#
# @param lvl Numeric logging level in range from 1 to 6.
@@ -815,6 +1068,7 @@ do_test() {
done
import_testdir
+ import_initdir
while (($# > 0)); do
case $1 in
commit 37185ec80ad372907a2a9388735655a7334babb6
Author: WaLyong Cho <walyong.cho at samsung.com>
Date: Wed Nov 6 17:02:41 2013 +0900
Support additional argument in reboot
reboot syscall can be performed with an additional argument. In some
systems this functionality can be useful to modify the mode of the
next boot performed by the bootloader.
diff --git a/man/systemctl.xml b/man/systemctl.xml
index c7313ed..7f1e98f 100644
--- a/man/systemctl.xml
+++ b/man/systemctl.xml
@@ -1179,7 +1179,7 @@ kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service
</listitem>
</varlistentry>
<varlistentry>
- <term><command>reboot</command></term>
+ <term><command>reboot <optional><replaceable>arg</replaceable></optional></command></term>
<listitem>
<para>Shut down and reboot the system. This is mostly
@@ -1192,6 +1192,16 @@ kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service
specified twice, the operation is immediately executed
without terminating any processes or unmounting any file
systems. This may result in data loss.</para>
+
+ <para>If the optional argument
+ <replaceable>arg</replaceable> is given, it will be passed
+ as the optional argument to the
+ <citerefentry><refentrytitle>reboot</refentrytitle><manvolnum>2</manvolnum></citerefentry>
+ system call. The value is architecture and firmware
+ specific. As an example, <literal>recovery</literal> might
+ be used to trigger system recovery, and
+ <literal>fota</literal> might be used to trigger a
+ <quote>firmware over the air</quote> update.</para>
</listitem>
</varlistentry>
<varlistentry>
diff --git a/src/core/shutdown.c b/src/core/shutdown.c
index aa9548e..377c197 100644
--- a/src/core/shutdown.c
+++ b/src/core/shutdown.c
@@ -47,6 +47,7 @@
#include "watchdog.h"
#include "killall.h"
#include "cgroup-util.h"
+#include "def.h"
#define FINALIZE_ATTEMPTS 50
@@ -134,7 +135,7 @@ static int pivot_to_new_root(void) {
int main(int argc, char *argv[]) {
bool need_umount = true, need_swapoff = true, need_loop_detach = true, need_dm_detach = true;
bool in_container, use_watchdog = false;
- _cleanup_free_ char *line = NULL, *cgroup = NULL;
+ _cleanup_free_ char *line = NULL, *cgroup = NULL, *param = NULL;
char *arguments[3];
unsigned retries;
int cmd, r;
@@ -173,9 +174,11 @@ int main(int argc, char *argv[]) {
in_container = detect_container(NULL) > 0;
- if (streq(argv[1], "reboot"))
+ if (streq(argv[1], "reboot")) {
cmd = RB_AUTOBOOT;
- else if (streq(argv[1], "poweroff"))
+ /* if this fails, that's OK */
+ read_one_line_file(REBOOT_PARAM_FILE, ¶m);
+ } else if (streq(argv[1], "poweroff"))
cmd = RB_POWER_OFF;
else if (streq(argv[1], "halt"))
cmd = RB_HALT_SYSTEM;
@@ -337,7 +340,11 @@ int main(int argc, char *argv[]) {
cmd = RB_AUTOBOOT;
}
- reboot(cmd);
+ if (param)
+ syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2,
+ LINUX_REBOOT_CMD_RESTART2, param);
+ else
+ reboot(cmd);
if (errno == EPERM && in_container) {
/* If we are in a container, and we lacked
diff --git a/src/shared/def.h b/src/shared/def.h
index edd0bcf..46b88a8 100644
--- a/src/shared/def.h
+++ b/src/shared/def.h
@@ -38,3 +38,5 @@
#define LOWERCASE_LETTERS "abcdefghijklmnopqrstuvwxyz"
#define UPPERCASE_LETTERS "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define LETTERS LOWERCASE_LETTERS UPPERCASE_LETTERS
+
+#define REBOOT_PARAM_FILE "/run/systemd/reboot-param"
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 9d22aad..6170cc9 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -20,6 +20,8 @@
***/
#include <sys/reboot.h>
+#include <linux/reboot.h>
+#include <sys/syscall.h>
#include <stdio.h>
#include <getopt.h>
#include <locale.h>
@@ -4804,7 +4806,7 @@ static int systemctl_help(void) {
" emergency Enter system emergency mode\n"
" halt Shut down and halt the system\n"
" poweroff Shut down and power-off the system\n"
- " reboot Shut down and reboot the system\n"
+ " reboot [ARG] Shut down and reboot the system\n"
" kexec Shut down and reboot the system with kexec\n"
" exit Request user instance exit\n"
" switch-root [ROOT] [INIT] Change to a different root file system\n"
@@ -4818,7 +4820,7 @@ static int systemctl_help(void) {
static int halt_help(void) {
- printf("%s [OPTIONS...]\n\n"
+ printf("%s [OPTIONS...]%s\n\n"
"%s the system.\n\n"
" --help Show this help\n"
" --halt Halt the machine\n"
@@ -4829,6 +4831,7 @@ static int halt_help(void) {
" -d --no-wtmp Don't write wtmp record\n"
" --no-wall Don't send wall message before halt/power-off/reboot\n",
program_invocation_short_name,
+ arg_action == ACTION_REBOOT ? " [ARG]" : "",
arg_action == ACTION_REBOOT ? "Reboot" :
arg_action == ACTION_POWEROFF ? "Power off" :
"Halt");
@@ -5253,7 +5256,7 @@ static int halt_parse_argv(int argc, char *argv[]) {
{}
};
- int c, runlevel;
+ int c, r, runlevel;
assert(argc >= 0);
assert(argv);
@@ -5311,7 +5314,14 @@ static int halt_parse_argv(int argc, char *argv[]) {
}
}
- if (optind < argc) {
+ if (arg_action == ACTION_REBOOT && argc == optind + 1) {
+ r = write_string_file(REBOOT_PARAM_FILE, argv[optind]);
+ if (r < 0) {
+ log_error("Failed to write reboot param to "
+ REBOOT_PARAM_FILE": %s", strerror(-r));
+ return r;
+ }
+ } else if (optind < argc) {
log_error("Too many arguments.");
return -EINVAL;
}
@@ -5944,6 +5954,8 @@ done:
static _noreturn_ void halt_now(enum action a) {
+ _cleanup_free_ char *param = NULL;
+
/* Make sure C-A-D is handled by the kernel from this
* point on... */
reboot(RB_ENABLE_CAD);
@@ -5961,8 +5973,14 @@ static _noreturn_ void halt_now(enum action a) {
break;
case ACTION_REBOOT:
- log_info("Rebooting.");
- reboot(RB_AUTOBOOT);
+ if (read_one_line_file(REBOOT_PARAM_FILE, ¶m) == 0) {
+ log_info("Rebooting with arg '%s'.", param);
+ syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2,
+ LINUX_REBOOT_CMD_RESTART2, param);
+ } else {
+ log_info("Rebooting.");
+ reboot(RB_AUTOBOOT);
+ }
break;
default:
commit 3f09ee19690730cd69e4986d72da2d9bb7c04a6a
Author: Jan Engelhardt <jengelh at inai.de>
Date: Thu Nov 7 01:17:49 2013 +0100
man: add rationale into systemd-halt(8)
The explanation is from
http://people.debian.org/~stapelberg/docs/systemd-dependencies.html
diff --git a/man/systemd-halt.service.xml b/man/systemd-halt.service.xml
index 2fd7b8b..0737d05 100644
--- a/man/systemd-halt.service.xml
+++ b/man/systemd-halt.service.xml
@@ -83,6 +83,12 @@
remaining swap devices, detach all remaining storage
devices and kill all remaining processes.</para>
+ <para>It is necessary to have this code in a separate binary
+ because otherwise rebooting after an upgrade might be broken â
+ the running PID 1 could still depend on libraries which are not
+ available any more, thus keeping the filesystem busy, which
+ then cannot be re-mounted read-only.</para>
+
<para>Immediately before executing the actual system
halt/poweroff/reboot/kexec
<filename>systemd-shutdown</filename> will run all
commit 63ba209d8bc64137ff1585d5878328c93cb81b61
Author: Jan Engelhardt <jengelh at inai.de>
Date: Thu Nov 7 01:17:48 2013 +0100
man: wording and grammar updates
This is a recurring submission and includes corrections to various
issue spotted: comma setting, missing words/preposition choice.
diff --git a/man/hostnamectl.xml b/man/hostnamectl.xml
index b39fb55..29914b8 100644
--- a/man/hostnamectl.xml
+++ b/man/hostnamectl.xml
@@ -133,7 +133,7 @@
remotely. Specify a hostname, or
username and hostname separated by <literal>@</literal>,
to connect to. This will use SSH to
- talk to a remote
+ talk to the remote
system.</para></listitem>
</varlistentry>
diff --git a/man/localectl.xml b/man/localectl.xml
index ad4f3d4..0950cce 100644
--- a/man/localectl.xml
+++ b/man/localectl.xml
@@ -126,7 +126,7 @@
remotely. Specify a hostname, or
username and hostname separated by <literal>@</literal>,
to connect to. This will use SSH to
- talk to a remote
+ talk to the remote
system.</para></listitem>
</varlistentry>
diff --git a/man/loginctl.xml b/man/loginctl.xml
index 1b54ff7..7d4f26a 100644
--- a/man/loginctl.xml
+++ b/man/loginctl.xml
@@ -172,7 +172,7 @@
<term><option>-H</option></term>
<term><option>--host</option></term>
- <listitem><para>Execute operation
+ <listitem><para>Execute the operation
remotely. Specify a hostname, or
username and hostname separated by <literal>@</literal>,
to connect to. This will use SSH to
diff --git a/man/machinectl.xml b/man/machinectl.xml
index c06d0c7..ec2aaa5 100644
--- a/man/machinectl.xml
+++ b/man/machinectl.xml
@@ -105,7 +105,7 @@
<term><option>-H</option></term>
<term><option>--host=</option></term>
- <listitem><para>Execute operation
+ <listitem><para>Execute the operation
remotely. Specify a hostname, or
username and hostname separated by <literal>@</literal>,
to connect to. This will use SSH to
@@ -117,7 +117,7 @@
<term><option>-M</option></term>
<term><option>--machine=</option></term>
- <listitem><para>Execute operation on a
+ <listitem><para>Execute the operation on a
local container. Specify a container
name to connect to.</para></listitem>
</varlistentry>
@@ -270,7 +270,7 @@
<listitem><para>Open a terminal login
session to a container. This will
create a TTY connection to a specific
- container and asks for execution of a
+ container and asks for the execution of a
getty on it. Note that this is only
supported for containers running
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
diff --git a/man/systemctl.xml b/man/systemctl.xml
index 605b786..c7313ed 100644
--- a/man/systemctl.xml
+++ b/man/systemctl.xml
@@ -64,15 +64,15 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
system and service manager.</para>
- <para>For Unit Commands the <replaceable>NAME</replaceable> represents full name of unit.
+ <para>For unit commands, the <replaceable>NAME</replaceable> represents full name of the unit.
<programlisting>
systemctl start foo.service
</programlisting>
- For Unit File Commands the <replaceable>NAME</replaceable> represents full name of the unit file, or absolute path to the unit file.
+ For unit file commands, the <replaceable>NAME</replaceable> represents the full name of the unit file, or the absolute path to the unit file.
<programlisting>
systemctl start /path/to/foo.service
</programlisting>
- While working with services/service files, <command>systemctl</command> is able to append .service suffix when it is missing.
+ While working with services/service files, <command>systemctl</command> implicitly appends the ".service" suffix when it is missing.
<programlisting>
systemctl start foo
</programlisting></para>
@@ -457,7 +457,7 @@ systemctl start foo
<term><option>--host</option></term>
<listitem>
- <para>Execute operation remotely. Specify a hostname, or
+ <para>Execute the operation remotely. Specify a hostname, or
username and hostname separated by <literal>@</literal>, to connect to. This
will use SSH to talk to the remote systemd
instance.</para>
diff --git a/man/systemd-analyze.xml b/man/systemd-analyze.xml
index 3141361..1898ca6 100644
--- a/man/systemd-analyze.xml
+++ b/man/systemd-analyze.xml
@@ -209,7 +209,7 @@
<term><option>-H</option></term>
<term><option>--host=</option></term>
- <listitem><para>Execute operation
+ <listitem><para>Execute the operation
remotely. Specify a hostname, or
username and hostname separated by
<literal>@</literal>, to connect
@@ -222,7 +222,7 @@
<term><option>-M</option></term>
<term><option>--machine=</option></term>
- <listitem><para>Execute operation on a
+ <listitem><para>Execute the operation on a
local container. Specify a container
name to connect to.</para></listitem>
</varlistentry>
diff --git a/man/systemd-halt.service.xml b/man/systemd-halt.service.xml
index 812281e..2fd7b8b 100644
--- a/man/systemd-halt.service.xml
+++ b/man/systemd-halt.service.xml
@@ -74,11 +74,11 @@
<filename>kexec.target</filename> to execute the
respective actions.</para>
- <para>When these services are run they ensure that PID
+ <para>When these services are run, they ensure that PID
1 is replaced by the
<filename>/usr/lib/systemd/systemd-shutdown</filename>
tool which is then responsible for the actual
- shutdown. Before shutting down this binary will try to
+ shutdown. Before shutting down, this binary will try to
unmount all remaining file systems, disable all
remaining swap devices, detach all remaining storage
devices and kill all remaining processes.</para>
diff --git a/man/systemd-run.xml b/man/systemd-run.xml
index 031c207..daf2bdc 100644
--- a/man/systemd-run.xml
+++ b/man/systemd-run.xml
@@ -125,7 +125,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
<term><option>-H</option></term>
<term><option>--host=</option></term>
- <listitem><para>Execute operation
+ <listitem><para>Execute the operation
remotely. Specify a hostname, or
username and hostname separated by <literal>@</literal>,
to connect to. This will use SSH to
@@ -137,7 +137,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
<term><option>-M</option></term>
<term><option>--machine=</option></term>
- <listitem><para>Execute operation on a
+ <listitem><para>Execute the operation on a
local container. Specify a container
name to connect to.</para></listitem>
</varlistentry>
diff --git a/man/systemd-socket-proxyd.xml b/man/systemd-socket-proxyd.xml
index fcf4aaf..6983346 100644
--- a/man/systemd-socket-proxyd.xml
+++ b/man/systemd-socket-proxyd.xml
@@ -64,7 +64,7 @@
local or remote destination socket.</para>
<para>One use of this tool is to provide
- socket-activation support for services that do not
+ socket activation support for services that do not
natively support socket activation. On behalf of the
service to activate, the proxy inherits the socket
from systemd, accepts each client connection, opens a
diff --git a/man/systemd-system.conf.xml b/man/systemd-system.conf.xml
index c1f2648..2a0a10c 100644
--- a/man/systemd-system.conf.xml
+++ b/man/systemd-system.conf.xml
@@ -101,15 +101,15 @@
<listitem><para>Configures the default
time-outs for starting and stopping of
units, as well as the default time to
- sleep between automatic restarts of a
+ sleep between automatic restarts of
units, as configured per-unit in
<varname>TimeoutStartSec=</varname>,
<varname>TimeoutStopSec=</varname> and
<varname>RestartSec=</varname> (for
- service units see
+ service units, see
<citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>
for details on the per-unit
- settings). For non-service units
+ settings). For non-service units,
<varname>DefaultTimeoutStartSec=</varname>
sets the default
<varname>TimeoutSec=</varname> value.
diff --git a/man/systemd.mount.xml b/man/systemd.mount.xml
index daf1189..bd50f35 100644
--- a/man/systemd.mount.xml
+++ b/man/systemd.mount.xml
@@ -260,8 +260,8 @@
Takes a unit-less value in seconds, or
a time span value such as "5min
20s". Pass 0 to disable the timeout
- logic. Default value is setted up in manager configuration
- file via <varname>DefaultTimeoutStart=</varname>.</para></listitem>
+ logic. The default value is set from the manager configuration
+ file's <varname>DefaultTimeoutStart=</varname> variable.</para></listitem>
</varlistentry>
</variablelist>
diff --git a/man/systemd.service.xml b/man/systemd.service.xml
index 0cb3d9e..d1f4a2d 100644
--- a/man/systemd.service.xml
+++ b/man/systemd.service.xml
@@ -524,10 +524,10 @@
Takes a unit-less value in seconds, or a
time span value such as "5min
20s". Pass 0 to disable the timeout
- logic. Defaults to <varname>TimeoutStartSec=</varname> in
+ logic. Defaults to <varname>TimeoutStartSec=</varname> from the
manager configuration file, except when
<varname>Type=oneshot</varname> is
- used in which case the timeout
+ used, in which case the timeout
is disabled by default.
</para></listitem>
</varlistentry>
@@ -546,7 +546,7 @@
Takes a unit-less value in seconds, or a
time span value such as "5min
20s". Pass 0 to disable the timeout
- logic. Defaults to <varname>TimeoutStartSec=</varname> in
+ logic. Defaults to <varname>TimeoutStartSec=</varname> from the
manager configuration file.
</para></listitem>
</varlistentry>
diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml
index 1c78562..7c10c58 100644
--- a/man/systemd.socket.xml
+++ b/man/systemd.socket.xml
@@ -679,7 +679,7 @@
Takes a unit-less value in seconds, or
a time span value such as "5min
20s". Pass 0 to disable the timeout
- logic. Defaults to <varname>TimeoutStartSec=</varname> in
+ logic. Defaults to <varname>TimeoutStartSec=</varname> from the
manager configuration file.</para></listitem>
</varlistentry>
diff --git a/man/systemd.swap.xml b/man/systemd.swap.xml
index 13f6c84..0411232 100644
--- a/man/systemd.swap.xml
+++ b/man/systemd.swap.xml
@@ -186,7 +186,7 @@
Takes a unit-less value in seconds, or
a time span value such as "5min
20s". Pass 0 to disable the timeout
- logic. Defaults to <varname>TimeoutStartSec=</varname> in
+ logic. Defaults to <varname>TimeoutStartSec=</varname> from the
manager configuration file.</para></listitem>
</varlistentry>
</variablelist>
diff --git a/man/timedatectl.xml b/man/timedatectl.xml
index 2dd6beb..afcb716 100644
--- a/man/timedatectl.xml
+++ b/man/timedatectl.xml
@@ -101,7 +101,7 @@
<term><option>-H</option></term>
<term><option>--host=</option></term>
- <listitem><para>Execute operation
+ <listitem><para>Execute the operation
remotely. Specify a hostname, or
username and hostname separated by <literal>@</literal>,
to connect to. This will use SSH to
commit f576cd2092bc40f9998415cdc3caf10035d4743a
Author: Pavel Holica <conscript89 at gmail.com>
Date: Wed Nov 6 23:24:16 2013 +0100
acpi-fpdt: break on zero or negative length read
https://bugzilla.redhat.com/show_bug.cgi?id=1027478
diff --git a/src/shared/acpi-fpdt.c b/src/shared/acpi-fpdt.c
index 75648b4..7bae47f 100644
--- a/src/shared/acpi-fpdt.c
+++ b/src/shared/acpi-fpdt.c
@@ -109,6 +109,8 @@ int acpi_get_boot_usec(usec_t *loader_start, usec_t *loader_exit) {
for (rec = (struct acpi_fpdt_header *)(buf + sizeof(struct acpi_table_header));
(char *)rec < buf + l;
rec = (struct acpi_fpdt_header *)((char *)rec + rec->length)) {
+ if (rec->length <= 0)
+ break;
if (rec->type != ACPI_FPDT_TYPE_BOOT)
continue;
if (rec->length != sizeof(struct acpi_fpdt_header))
More information about the systemd-commits
mailing list