Skip to content

Instantly share code, notes, and snippets.

@bluecmd
Created March 27, 2016 20:05
Show Gist options
  • Save bluecmd/787fbd181b32c77cdc16 to your computer and use it in GitHub Desktop.
Save bluecmd/787fbd181b32c77cdc16 to your computer and use it in GitHub Desktop.
diff --git a/Makefile.am b/Makefile.am
index 03341fc..757d318 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -202,7 +202,8 @@ AM_CPPFLAGS = \
-DLIBDIR=\"$(libdir)\" \
-DROOTLIBDIR=\"$(rootlibdir)\" \
-DROOTLIBEXECDIR=\"$(rootlibexecdir)\" \
- -DTEST_DIR=\"$(abs_top_srcdir)/test\" \
+ -DROOTHOMEDIR=\"$(roothomedir)\" \
+ -DTEST_DIR=\"/usr/lib/systemd/ptest/tests/test\" \
-I $(top_srcdir)/src \
-I $(top_builddir)/src/basic \
-I $(top_srcdir)/src/basic \
@@ -243,7 +244,7 @@ define move-to-rootlibdir
$(MKDIR_P) $(DESTDIR)$(rootlibdir) && \
so_img_name=$$(readlink $(DESTDIR)$(libdir)/$$libname) && \
rm -f $(DESTDIR)$(libdir)/$$libname && \
- $(LN_S) --relative -f $(DESTDIR)$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/$$libname && \
+ lnr $(DESTDIR)$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/$$libname && \
mv $(DESTDIR)$(libdir)/$$libname.* $(DESTDIR)$(rootlibdir); \
fi
endef
@@ -317,7 +318,7 @@ define install-relative-aliases
while [ -n "$$1" ]; do \
$(MKDIR_P) `dirname $(DESTDIR)$$dir/$$2` && \
rm -f $(DESTDIR)$$dir/$$2 && \
- $(LN_S) --relative $(DESTDIR)$$1 $(DESTDIR)$$dir/$$2 && \
+ lnr $(DESTDIR)$$1 $(DESTDIR)$$dir/$$2 && \
shift 2 || exit $$?; \
done
endef
@@ -2781,7 +2782,7 @@ systemd_dbus1_generator_LDADD = \
dbus1-generator-install-hook:
$(AM_V_at)$(MKDIR_P) $(DESTDIR)$(usergeneratordir)
$(AM_V_RM)rm -f $(DESTDIR)$(usergeneratordir)/systemd-dbus1-generator
- $(AM_V_LN)$(LN_S) --relative -f $(DESTDIR)$(systemgeneratordir)/systemd-dbus1-generator $(DESTDIR)$(usergeneratordir)/systemd-dbus1-generator
+ $(AM_V_LN)lnr $(DESTDIR)$(systemgeneratordir)/systemd-dbus1-generator $(DESTDIR)$(usergeneratordir)/systemd-dbus1-generator
dbus1-generator-uninstall-hook:
rm -f $(DESTDIR)$(usergeneratordir)/systemd-dbus1-generator
@@ -3572,6 +3573,18 @@ libudev_core_la_LIBADD = \
$(BLKID_LIBS) \
$(KMOD_LIBS)
+libudev_core_la_CPPFLAGS = \
+ $(AM_CPPFLAGS) \
+ -DFIRMWARE_PATH="$(FIRMWARE_PATH)"
+
+if ENABLE_FIRMWARE
+libudev_core_la_SOURCES += \
+ src/udev/udev-builtin-firmware.c
+
+dist_udevrules_DATA += \
+ rules/50-firmware.rules
+endif
+
if HAVE_KMOD
libudev_core_la_SOURCES += \
src/udev/udev-builtin-kmod.c
@@ -4012,7 +4025,7 @@ test_catalog_SOURCES = \
test_catalog_CPPFLAGS = \
$(AM_CPPFLAGS) \
- -DCATALOG_DIR=\"$(abs_top_srcdir)/catalog\"
+ -DCATALOG_DIR=\"/usr/lib/systemd/ptest/tests/catalog\"
test_catalog_LDADD = \
libjournal-core.la
@@ -4387,10 +4400,6 @@ INSTALL_DIRS += \
$(prefix)/lib/binfmt.d \
$(sysconfdir)/binfmt.d
-SYSINIT_TARGET_WANTS += \
- systemd-binfmt.service \
- proc-sys-fs-binfmt_misc.automount
-
endif
EXTRA_DIST += \
@@ -4880,6 +4889,7 @@ SYSTEM_UNIT_ALIASES += \
BUSNAMES_TARGET_WANTS += \
org.freedesktop.machine1.busname
+if HAVE_MYHOSTNAME
libnss_mymachines_la_SOURCES = \
src/nss-mymachines/nss-mymachines.sym \
src/nss-mymachines/nss-mymachines.c
@@ -4900,6 +4910,7 @@ lib_LTLIBRARIES += \
libnss_mymachines.la
endif
+endif
polkitpolicy_in_files += \
src/machine/org.freedesktop.machine1.policy.in
@@ -5715,6 +5726,7 @@ EXTRA_DIST += \
substitutions = \
'|rootlibexecdir=$(rootlibexecdir)|' \
'|rootbindir=$(rootbindir)|' \
+ '|roothomedir=$(roothomedir)|' \
'|bindir=$(bindir)|' \
'|SYSTEMCTL=$(rootbindir)/systemctl|' \
'|SYSTEMD_NOTIFY=$(rootbindir)/systemd-notify|' \
diff --git a/README b/README
index 41fb07a..10230ac 100644
--- a/README
+++ b/README
@@ -50,14 +50,14 @@ REQUIREMENTS:
CONFIG_PROC_FS
CONFIG_FHANDLE (libudev, mount and bind mount handling)
- udev will fail to work with the legacy sysfs layout:
+ Udev will fail to work with the legacy layout:
CONFIG_SYSFS_DEPRECATED=n
Legacy hotplug slows down the system and confuses udev:
CONFIG_UEVENT_HELPER_PATH=""
- Userspace firmware loading is not supported and should
- be disabled in the kernel:
+ Userspace firmware loading is deprecated, will go away, and
+ sometimes causes problems:
CONFIG_FW_LOADER_USER_HELPER=n
Some udev rules and virtualization detection relies on it:
diff --git a/TODO b/TODO
index 92cc8cc..25f6849 100644
--- a/TODO
+++ b/TODO
@@ -628,6 +628,7 @@ Features:
* rename "userspace" to "core-os"
* udev:
+ - remove src/udev/udev-builtin-firmware.c (CONFIG_FW_LOADER_USER_HELPER=n)
- move to LGPL
- kill scsi_id
- add trigger --subsystem-match=usb/usb_device device
diff --git a/configure.ac b/configure.ac
index f51533c..321c21b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -110,7 +110,23 @@ AC_PATH_PROG([SULOGIN], [sulogin], [/usr/sbin/sulogin], [$PATH:/usr/sbin:/sbin])
AC_PATH_PROG([MOUNT_PATH], [mount], [/usr/bin/mount], [$PATH:/usr/sbin:/sbin])
AC_PATH_PROG([UMOUNT_PATH], [umount], [/usr/bin/umount], [$PATH:/usr/sbin:/sbin])
-AS_IF([! ln --relative --help > /dev/null 2>&1], [AC_MSG_ERROR([*** ln doesn't support --relative ***])])
+# check for few functions not implemented in uClibc
+
+AC_CHECK_FUNCS_ONCE(mkostemp execvpe posix_fallocate)
+
+# check for %ms format support - assume always no if cross compiling
+
+AC_MSG_CHECKING([whether %ms format is supported by *scanf])
+
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([
+ #include <stdio.h>
+ ],[
+ char *buf1, *buf2, *buf3, str="1 2.3 abcde" ;
+ int rc = sscanf(str, "%ms %ms %ms", &buf1, &buf2, &buf3) ;
+ return (rc==3)?0:1;])],
+ [AC_DEFINE([HAVE_MSFORMAT], [1], [Define if %ms format is supported by *scanf.])],
+ [AC_MSG_RESULT([no])])
M4_DEFINES=
@@ -281,6 +297,7 @@ AM_CONDITIONAL([HAVE_PYTHON], [test "x$have_python" = "xyes"])
# ------------------------------------------------------------------------------
+AC_CHECK_HEADERS([uchar.h], [], [])
AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])])
AC_CHECK_HEADERS([linux/btrfs.h], [], [])
AC_CHECK_HEADERS([linux/memfd.h], [], [])
@@ -1337,6 +1354,25 @@ AC_ARG_ENABLE(hwdb, [AC_HELP_STRING([--disable-hwdb], [disable hardware database
AM_CONDITIONAL(ENABLE_HWDB, [test x$enable_hwdb = xyes])
# ------------------------------------------------------------------------------
+AC_ARG_WITH(firmware-path,
+ AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]],
+ [Firmware search path (default="")]),
+ [], [with_firmware_path=""])
+OLD_IFS=$IFS
+IFS=:
+for i in $with_firmware_path; do
+ if test "x${FIRMWARE_PATH}" = "x"; then
+ FIRMWARE_PATH="\\\"${i}/\\\""
+ else
+ FIRMWARE_PATH="${FIRMWARE_PATH}, \\\"${i}/\\\""
+ fi
+done
+IFS=$OLD_IFS
+AC_SUBST(FIRMWARE_PATH)
+AS_IF([test "x${FIRMWARE_PATH}" != "x"], [ AC_DEFINE(HAVE_FIRMWARE, 1, [Define if FIRMWARE is available]) ])
+AM_CONDITIONAL(ENABLE_FIRMWARE, [test "x${FIRMWARE_PATH}" != "x"])
+
+# ------------------------------------------------------------------------------
have_manpages=no
AC_ARG_ENABLE(manpages, AS_HELP_STRING([--disable-manpages], [disable manpages]))
AC_PATH_PROG([XSLTPROC], [xsltproc])
@@ -1454,6 +1490,16 @@ AC_ARG_WITH([rootlibdir],
[with_rootlibdir=${libdir}])
AX_NORMALIZE_PATH([with_rootlibdir])
+AC_ARG_WITH([roothomedir],
+ AS_HELP_STRING([--with-roothomedir=DIR], [Home directory for the root user]),
+ [],
+ [with_roothomedir=/root])
+
+AC_ARG_WITH([testdir],
+ AS_HELP_STRING([--with-testdir=DIR], [test file directory]),
+ [],
+ [with_testdir=${abs_top_srcdir}])
+
AC_ARG_WITH([pamlibdir],
AS_HELP_STRING([--with-pamlibdir=DIR], [Directory for PAM modules]),
[],
@@ -1537,6 +1583,8 @@ 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_SUBST([testdir], [$with_testdir])
AC_CONFIG_FILES([
Makefile
@@ -1627,9 +1675,14 @@ AC_MSG_RESULT([
includedir: ${includedir}
lib dir: ${libdir}
rootlib dir: ${with_rootlibdir}
+ root home dir: ${with_roothomedir}
+ test dir: ${with_testdir}
SysV init scripts: ${SYSTEM_SYSVINIT_PATH}
SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH}
Build Python: ${PYTHON}
+ Installation Python: ${PYTHON_BINARY}
+ sphinx binary: ${SPHINX_BUILD}
+ firmware path: ${FIRMWARE_PATH}
PAM modules dir: ${with_pamlibdir}
PAM configuration dir: ${with_pamconfdir}
D-Bus policy dir: ${with_dbuspolicydir}
diff --git a/rules/60-persistent-storage.rules b/rules/60-persistent-storage.rules
index 0b14bb4..1c4d97a 100644
--- a/rules/60-persistent-storage.rules
+++ b/rules/60-persistent-storage.rules
@@ -6,7 +6,7 @@
ACTION=="remove", GOTO="persistent_storage_end"
SUBSYSTEM!="block", GOTO="persistent_storage_end"
-KERNEL!="loop*|mmcblk*[0-9]|msblk*[0-9]|mspblk*[0-9]|nvme*|sd*|sr*|vd*|xvd*|bcache*|cciss*|dasd*|ubd*", GOTO="persistent_storage_end"
+KERNEL!="loop*|mmcblk*[0-9]|msblk*[0-9]|mspblk*[0-9]|nvme*|hd*|sd*|sr*|vd*|xvd*|bcache*|cciss*|dasd*|ubd*", GOTO="persistent_storage_end"
# ignore partitions that span the entire disk
TEST=="whole_disk", GOTO="persistent_storage_end"
diff --git a/src/basic/escape.h b/src/basic/escape.h
index deaa4de..36d437c 100644
--- a/src/basic/escape.h
+++ b/src/basic/escape.h
@@ -23,7 +23,6 @@
#include <stddef.h>
#include <stdint.h>
#include <sys/types.h>
-#include <uchar.h>
#include "string-util.h"
#include "missing.h"
diff --git a/src/basic/missing.h b/src/basic/missing.h
index f3d3236..77be0c8 100644
--- a/src/basic/missing.h
+++ b/src/basic/missing.h
@@ -34,7 +34,9 @@
#include <stdlib.h>
#include <sys/resource.h>
#include <sys/syscall.h>
+#ifdef HAVE_UCHAR_H
#include <uchar.h>
+#endif
#include <unistd.h>
#ifdef HAVE_AUDIT
@@ -585,12 +587,11 @@ static inline int name_to_handle_at(int fd, const char *name, struct file_handle
return syscall(__NR_name_to_handle_at, fd, name, handle, mnt_id, flags);
}
#endif
-
#ifndef HAVE_SECURE_GETENV
# ifdef HAVE___SECURE_GETENV
# define secure_getenv __secure_getenv
# else
-# error "neither secure_getenv nor __secure_getenv are available"
+# define secure_getenv getenv
# endif
#endif
@@ -1169,3 +1170,8 @@ static inline key_serial_t request_key(const char *type, const char *description
#endif
#endif
+
+#ifdef __UCLIBC__
+/* 10^x = 10^(log e^x) = (e^x)^log10 = e^(x * log 10) */
+#define exp10(x) (exp((x) * log(10)))
+#endif /* __UCLIBC__ */
diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c
index 5851268..aefaca5 100644
--- a/src/basic/socket-util.c
+++ b/src/basic/socket-util.c
@@ -44,6 +44,15 @@
#include "string-util.h"
#include "user-util.h"
#include "util.h"
+/* Don't fail if the standard library
+ * doesn't support IDN */
+#ifndef NI_IDN
+#define NI_IDN 0
+#endif
+
+#ifndef NI_IDN_USE_STD3_ASCII_RULES
+#define NI_IDN_USE_STD3_ASCII_RULES 0
+#endif
int socket_address_parse(SocketAddress *a, const char *s) {
char *e, *n;
diff --git a/src/basic/user-util.c b/src/basic/user-util.c
index 19155bc..22c4a23 100644
--- a/src/basic/user-util.c
+++ b/src/basic/user-util.c
@@ -38,6 +38,7 @@
#include "path-util.h"
#include "string-util.h"
#include "user-util.h"
+#include "missing.h"
bool uid_is_valid(uid_t uid) {
@@ -122,7 +123,7 @@ int get_user_creds(
*gid = 0;
if (home)
- *home = "/root";
+ *home = ROOTHOMEDIR;
if (shell)
*shell = "/bin/sh";
@@ -353,7 +354,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/src/basic/utf8.h b/src/basic/utf8.h
index 12c272d..bea93a6 100644
--- a/src/basic/utf8.h
+++ b/src/basic/utf8.h
@@ -22,7 +22,6 @@
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
-#include <uchar.h>
#include "macro.h"
#include "missing.h"
diff --git a/src/basic/util.c b/src/basic/util.c
index ea1bed7..fdaf340 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -767,10 +767,25 @@ uint64_t physical_memory(void) {
/* We return this as uint64_t in case we are running as 32bit
* process on a 64bit kernel with huge amounts of memory */
+#ifdef __UCLIBC__
+ char line[128];
+ FILE *f = fopen("/proc/meminfo", "r");
+ if (f == NULL)
+ return 0;
+ while (!feof(f) && fgets(line, sizeof(line)-1, f)) {
+ if (sscanf(line, "MemTotal: %li kB", &mem) == 1) {
+ mem *= 1024;
+ break;
+ }
+ }
+ fclose(f);
+ return (uint64_t) mem;
+#else
mem = sysconf(_SC_PHYS_PAGES);
assert(mem > 0);
return (uint64_t) mem * (uint64_t) page_size();
+#endif
}
int update_reboot_param_file(const char *param) {
diff --git a/src/core/namespace.c b/src/core/namespace.c
index b573f00..0f70b14 100644
--- a/src/core/namespace.c
+++ b/src/core/namespace.c
@@ -409,7 +409,7 @@ int setup_namespace(
home_dir = strjoina("-", home_dir);
run_user_dir = prefix_roota(root_directory, "/run/user");
run_user_dir = strjoina("-", run_user_dir);
- root_dir = prefix_roota(root_directory, "/root");
+ root_dir = prefix_roota(root_directory, ROOTHOMEDIR);
root_dir = strjoina("-", root_dir);
r = append_mounts(&m, STRV_MAKE(home_dir, run_user_dir, root_dir),
diff --git a/src/login/systemd-user.m4 b/src/login/systemd-user.m4
index 7933508..16b73d2 100644
--- a/src/login/systemd-user.m4
+++ b/src/login/systemd-user.m4
@@ -2,10 +2,10 @@
#
# Used by systemd --user instances.
-account include system-auth
+account include common-account
m4_ifdef(`HAVE_SELINUX',
session required pam_selinux.so close
session required pam_selinux.so nottys open
)m4_dnl
-session include system-auth
+session include common-session
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 5a68fec..12f0ee8 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -111,6 +111,8 @@ typedef enum LinkJournal {
LINK_GUEST
} LinkJournal;
+#include "config.h"
+
static char *arg_directory = NULL;
static char *arg_template = NULL;
static char *arg_chdir = NULL;
@@ -2562,7 +2564,7 @@ static int inner_child(
if (envp[n_env])
n_env ++;
- 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))
return log_oom();
@@ -2637,10 +2639,15 @@ static int inner_child(
a[0] = (char*) "/sbin/init";
execve(a[0], a, env_use);
} else if (!strv_isempty(arg_parameters))
+#ifdef HAVE_EXECVPE
execvpe(arg_parameters[0], arg_parameters, env_use);
+#else
+ environ = env_use;
+ execvp(arg_parameters[0], arg_parameters);
+#endif /* HAVE_EXECVPE */
else {
if (!arg_chdir)
- chdir(home ?: "/root");
+ chdir(home ?: ROOTHOMEDIR);
execle("/bin/bash", "-bash", NULL, env_use);
execle("/bin/sh", "-sh", NULL, env_use);
diff --git a/src/systemctl/systemd-sysv-install.SKELETON b/src/systemctl/systemd-sysv-install.SKELETON
index a53a3e6..5d877b0 100755
--- a/src/systemctl/systemd-sysv-install.SKELETON
+++ b/src/systemctl/systemd-sysv-install.SKELETON
@@ -30,17 +30,17 @@ case "$1" in
enable)
# call the command to enable SysV init script $NAME here
# (consider optional $ROOT)
- echo "IMPLEMENT ME: enabling SysV init.d script $NAME"
+ update-rc.d -f $NAME defaults
;;
disable)
# call the command to disable SysV init script $NAME here
# (consider optional $ROOT)
- echo "IMPLEMENT ME: disabling SysV init.d script $NAME"
+ update-rc.d -f $NAME remove
;;
is-enabled)
# exit with 0 if $NAME is enabled, non-zero if it is disabled
# (consider optional $ROOT)
- echo "IMPLEMENT ME: checking SysV init.d script $NAME"
+ /etc/init.d/$NAME status
;;
*)
usage ;;
diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
index b5925a4..ea06d6a 100644
--- a/src/sysv-generator/sysv-generator.c
+++ b/src/sysv-generator/sysv-generator.c
@@ -44,7 +44,8 @@
typedef enum RunlevelType {
RUNLEVEL_UP,
- RUNLEVEL_DOWN
+ RUNLEVEL_DOWN,
+ RUNLEVEL_SYSINIT
} RunlevelType;
static const struct {
@@ -59,6 +60,9 @@ static const struct {
{ "rc4.d", SPECIAL_MULTI_USER_TARGET, RUNLEVEL_UP },
{ "rc5.d", SPECIAL_GRAPHICAL_TARGET, RUNLEVEL_UP },
+ /* Debian style rcS.d, also adopted by OE */
+ { "rcS.d", SPECIAL_SYSINIT_TARGET, RUNLEVEL_SYSINIT},
+
/* Standard SysV runlevels for shutdown */
{ "rc0.d", SPECIAL_POWEROFF_TARGET, RUNLEVEL_DOWN },
{ "rc6.d", SPECIAL_REBOOT_TARGET, RUNLEVEL_DOWN }
@@ -67,7 +71,7 @@ static const struct {
directories in this order, and we want to make sure that
sysv_start_priority is known when we first load the
unit. And that value we only know from S links. Hence
- UP must be read before DOWN */
+ UP/SYSINIT must be read before DOWN */
};
static const char *arg_dest = "/tmp";
@@ -86,6 +90,8 @@ typedef struct SysvStub {
bool has_lsb;
bool reload;
bool loaded;
+ bool default_dependencies;
+ bool from_rcsd;
} SysvStub;
static void free_sysvstub(SysvStub *s) {
@@ -711,17 +717,31 @@ static int fix_order(SysvStub *s, Hashmap *all_services) {
if (s->has_lsb && other->has_lsb)
continue;
- if (other->sysv_start_priority < s->sysv_start_priority) {
- r = strv_extend(&s->after, other->name);
+ /* All scripts under /etc/rcS.d should execute before scripts under
+ * /etc/rcN.d */
+ if (!other->from_rcsd && s->from_rcsd) {
+ r = strv_extend(&s->before, other->name);
if (r < 0)
return log_oom();
- } else if (other->sysv_start_priority > s->sysv_start_priority) {
- r = strv_extend(&s->before, other->name);
+ } else if (other->from_rcsd && !s->from_rcsd) {
+ r = strv_extend(&s->after, other->name);
if (r < 0)
return log_oom();
- } else
- continue;
+ } else {
+ if (other->sysv_start_priority < s->sysv_start_priority) {
+ r = strv_extend(&s->after, other->name);
+ if (r < 0)
+ return log_oom();
+ }
+ else if (other->sysv_start_priority > s->sysv_start_priority) {
+ r = strv_extend(&s->before, other->name);
+ if (r < 0)
+ return log_oom();
+ }
+ else
+ continue;
+ }
/* FIXME: Maybe we should compare the name here lexicographically? */
}
@@ -788,6 +808,8 @@ static int enumerate_sysv(const LookupPaths *lp, Hashmap *all_services) {
return log_oom();
service->sysv_start_priority = -1;
+ service->default_dependencies = true;
+ service->from_rcsd = false;
service->name = name;
service->path = fpath;
name = fpath = NULL;
@@ -871,9 +893,11 @@ static int set_dependencies_from_rcnd(const LookupPaths *lp, Hashmap *all_servic
if (de->d_name[0] == 'S') {
- if (rcnd_table[i].type == RUNLEVEL_UP)
+ if (rcnd_table[i].type == RUNLEVEL_UP || rcnd_table[i].type == RUNLEVEL_SYSINIT) {
service->sysv_start_priority = MAX(a*10 + b, service->sysv_start_priority);
-
+ service->default_dependencies = (rcnd_table[i].type == RUNLEVEL_SYSINIT)?false:true;
+ service->from_rcsd = (rcnd_table[i].type == RUNLEVEL_SYSINIT)?true:false;
+ }
r = set_ensure_allocated(&runlevel_services[i], NULL);
if (r < 0) {
log_oom();
@@ -887,7 +911,8 @@ static int set_dependencies_from_rcnd(const LookupPaths *lp, Hashmap *all_servic
}
} else if (de->d_name[0] == 'K' &&
- (rcnd_table[i].type == RUNLEVEL_DOWN)) {
+ (rcnd_table[i].type == RUNLEVEL_DOWN ||
+ rcnd_table[i].type == RUNLEVEL_SYSINIT)) {
r = set_ensure_allocated(&shutdown_services, NULL);
if (r < 0) {
diff --git a/src/udev/udev-builtin.c b/src/udev/udev-builtin.c
index e6b36f1..cd9947e 100644
--- a/src/udev/udev-builtin.c
+++ b/src/udev/udev-builtin.c
@@ -31,6 +31,9 @@ static const struct udev_builtin *builtins[] = {
[UDEV_BUILTIN_BLKID] = &udev_builtin_blkid,
#endif
[UDEV_BUILTIN_BTRFS] = &udev_builtin_btrfs,
+#ifdef HAVE_FIRMWARE
+ [UDEV_BUILTIN_FIRMWARE] = &udev_builtin_firmware,
+#endif
[UDEV_BUILTIN_HWDB] = &udev_builtin_hwdb,
[UDEV_BUILTIN_INPUT_ID] = &udev_builtin_input_id,
[UDEV_BUILTIN_KEYBOARD] = &udev_builtin_keyboard,
diff --git a/src/udev/udev.h b/src/udev/udev.h
index 1f9c812..fa35a88 100644
--- a/src/udev/udev.h
+++ b/src/udev/udev.h
@@ -147,6 +147,9 @@ enum udev_builtin_cmd {
UDEV_BUILTIN_BLKID,
#endif
UDEV_BUILTIN_BTRFS,
+#ifdef HAVE_FIRMWARE
+ UDEV_BUILTIN_FIRMWARE,
+#endif
UDEV_BUILTIN_HWDB,
UDEV_BUILTIN_INPUT_ID,
UDEV_BUILTIN_KEYBOARD,
@@ -175,6 +178,9 @@ struct udev_builtin {
extern const struct udev_builtin udev_builtin_blkid;
#endif
extern const struct udev_builtin udev_builtin_btrfs;
+#ifdef HAVE_FIRMWARE
+extern const struct udev_builtin udev_builtin_firmware;
+#endif
extern const struct udev_builtin udev_builtin_hwdb;
extern const struct udev_builtin udev_builtin_input_id;
extern const struct udev_builtin udev_builtin_keyboard;
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index bb92f16..84024ac 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -125,6 +125,9 @@ struct event {
bool is_block;
sd_event_source *timeout_warning;
sd_event_source *timeout;
+#ifdef HAVE_FIRMWARE
+ bool nodelay;
+#endif
};
static inline struct event *node_to_event(struct udev_list_node *node) {
@@ -613,6 +616,10 @@ static int event_queue_insert(Manager *manager, struct udev_device *dev) {
event->devnum = udev_device_get_devnum(dev);
event->is_block = streq("block", udev_device_get_subsystem(dev));
event->ifindex = udev_device_get_ifindex(dev);
+#ifdef HAVE_FIRMWARE
+ if (streq(udev_device_get_subsystem(dev), "firmware"))
+ event->nodelay = true;
+#endif
log_debug("seq %llu queued, '%s' '%s'", udev_device_get_seqnum(dev),
udev_device_get_action(dev), udev_device_get_subsystem(dev));
@@ -698,6 +705,12 @@ static bool is_devpath_busy(Manager *manager, struct event *event) {
return true;
}
+#ifdef HAVE_FIRMWARE
+ /* allow to bypass the dependency tracking */
+ if (event->nodelay)
+ continue;
+#endif
+
/* parent device event found */
if (event->devpath[common] == '/') {
event->delaying_seqnum = loop_event->seqnum;
diff --git a/tools/make-directive-index.py b/tools/make-directive-index.py
index 8091683..b371834 100755
--- a/tools/make-directive-index.py
+++ b/tools/make-directive-index.py
@@ -313,7 +313,7 @@ def make_page(*xml_files):
try:
_extract_directives(directive_groups, formatting, page)
except Exception:
- raise ValueError("failed to process " + page)
+ raise
return _make_page(template, directive_groups, formatting)
diff --git a/units/console-shell.service.m4.in b/units/console-shell.service.m4.in
index a345ec2..3caae7d 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 fb390ea..5623a57 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 --wait 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@ --job-mode=fail --no-block default"
diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount
index 6be3893..709adef 100644
--- a/units/proc-sys-fs-binfmt_misc.automount
+++ b/units/proc-sys-fs-binfmt_misc.automount
@@ -16,3 +16,6 @@ ConditionPathIsReadWrite=/proc/sys/
[Automount]
Where=/proc/sys/fs/binfmt_misc
+
+[Install]
+WantedBy=sysinit.target
diff --git a/units/rescue.service.in b/units/rescue.service.in
index 92553f6..590ae17 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 rescue 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@ --job-mode=fail --no-block default"
diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in
index d53073e..8c57ee0 100644
--- a/units/systemd-binfmt.service.in
+++ b/units/systemd-binfmt.service.in
@@ -11,6 +11,8 @@ Documentation=man:systemd-binfmt.service(8) man:binfmt.d(5)
Documentation=https://www.kernel.org/doc/Documentation/binfmt_misc.txt
DefaultDependencies=no
Conflicts=shutdown.target
+Wants=proc-sys-fs-binfmt_misc.automount
+
After=proc-sys-fs-binfmt_misc.automount
Before=sysinit.target shutdown.target
ConditionPathIsReadWrite=/proc/sys/
@@ -25,3 +27,6 @@ Type=oneshot
RemainAfterExit=yes
ExecStart=@rootlibexecdir@/systemd-binfmt
TimeoutSec=90s
+
+[Install]
+WantedBy=sysinit.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment