#include "conf-files.h"
#include "copy.h"
#include "def.h"
+#include "devnum-util.h"
#include "dirent-util.h"
#include "dissect-image.h"
#include "env-util.h"
#include "set.h"
#include "sort-util.h"
#include "specifier.h"
-#include "stat-util.h"
#include "stdio-util.h"
#include "string-table.h"
#include "string-util.h"
return CMP(a->type, b->type);
}
- static bool item_compatible(Item *a, Item *b) {
+ static bool item_compatible(const Item *a, const Item *b) {
assert(a);
assert(b);
assert(streq(a->path, b->path));
return 0;
}
+ static bool is_duplicated_item(ItemArray *existing, const Item *i) {
+
+ assert(existing);
+ assert(i);
+
+ for (size_t n = 0; n < existing->n_items; n++) {
+ const Item *e = existing->items + n;
+
+ if (item_compatible(e, i))
+ continue;
+
+ /* Only multiple 'w+' lines for the same path are allowed. */
+ if (e->type != WRITE_FILE || !e->append_or_force ||
+ i->type != WRITE_FILE || !i->append_or_force)
+ return true;
+ }
+
+ return false;
+ }
+
static int parse_line(
const char *fname,
unsigned line,
{ 'a', specifier_architecture, NULL },
{ 'b', specifier_boot_id, NULL },
{ 'B', specifier_os_build_id, NULL },
- { 'H', specifier_host_name, NULL },
- { 'l', specifier_short_host_name, NULL },
+ { 'H', specifier_hostname, NULL },
+ { 'l', specifier_short_hostname, NULL },
{ 'm', specifier_machine_id_safe, NULL },
{ 'o', specifier_os_id, NULL },
{ 'v', specifier_kernel_release, NULL },
return log_syntax(NULL, LOG_ERR, fname, line, SYNTHETIC_ERRNO(EBADMSG), "Device file requires argument.");
}
- r = parse_dev(i.argument, &i.major_minor);
+ r = parse_devnum(i.argument, &i.major_minor);
if (r < 0) {
*invalid_config = true;
return log_syntax(NULL, LOG_ERR, fname, line, r, "Can't parse device file major/minor '%s'.", i.argument);
existing = ordered_hashmap_get(h, i.path);
if (existing) {
- size_t n;
-
- for (n = 0; n < existing->n_items; n++) {
- if (!item_compatible(existing->items + n, &i) && !i.append_or_force) {
- log_syntax(NULL, LOG_NOTICE, fname, line, 0, "Duplicate line for path \"%s\", ignoring.", i.path);
- return 0;
- }
+ if (is_duplicated_item(existing, &i)) {
+ log_syntax(NULL, LOG_NOTICE, fname, line, 0,
+ "Duplicate line for path \"%s\", ignoring.", i.path);
+ return 0;
}
} else {
existing = new0(ItemArray, 1);
fi
}
+install_mdadm() {
+ local unit
+ local mdadm_units=(
+ system/mdadm-grow-continue@.service
+ system/mdadm-last-resort@.service
+ system/mdadm-last-resort@.timer
+ system/mdmon@.service
+ system/mdmonitor-oneshot.service
+ system/mdmonitor-oneshot.timer
+ system/mdmonitor.service
+ system-shutdown/mdadm.shutdown
+ )
+
+ image_install mdadm mdmon
+ inst_rules 01-md-raid-creating.rules 63-md-raid-arrays.rules 64-md-raid-assembly.rules 69-md-clustered-confirm-device.rules
+ # Fedora/CentOS/RHEL ships this rule file
+ [[ -f /lib/udev/rules.d/65-md-incremental.rules ]] && inst_rules 65-md-incremental.rules
+
+ for unit in "${mdadm_units[@]}"; do
+ image_install "${ROOTLIBDIR:?}/$unit"
+ done
+}
+
install_compiled_systemd() {
dinfo "Install compiled systemd"
# usually due to the sandbox being too restrictive (e.g. ProtectSystem=yes,
# ProtectHome=yes) or the $BUILD_DIR being inaccessible to non-root users - see
# `setfacl` stuff in install_compiled_systemd().
-
- if "${JOURNALCTL:?}" -q --no-pager -D "${root:?}/var/log/journal" --grep "profiling:.+?gcda:[Cc]annot open"; then
+ if ! get_bool "${IGNORE_MISSING_COVERAGE:=}" && \
+ "${JOURNALCTL:?}" -q --no-pager -D "${root:?}/var/log/journal" --grep "profiling:.+?gcda:[Cc]annot open"; then
derror "Detected possibly missing coverage, check the journal"
return 1
fi
paths+=(/lib*/security)
fi
- for d in /etc/pam.d /etc/security /usr/{etc,lib}/pam.d; do
+ for d in /etc/pam.d /{usr/,}etc/security /usr/{etc,lib}/pam.d; do
[ -d "$d" ] && paths+=("$d")
done