summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--man/bootctl.xml11
-rw-r--r--man/systemd.exec.xml8
-rw-r--r--src/basic/unit-file.c41
-rw-r--r--src/boot/bootctl.c32
-rw-r--r--src/libsystemd/sd-journal/journal-file.c156
-rw-r--r--src/libsystemd/sd-journal/journal-file.h1
-rw-r--r--src/shared/install.c14
-rw-r--r--src/test/test-install-root.c65
-rw-r--r--test/test-systemctl-enable.sh130
9 files changed, 263 insertions, 195 deletions
diff --git a/man/bootctl.xml b/man/bootctl.xml
index 99cef4c00a..1e6d537d0b 100644
--- a/man/bootctl.xml
+++ b/man/bootctl.xml
@@ -272,7 +272,16 @@
<term><option>--graceful</option></term>
<listitem><para>Ignore failure when the EFI System Partition cannot be found, when EFI variables
cannot be written, or a different or newer boot loader is already installed. Currently only applies
- to random seed and update operations.</para></listitem>
+ to <command>is-installed</command>, <command>update</command>, and <command>random-seed</command>
+ verbs.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-q</option></term>
+ <term><option>--quiet</option></term>
+
+ <listitem><para>Suppress printing of the results of various commands and also the hints about ESP
+ being unavailable.</para></listitem>
</varlistentry>
<varlistentry>
diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml
index 7fe54169b2..50c5c89703 100644
--- a/man/systemd.exec.xml
+++ b/man/systemd.exec.xml
@@ -846,6 +846,14 @@ CapabilityBoundingSet=~CAP_B CAP_C</programlisting>
runtime, and are generally more expressive. For example, <varname>MemoryMax=</varname> is a more
powerful (and working) replacement for <varname>LimitRSS=</varname>.</para>
+ <para>Note that <varname>LimitNPROC=</varname> will limit the number of processes from one (real) UID and
+ not the number of processes started (forked) by the service. Therefore the limit is cumulative for all
+ processes running under the same UID. Please also note that the <varname>LimitNPROC=</varname> will not be
+ enforced if the service is running as root (and not dropping privileges). Due to these limitations,
+ <varname>TasksMax=</varname> (see <citerefentry><refentrytitle>systemd.resource-control</refentrytitle>
+ <manvolnum>5</manvolnum></citerefentry>) is typically a better choice than <varname>LimitNPROC=</varname>.
+ </para>
+
<para>Resource limits not configured explicitly for a unit default to the value configured in the various
<varname>DefaultLimitCPU=</varname>, <varname>DefaultLimitFSIZE=</varname>, … options available in
<citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>, and –
diff --git a/src/basic/unit-file.c b/src/basic/unit-file.c
index 7c1ae515e1..83c29bb25f 100644
--- a/src/basic/unit-file.c
+++ b/src/basic/unit-file.c
@@ -388,6 +388,7 @@ int unit_file_build_name_map(
_cleanup_hashmap_free_ Hashmap *ids = NULL, *names = NULL;
_cleanup_set_free_free_ Set *paths = NULL;
+ _cleanup_strv_free_ char **expanded_search_path = NULL;
uint64_t timestamp_hash;
int r;
@@ -406,6 +407,44 @@ int unit_file_build_name_map(
return log_oom();
}
+ /* Go over all our search paths, chase their symlinks and store the result in the
+ * expanded_search_path list.
+ *
+ * This is important for cases where any of the unit directories itself are symlinks into other
+ * directories and would therefore cause all of the unit files to be recognized as linked units.
+ *
+ * This is important for distributions such as NixOS where most paths in /etc/ are symlinks to some
+ * other location on the filesystem (e.g. into /nix/store/).
+ *
+ * Search paths are ordered by priority (highest first), and we need to maintain this order.
+ * If a resolved path is already in the list, we don't need to include.
+ *
+ * Note that we build a list that contains both the original paths and the resolved symlinks:
+ * we need the latter for the case where the directory is symlinked, as described above, and
+ * the former for the case where some unit file alias is a dangling symlink that points to one
+ * of the "original" directories (and can't be followed).
+ */
+ STRV_FOREACH(dir, lp->search_path) {
+ _cleanup_free_ char *resolved_dir = NULL;
+
+ r = strv_extend(&expanded_search_path, *dir);
+ if (r < 0)
+ return log_oom();
+
+ r = chase_symlinks(*dir, NULL, 0, &resolved_dir, NULL);
+ if (r < 0) {
+ if (r != -ENOENT)
+ log_warning_errno(r, "Failed to resolve symlink %s, ignoring: %m", *dir);
+ continue;
+ }
+
+ if (strv_contains(expanded_search_path, resolved_dir))
+ continue;
+
+ if (strv_consume(&expanded_search_path, TAKE_PTR(resolved_dir)) < 0)
+ return log_oom();
+ }
+
STRV_FOREACH(dir, lp->search_path) {
_cleanup_closedir_ DIR *d = NULL;
@@ -504,7 +543,7 @@ int unit_file_build_name_map(
/* We don't explicitly check for alias loops here. unit_ids_map_get() which
* limits the number of hops should be used to access the map. */
- r = unit_file_resolve_symlink(lp->root_dir, lp->search_path,
+ r = unit_file_resolve_symlink(lp->root_dir, expanded_search_path,
*dir, dirfd(d), de->d_name,
/* resolve_destination_target= */ false,
&dst);
diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c
index 058dac5381..1f29577f00 100644
--- a/src/boot/bootctl.c
+++ b/src/boot/bootctl.c
@@ -61,6 +61,7 @@ static bool arg_print_dollar_boot_path = false;
static bool arg_touch_variables = true;
static PagerFlags arg_pager_flags = 0;
static bool arg_graceful = false;
+static bool arg_quiet = false;
static int arg_make_entry_directory = false; /* tri-state: < 0 for automatic logic */
static sd_id128_t arg_machine_id = SD_ID128_NULL;
static char *arg_install_layout = NULL;
@@ -105,7 +106,8 @@ static int acquire_esp(
r = find_esp_and_warn(arg_esp_path, unprivileged_mode, &np, ret_part, ret_pstart, ret_psize, ret_uuid, ret_devid);
if (r == -ENOKEY) {
if (graceful)
- return log_info_errno(r, "Couldn't find EFI system partition, skipping.");
+ return log_full_errno(arg_quiet ? LOG_DEBUG : LOG_INFO, r,
+ "Couldn't find EFI system partition, skipping.");
return log_error_errno(r,
"Couldn't find EFI system partition. It is recommended to mount it to /boot or /efi.\n"
@@ -178,7 +180,9 @@ static int load_etc_machine_info(void) {
return log_error_errno(r, "Failed to parse /etc/machine-info: %m");
if (!isempty(s)) {
- log_notice("Read $KERNEL_INSTALL_MACHINE_ID from /etc/machine-info. Please move it to /etc/kernel/entry-token.");
+ if (!arg_quiet)
+ log_notice("Read $KERNEL_INSTALL_MACHINE_ID from /etc/machine-info. "
+ "Please move it to /etc/kernel/entry-token.");
r = sd_id128_from_string(s, &arg_machine_id);
if (r < 0)
@@ -189,7 +193,9 @@ static int load_etc_machine_info(void) {
}
if (!isempty(layout)) {
- log_notice("Read $KERNEL_INSTALL_LAYOUT from /etc/machine-info. Please move it to the layout= setting of /etc/kernel/install.conf.");
+ if (!arg_quiet)
+ log_notice("Read $KERNEL_INSTALL_LAYOUT from /etc/machine-info. "
+ "Please move it to the layout= setting of /etc/kernel/install.conf.");
log_debug("KERNEL_INSTALL_LAYOUT=%s is specified in /etc/machine-info.", layout);
free_and_replace(arg_install_layout, layout);
@@ -470,13 +476,13 @@ static int status_binaries(const char *esp_path, sd_id128_t partition) {
r = enumerate_binaries(esp_path, "EFI/systemd", NULL);
if (r < 0)
goto finish;
- if (r == 0)
+ if (r == 0 && !arg_quiet)
log_info("systemd-boot not installed in ESP.");
r = enumerate_binaries(esp_path, "EFI/BOOT", "boot");
if (r < 0)
goto finish;
- if (r == 0)
+ if (r == 0 && !arg_quiet)
log_info("No default/fallback boot loader installed in ESP.");
r = 0;
@@ -1445,6 +1451,7 @@ static int help(int argc, char *argv[], void *userdata) {
" --no-pager Do not pipe output into a pager\n"
" --graceful Don't fail when the ESP cannot be found or EFI\n"
" variables cannot be written\n"
+ " -q --quiet Suppress output\n"
" --make-entry-directory=yes|no|auto\n"
" Create $BOOT/ENTRY-TOKEN/ directory\n"
" --entry-token=machine-id|os-id|os-image-id|auto|literal:…\n"
@@ -1487,6 +1494,7 @@ static int parse_argv(int argc, char *argv[]) {
{ "no-variables", no_argument, NULL, ARG_NO_VARIABLES },
{ "no-pager", no_argument, NULL, ARG_NO_PAGER },
{ "graceful", no_argument, NULL, ARG_GRACEFUL },
+ { "quiet", no_argument, NULL, 'q' },
{ "make-entry-directory", required_argument, NULL, ARG_MAKE_ENTRY_DIRECTORY },
{ "make-machine-id-directory", required_argument, NULL, ARG_MAKE_ENTRY_DIRECTORY }, /* Compatibility alias */
{ "entry-token", required_argument, NULL, ARG_ENTRY_TOKEN },
@@ -1548,6 +1556,10 @@ static int parse_argv(int argc, char *argv[]) {
arg_graceful = true;
break;
+ case 'q':
+ arg_quiet = true;
+ break;
+
case ARG_ENTRY_TOKEN: {
const char *e;
@@ -2226,7 +2238,9 @@ static int verb_remove(int argc, char *argv[], void *userdata) {
static int verb_is_installed(int argc, char *argv[], void *userdata) {
int r;
- r = acquire_esp(/* privileged_mode= */ false, /* graceful= */ false, NULL, NULL, NULL, NULL, NULL);
+ r = acquire_esp(/* privileged_mode= */ false,
+ /* graceful= */ arg_graceful,
+ NULL, NULL, NULL, NULL, NULL);
if (r < 0)
return r;
@@ -2235,10 +2249,12 @@ static int verb_is_installed(int argc, char *argv[], void *userdata) {
return r;
if (r > 0) {
- puts("yes");
+ if (!arg_quiet)
+ puts("yes");
return EXIT_SUCCESS;
} else {
- puts("no");
+ if (!arg_quiet)
+ puts("no");
return EXIT_FAILURE;
}
}
diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c
index a7c65b1ccd..c19f0ce382 100644
--- a/src/libsystemd/sd-journal/journal-file.c
+++ b/src/libsystemd/sd-journal/journal-file.c
@@ -3341,6 +3341,84 @@ static int journal_file_warn_btrfs(JournalFile *f) {
return 1;
}
+static void journal_default_metrics(JournalMetrics *m, int fd) {
+ struct statvfs ss;
+ uint64_t fs_size = 0;
+
+ assert(m);
+ assert(fd >= 0);
+
+ if (fstatvfs(fd, &ss) >= 0)
+ fs_size = ss.f_frsize * ss.f_blocks;
+ else
+ log_debug_errno(errno, "Failed to determine disk size: %m");
+
+ if (m->max_use == UINT64_MAX) {
+
+ if (fs_size > 0)
+ m->max_use = CLAMP(PAGE_ALIGN(fs_size / 10), /* 10% of file system size */
+ MAX_USE_LOWER, MAX_USE_UPPER);
+ else
+ m->max_use = MAX_USE_LOWER;
+ } else {
+ m->max_use = PAGE_ALIGN(m->max_use);
+
+ if (m->max_use != 0 && m->max_use < JOURNAL_FILE_SIZE_MIN*2)
+ m->max_use = JOURNAL_FILE_SIZE_MIN*2;
+ }
+
+ if (m->min_use == UINT64_MAX) {
+ if (fs_size > 0)
+ m->min_use = CLAMP(PAGE_ALIGN(fs_size / 50), /* 2% of file system size */
+ MIN_USE_LOW, MIN_USE_HIGH);
+ else
+ m->min_use = MIN_USE_LOW;
+ }
+
+ if (m->min_use > m->max_use)
+ m->min_use = m->max_use;
+
+ if (m->max_size == UINT64_MAX)
+ m->max_size = MIN(PAGE_ALIGN(m->max_use / 8), /* 8 chunks */
+ MAX_SIZE_UPPER);
+ else
+ m->max_size = PAGE_ALIGN(m->max_size);
+
+ if (m->max_size != 0) {
+ if (m->max_size < JOURNAL_FILE_SIZE_MIN)
+ m->max_size = JOURNAL_FILE_SIZE_MIN;
+
+ if (m->max_use != 0 && m->max_size*2 > m->max_use)
+ m->max_use = m->max_size*2;
+ }
+
+ if (m->min_size == UINT64_MAX)
+ m->min_size = JOURNAL_FILE_SIZE_MIN;
+ else
+ m->min_size = CLAMP(PAGE_ALIGN(m->min_size),
+ JOURNAL_FILE_SIZE_MIN,
+ m->max_size ?: UINT64_MAX);
+
+ if (m->keep_free == UINT64_MAX) {
+ if (fs_size > 0)
+ m->keep_free = MIN(PAGE_ALIGN(fs_size / 20), /* 5% of file system size */
+ KEEP_FREE_UPPER);
+ else
+ m->keep_free = DEFAULT_KEEP_FREE;
+ }
+
+ if (m->n_max_files == UINT64_MAX)
+ m->n_max_files = DEFAULT_N_MAX_FILES;
+
+ log_debug("Fixed min_use=%s max_use=%s max_size=%s min_size=%s keep_free=%s n_max_files=%" PRIu64,
+ FORMAT_BYTES(m->min_use),
+ FORMAT_BYTES(m->max_use),
+ FORMAT_BYTES(m->max_size),
+ FORMAT_BYTES(m->min_size),
+ FORMAT_BYTES(m->keep_free),
+ m->n_max_files);
+}
+
int journal_file_open(
int fd,
const char *fname,
@@ -3770,84 +3848,6 @@ void journal_reset_metrics(JournalMetrics *m) {
};
}
-void journal_default_metrics(JournalMetrics *m, int fd) {
- struct statvfs ss;
- uint64_t fs_size = 0;
-
- assert(m);
- assert(fd >= 0);
-
- if (fstatvfs(fd, &ss) >= 0)
- fs_size = ss.f_frsize * ss.f_blocks;
- else
- log_debug_errno(errno, "Failed to determine disk size: %m");
-
- if (m->max_use == UINT64_MAX) {
-
- if (fs_size > 0)
- m->max_use = CLAMP(PAGE_ALIGN(fs_size / 10), /* 10% of file system size */
- MAX_USE_LOWER, MAX_USE_UPPER);
- else
- m->max_use = MAX_USE_LOWER;
- } else {
- m->max_use = PAGE_ALIGN(m->max_use);
-
- if (m->max_use != 0 && m->max_use < JOURNAL_FILE_SIZE_MIN*2)
- m->max_use = JOURNAL_FILE_SIZE_MIN*2;
- }
-
- if (m->min_use == UINT64_MAX) {
- if (fs_size > 0)
- m->min_use = CLAMP(PAGE_ALIGN(fs_size / 50), /* 2% of file system size */
- MIN_USE_LOW, MIN_USE_HIGH);
- else
- m->min_use = MIN_USE_LOW;
- }
-
- if (m->min_use > m->max_use)
- m->min_use = m->max_use;
-
- if (m->max_size == UINT64_MAX)
- m->max_size = MIN(PAGE_ALIGN(m->max_use / 8), /* 8 chunks */
- MAX_SIZE_UPPER);
- else
- m->max_size = PAGE_ALIGN(m->max_size);
-
- if (m->max_size != 0) {
- if (m->max_size < JOURNAL_FILE_SIZE_MIN)
- m->max_size = JOURNAL_FILE_SIZE_MIN;
-
- if (m->max_use != 0 && m->max_size*2 > m->max_use)
- m->max_use = m->max_size*2;
- }
-
- if (m->min_size == UINT64_MAX)
- m->min_size = JOURNAL_FILE_SIZE_MIN;
- else
- m->min_size = CLAMP(PAGE_ALIGN(m->min_size),
- JOURNAL_FILE_SIZE_MIN,
- m->max_size ?: UINT64_MAX);
-
- if (m->keep_free == UINT64_MAX) {
- if (fs_size > 0)
- m->keep_free = MIN(PAGE_ALIGN(fs_size / 20), /* 5% of file system size */
- KEEP_FREE_UPPER);
- else
- m->keep_free = DEFAULT_KEEP_FREE;
- }
-
- if (m->n_max_files == UINT64_MAX)
- m->n_max_files = DEFAULT_N_MAX_FILES;
-
- log_debug("Fixed min_use=%s max_use=%s max_size=%s min_size=%s keep_free=%s n_max_files=%" PRIu64,
- FORMAT_BYTES(m->min_use),
- FORMAT_BYTES(m->max_use),
- FORMAT_BYTES(m->max_size),
- FORMAT_BYTES(m->min_size),
- FORMAT_BYTES(m->keep_free),
- m->n_max_files);
-}
-
int journal_file_get_cutoff_realtime_usec(JournalFile *f, usec_t *from, usec_t *to) {
assert(f);
assert(f->header);
diff --git a/src/libsystemd/sd-journal/journal-file.h b/src/libsystemd/sd-journal/journal-file.h
index 64b15eabed..be02b2624f 100644
--- a/src/libsystemd/sd-journal/journal-file.h
+++ b/src/libsystemd/sd-journal/journal-file.h
@@ -241,7 +241,6 @@ void journal_file_post_change(JournalFile *f);
int journal_file_enable_post_change_timer(JournalFile *f, sd_event *e, usec_t t);
void journal_reset_metrics(JournalMetrics *m);
-void journal_default_metrics(JournalMetrics *m, int fd);
int journal_file_get_cutoff_realtime_usec(JournalFile *f, usec_t *from, usec_t *to);
int journal_file_get_cutoff_monotonic_usec(JournalFile *f, sd_id128_t boot, usec_t *from, usec_t *to);
diff --git a/src/shared/install.c b/src/shared/install.c
index 5df2137d4c..c9834ae6c7 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -1899,7 +1899,7 @@ static int install_info_symlink_alias(
if (!alias_path)
return -ENOMEM;
- q = create_symlink(lp, info->name, alias_path, force, changes, n_changes);
+ q = create_symlink(lp, info->path, alias_path, force, changes, n_changes);
r = r < 0 ? r : q;
}
@@ -1968,7 +1968,7 @@ static int install_info_symlink_wants(
}
STRV_FOREACH(s, list) {
- _cleanup_free_ char *dst = NULL;
+ _cleanup_free_ char *path = NULL, *dst = NULL;
q = install_name_printf(scope, info, *s, &dst);
if (q < 0) {
@@ -1998,15 +1998,11 @@ static int install_info_symlink_wants(
continue;
}
- _cleanup_free_ char *path = strjoin(config_path, "/", dst, suffix, n);
+ path = strjoin(config_path, "/", dst, suffix, n);
if (!path)
return -ENOMEM;
- _cleanup_free_ char *target = strjoin("../", info->name);
- if (!target)
- return -ENOMEM;
-
- q = create_symlink(lp, target, path, true, changes, n_changes);
+ q = create_symlink(lp, info->path, path, true, changes, n_changes);
if (r == 0)
r = q;
@@ -2914,7 +2910,7 @@ int unit_file_set_default(
return r;
new_path = strjoina(lp.persistent_config, "/" SPECIAL_DEFAULT_TARGET);
- return create_symlink(&lp, info->name, new_path, flags & UNIT_FILE_FORCE, changes, n_changes);
+ return create_symlink(&lp, info->path, new_path, flags & UNIT_FILE_FORCE, changes, n_changes);
}
int unit_file_get_default(
diff --git a/src/test/test-install-root.c b/src/test/test-install-root.c
index a36536b85b..c2980ccbbd 100644
--- a/src/test/test-install-root.c
+++ b/src/test/test-install-root.c
@@ -88,7 +88,7 @@ TEST(basic_mask_and_enable) {
assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) == 1);
assert_se(n_changes == 1);
assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK);
- assert_se(streq(changes[0].source, "../a.service"));
+ assert_se(streq(changes[0].source, "/usr/lib/systemd/system/a.service"));
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/a.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
@@ -128,7 +128,7 @@ TEST(basic_mask_and_enable) {
assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("d.service"), &changes, &n_changes) >= 0);
assert_se(n_changes == 1);
assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK);
- assert_se(streq(changes[0].source, "../a.service"));
+ assert_se(streq(changes[0].source, "/usr/lib/systemd/system/a.service"));
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/a.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
@@ -147,7 +147,7 @@ TEST(basic_mask_and_enable) {
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/a.service");
assert_se(streq(changes[0].path, p));
assert_se(changes[1].type_or_errno == UNIT_FILE_SYMLINK);
- assert_se(streq(changes[1].source, "../a.service"));
+ assert_se(streq(changes[1].source, "/usr/lib/systemd/system/a.service"));
assert_se(streq(changes[1].path, p));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -186,7 +186,7 @@ TEST(basic_mask_and_enable) {
assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("f.service"), &changes, &n_changes) == 1);
assert_se(n_changes == 2);
assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK);
- assert_se(streq(changes[0].source, "../f.service"));
+ assert_se(streq(changes[0].source, "/usr/lib/systemd/system/f.service"));
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/x.target.wants/f.service");
assert_se(streq(changes[0].path, p));
assert_se(changes[1].type_or_errno == UNIT_FILE_DESTINATION_NOT_PRESENT);
@@ -280,8 +280,7 @@ TEST(linked_units) {
q = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked.service");
for (i = 0 ; i < n_changes; i++) {
assert_se(changes[i].type_or_errno == UNIT_FILE_SYMLINK);
- assert_se(STR_IN_SET(changes[i].source,
- "../linked.service", "/opt/linked.service"));
+ assert_se(streq(changes[i].source, "/opt/linked.service"));
if (p && streq(changes[i].path, p))
p = NULL;
@@ -323,8 +322,7 @@ TEST(linked_units) {
q = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked2.service");
for (i = 0 ; i < n_changes; i++) {
assert_se(changes[i].type_or_errno == UNIT_FILE_SYMLINK);
- assert_se(STR_IN_SET(changes[i].source,
- "../linked2.service", "/opt/linked2.service"));
+ assert_se(streq(changes[i].source, "/opt/linked2.service"));
if (p && streq(changes[i].path, p))
p = NULL;
@@ -342,7 +340,7 @@ TEST(linked_units) {
assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK);
assert_se(startswith(changes[0].path, root));
assert_se(endswith(changes[0].path, "linked3.service"));
- assert_se(streq(changes[0].source, "../linked3.service"));
+ assert_se(streq(changes[0].source, "/opt/linked3.service"));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
}
@@ -373,7 +371,7 @@ TEST(default) {
assert_se(unit_file_set_default(LOOKUP_SCOPE_SYSTEM, 0, root, "test-default.target", &changes, &n_changes) >= 0);
assert_se(n_changes == 1);
assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK);
- assert_se(streq(changes[0].source, "test-default-real.target"));
+ assert_se(streq(changes[0].source, "/usr/lib/systemd/system/test-default-real.target"));
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR "/" SPECIAL_DEFAULT_TARGET);
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
@@ -403,7 +401,7 @@ TEST(add_dependency) {
assert_se(unit_file_add_dependency(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("add-dependency-test-service.service"), "add-dependency-test-target.target", UNIT_WANTS, &changes, &n_changes) >= 0);
assert_se(n_changes == 1);
assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK);
- assert_se(streq(changes[0].source, "../real-add-dependency-test-service.service"));
+ assert_se(streq(changes[0].source, "/usr/lib/systemd/system/real-add-dependency-test-service.service"));
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/real-add-dependency-test-target.target.wants/real-add-dependency-test-service.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
@@ -444,7 +442,7 @@ TEST(template_enable) {
assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("template@.service"), &changes, &n_changes) >= 0);
assert_se(n_changes == 1);
assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK);
- assert_se(streq(changes[0].source, "../template@.service"));
+ assert_se(streq(changes[0].source, "/usr/lib/systemd/system/template@.service"));
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/template@def.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
@@ -475,14 +473,13 @@ TEST(template_enable) {
assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("template@foo.service"), &changes, &n_changes) >= 0);
assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK);
- assert_se(streq(changes[0].source, "../template@foo.service"));
+ assert_se(streq(changes[0].source, "/usr/lib/systemd/system/template@.service"));
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/template@foo.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template@.service", &state) >= 0);
- assert_se(state == UNIT_FILE_INDIRECT);
+ assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template@.service", &state) >= 0 && state == UNIT_FILE_INDIRECT);
assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template@def.service", &state) >= 0 && state == UNIT_FILE_DISABLED);
assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template@foo.service", &state) >= 0 && state == UNIT_FILE_ENABLED);
assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template-symlink@foo.service", &state) >= 0 && state == UNIT_FILE_ENABLED);
@@ -509,7 +506,7 @@ TEST(template_enable) {
assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("template-symlink@quux.service"), &changes, &n_changes) >= 0);
assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK);
- assert_se(streq(changes[0].source, "../template@quux.service"));
+ assert_se(streq(changes[0].source, "/usr/lib/systemd/system/template@.service"));
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/template@quux.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
@@ -555,7 +552,7 @@ TEST(indirect) {
assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("indirectc.service"), &changes, &n_changes) >= 0);
assert_se(n_changes == 1);
assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK);
- assert_se(streq(changes[0].source, "../indirectb.service"));
+ assert_se(streq(changes[0].source, "/usr/lib/systemd/system/indirectb.service"));
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/indirectb.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
@@ -607,7 +604,7 @@ TEST(preset_and_list) {
assert_se(unit_file_preset(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("preset-yes.service"), UNIT_FILE_PRESET_FULL, &changes, &n_changes) >= 0);
assert_se(n_changes == 1);
assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK);
- assert_se(streq(changes[0].source, "../preset-yes.service"));
+ assert_se(streq(changes[0].source, "/usr/lib/systemd/system/preset-yes.service"));
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/preset-yes.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
@@ -644,7 +641,7 @@ TEST(preset_and_list) {
for (i = 0; i < n_changes; i++) {
if (changes[i].type_or_errno == UNIT_FILE_SYMLINK) {
- assert_se(streq(changes[i].source, "../preset-yes.service"));
+ assert_se(streq(changes[i].source, "/usr/lib/systemd/system/preset-yes.service"));
assert_se(streq(changes[i].path, p));
} else
assert_se(changes[i].type_or_errno == UNIT_FILE_UNLINK);
@@ -760,7 +757,7 @@ TEST(preset_order) {
assert_se(unit_file_preset(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("prefix-1.service"), UNIT_FILE_PRESET_FULL, &changes, &n_changes) >= 0);
assert_se(n_changes == 1);
assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK);
- assert_se(streq(changes[0].source, "../prefix-1.service"));
+ assert_se(streq(changes[0].source, "/usr/lib/systemd/system/prefix-1.service"));
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/prefix-1.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
@@ -869,8 +866,8 @@ TEST(with_dropin) {
assert_se(n_changes == 2);
assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK);
assert_se(changes[1].type_or_errno == UNIT_FILE_SYMLINK);
- assert_se(streq(changes[0].source, "../with-dropin-1.service"));
- assert_se(streq(changes[1].source, "../with-dropin-1.service"));
+ assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-1.service"));
+ assert_se(streq(changes[1].source, "/usr/lib/systemd/system/with-dropin-1.service"));
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-1.service");
assert_se(streq(changes[0].path, p));
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/graphical.target.wants/with-dropin-1.service");
@@ -883,8 +880,8 @@ TEST(with_dropin) {
assert_se(n_changes == 2);
assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK);
assert_se(changes[1].type_or_errno == UNIT_FILE_SYMLINK);
- assert_se(streq(changes[0].source, "../with-dropin-2.service"));
- assert_se(streq(changes[1].source, "../with-dropin-2.service"));
+ assert_se(streq(changes[0].source, SYSTEM_CONFIG_UNIT_DIR"/with-dropin-2.service"));
+ assert_se(streq(changes[1].source, SYSTEM_CONFIG_UNIT_DIR"/with-dropin-2.service"));
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-2.service");
assert_se(streq(changes[0].path, p));
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/graphical.target.wants/with-dropin-2.service");
@@ -897,8 +894,8 @@ TEST(with_dropin) {
assert_se(n_changes == 2);
assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK);
assert_se(changes[1].type_or_errno == UNIT_FILE_SYMLINK);
- assert_se(streq(changes[0].source, "../with-dropin-3.service"));
- assert_se(streq(changes[1].source, "../with-dropin-3.service"));
+ assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-3.service"));
+ assert_se(streq(changes[1].source, "/usr/lib/systemd/system/with-dropin-3.service"));
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-3.service");
assert_se(streq(changes[0].path, p));
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/graphical.target.wants/with-dropin-3.service");
@@ -911,8 +908,8 @@ TEST(with_dropin) {
assert_se(n_changes == 2);
assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK);
assert_se(changes[1].type_or_errno == UNIT_FILE_SYMLINK);
- assert_se(streq(changes[0].source, "../with-dropin-4a.service"));
- assert_se(streq(changes[1].source, "../with-dropin-4b.service"));
+ assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-4a.service"));
+ assert_se(streq(changes[1].source, "/usr/lib/systemd/system/with-dropin-4b.service"));
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-4a.service");
assert_se(streq(changes[0].path, p));
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-4b.service");
@@ -978,8 +975,8 @@ TEST(with_dropin_template) {
assert_se(n_changes == 2);
assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK);
assert_se(changes[1].type_or_errno == UNIT_FILE_SYMLINK);
- assert_se(streq(changes[0].source, "../with-dropin-1@instance-1.service"));
- assert_se(streq(changes[1].source, "../with-dropin-1@instance-1.service"));
+ assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-1@.service"));
+ assert_se(streq(changes[1].source, "/usr/lib/systemd/system/with-dropin-1@.service"));
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-1@instance-1.service");
assert_se(streq(changes[0].path, p));
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/graphical.target.wants/with-dropin-1@instance-1.service");
@@ -991,8 +988,8 @@ TEST(with_dropin_template) {
assert_se(n_changes == 2);
assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK);
assert_se(changes[1].type_or_errno == UNIT_FILE_SYMLINK);
- assert_se(streq(changes[0].source, "../with-dropin-2@instance-1.service"));
- assert_se(streq(changes[1].source, "../with-dropin-2@instance-1.service"));
+ assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-2@.service"));
+ assert_se(streq(changes[1].source, "/usr/lib/systemd/system/with-dropin-2@.service"));
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-2@instance-1.service");
assert_se(streq(changes[0].path, p));
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/graphical.target.wants/with-dropin-2@instance-1.service");
@@ -1003,7 +1000,7 @@ TEST(with_dropin_template) {
assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("with-dropin-2@instance-2.service"), &changes, &n_changes) == 1);
assert_se(n_changes == 1);
assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK);
- assert_se(streq(changes[0].source, "../with-dropin-2@instance-2.service"));
+ assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-2@.service"));
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-2@instance-2.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
@@ -1012,7 +1009,7 @@ TEST(with_dropin_template) {
assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("with-dropin-3@.service"), &changes, &n_changes) == 1);
assert_se(n_changes == 1);
assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK);
- assert_se(streq(changes[0].source, "../with-dropin-3@.service"));
+ assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-3@.service"));
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-3@instance-2.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
diff --git a/test/test-systemctl-enable.sh b/test/test-systemctl-enable.sh
index f40831cf8c..7d5667f297 100644
--- a/test/test-systemctl-enable.sh
+++ b/test/test-systemctl-enable.sh
@@ -90,27 +90,27 @@ EOF
( ! "$systemctl" --root="$root" enable test1 )
test -h "$root/etc/systemd/system/default.target.wants/test1.service"
test -h "$root/etc/systemd/system/special.target.requires/test1.service"
-test -e "$root/etc/systemd/system/test1-goodalias.service"
+test ! -e "$root/etc/systemd/system/test1-goodalias.service"
test -h "$root/etc/systemd/system/test1-goodalias.service"
-test ! -h "$root/etc/systemd/system/test1@badalias.service"
-test ! -h "$root/etc/systemd/system/test1-badalias.target"
-test ! -h "$root/etc/systemd/system/test1-badalias.socket"
-test -e "$root/etc/systemd/system/test1-goodalias2.service"
+test ! -e "$root/etc/systemd/system/test1@badalias.service"
+test ! -e "$root/etc/systemd/system/test1-badalias.target"
+test ! -e "$root/etc/systemd/system/test1-badalias.socket"
test -h "$root/etc/systemd/system/test1-goodalias2.service"
: '-------aliases in reeanble----------------------------------'
( ! "$systemctl" --root="$root" reenable test1 )
-islink "$root/etc/systemd/system/default.target.wants/test1.service" "../test1.service"
-islink "$root/etc/systemd/system/test1-goodalias.service" "test1.service"
+test -h "$root/etc/systemd/system/default.target.wants/test1.service"
+test ! -e "$root/etc/systemd/system/test1-goodalias.service"
+test -h "$root/etc/systemd/system/test1-goodalias.service"
-test ! -h "$root/etc/systemd/system/test1@badalias.service"
-test ! -h "$root/etc/systemd/system/test1-badalias.target"
-test ! -h "$root/etc/systemd/system/test1-badalias.socket"
+test ! -e "$root/etc/systemd/system/test1@badalias.service"
+test ! -e "$root/etc/systemd/system/test1-badalias.target"
+test ! -e "$root/etc/systemd/system/test1-badalias.socket"
"$systemctl" --root="$root" disable test1
-test ! -h "$root/etc/systemd/system/default.target.wants/test1.service"
-test ! -h "$root/etc/systemd/system/special.target.requires/test1.service"
-test ! -h "$root/etc/systemd/system/test1-goodalias.service"
+test ! -e "$root/etc/systemd/system/default.target.wants/test1.service"
+test ! -e "$root/etc/systemd/system/special.target.requires/test1.service"
+test ! -e "$root/etc/systemd/system/test1-goodalias.service"
: '-------aliases when link already exists---------------------'
cat >"$root/etc/systemd/system/test1a.service" <<EOF
@@ -201,17 +201,17 @@ test ! -e "$root/etc/systemd/system/link1.path"
: '-------link and enable--------------------------------------'
"$systemctl" --root="$root" enable '/link1.path'
islink "$root/etc/systemd/system/link1.path" "/link1.path"
-islink "$root/etc/systemd/system/paths.target.wants/link1.path" "../link1.path"
+islink "$root/etc/systemd/system/paths.target.wants/link1.path" "/link1.path"
: '-------enable already linked same path----------------------'
"$systemctl" --root="$root" enable '/link1.path'
islink "$root/etc/systemd/system/link1.path" "/link1.path"
-islink "$root/etc/systemd/system/paths.target.wants/link1.path" "../link1.path"
+islink "$root/etc/systemd/system/paths.target.wants/link1.path" "/link1.path"
: '-------enable already linked different path-----------------'
( ! "$systemctl" --root="$root" enable '/subdir/link1.path' )
islink "$root/etc/systemd/system/link1.path" "/link1.path"
-islink "$root/etc/systemd/system/paths.target.wants/link1.path" "../link1.path"
+islink "$root/etc/systemd/system/paths.target.wants/link1.path" "/link1.path"
: '-------enable bad suffix------------------------------------'
cp "$root/link1.path" "$root/subdir/link1.suffix"
@@ -240,11 +240,11 @@ test ! -h "$root/etc/systemd/system/paths.target.wants/link1.path"
"$systemctl" --root="$root" enable 'link1.path'
islink "$root/etc/systemd/system/link1.path" "/link1.path"
-islink "$root/etc/systemd/system/paths.target.wants/link1.path" "../link1.path"
+islink "$root/etc/systemd/system/paths.target.wants/link1.path" "/link1.path"
"$systemctl" --root="$root" reenable 'link1.path'
islink "$root/etc/systemd/system/link1.path" "/link1.path"
-islink "$root/etc/systemd/system/paths.target.wants/link1.path" "../link1.path"
+islink "$root/etc/systemd/system/paths.target.wants/link1.path" "/link1.path"
: '-------manual link------------------------------------------'
cat >"$root/link3.suffix" <<EOF
@@ -257,7 +257,7 @@ ln -s "/link3.suffix" "$root/etc/systemd/system/link3.service"
SYSTEMD_LOG_LEVEL=debug SYSTEMD_LOG_LOCATION=1 "$systemctl" --root="$root" enable 'link3.service'
islink "$root/etc/systemd/system/link3.service" "/link3.suffix"
-islink "$root/etc/systemd/system/services.target.wants/link3.service" "../link3.service"
+islink "$root/etc/systemd/system/services.target.wants/link3.service" "/link3.suffix"
SYSTEMD_LOG_LEVEL=debug SYSTEMD_LOG_LOCATION=1 "$systemctl" --root="$root" disable 'link3.service'
test ! -h "$root/etc/systemd/system/link3.service"
@@ -293,7 +293,7 @@ test ! -h "$root/etc/systemd/system/services.target.wants/link5-also.service"
"$systemctl" --root="$root" enable 'link5-also.service'
test ! -h "$root/etc/systemd/system/services.target.wants/link5.service"
-islink "$root/etc/systemd/system/services.target.wants/link5-also.service" "../link5-also.service"
+islink "$root/etc/systemd/system/services.target.wants/link5-also.service" "/etc/systemd/system/link5-also.service"
: '-------template enablement----------------------------------'
cat >"$root/etc/systemd/system/templ1@.service" <<EOF
@@ -307,17 +307,17 @@ test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service"
"$systemctl" --root="$root" enable 'templ1@one.service'
test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service"
-islink "$root/etc/systemd/system/services.target.wants/templ1@one.service" "../templ1@one.service"
+islink "$root/etc/systemd/system/services.target.wants/templ1@one.service" "/etc/systemd/system/templ1@.service"
"$systemctl" --root="$root" enable 'templ1@two.service'
test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service"
-islink "$root/etc/systemd/system/services.target.wants/templ1@one.service" "../templ1@one.service"
-islink "$root/etc/systemd/system/services.target.wants/templ1@two.service" "../templ1@two.service"
+islink "$root/etc/systemd/system/services.target.wants/templ1@one.service" "/etc/systemd/system/templ1@.service"
+islink "$root/etc/systemd/system/services.target.wants/templ1@two.service" "/etc/systemd/system/templ1@.service"
"$systemctl" --root="$root" disable 'templ1@one.service'
test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service"
test ! -h "$root/etc/systemd/system/services.target.wants/templ1@one.service"
-islink "$root/etc/systemd/system/services.target.wants/templ1@two.service" "../templ1@two.service"
+islink "$root/etc/systemd/system/services.target.wants/templ1@two.service" "/etc/systemd/system/templ1@.service"
"$systemctl" --root="$root" disable 'templ1@two.service'
test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service"
@@ -335,33 +335,33 @@ EOF
"$systemctl" --root="$root" enable 'templ1@.service'
test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service"
-islink "$root/etc/systemd/system/services.target.wants/templ1@333.service" "../templ1@.service"
-islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@333.service" "../templ1@.service"
+islink "$root/etc/systemd/system/services.target.wants/templ1@333.service" "/etc/systemd/system/templ1@.service"
+islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@333.service" "/etc/systemd/system/templ1@.service"
"$systemctl" --root="$root" enable 'templ1@one.service'
test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service"
-islink "$root/etc/systemd/system/services.target.wants/templ1@333.service" "../templ1@.service"
-islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@333.service" "../templ1@.service"
-islink "$root/etc/systemd/system/services.target.wants/templ1@one.service" "../templ1@one.service"
-islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@one.service" "../templ1@one.service"
+islink "$root/etc/systemd/system/services.target.wants/templ1@333.service" "/etc/systemd/system/templ1@.service"
+islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@333.service" "/etc/systemd/system/templ1@.service"
+islink "$root/etc/systemd/system/services.target.wants/templ1@one.service" "/etc/systemd/system/templ1@.service"
+islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@one.service" "/etc/systemd/system/templ1@.service"
"$systemctl" --root="$root" enable 'templ1@two.service'
test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service"
-islink "$root/etc/systemd/system/services.target.wants/templ1@333.service" "../templ1@.service"
-islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@333.service" "../templ1@.service"
-islink "$root/etc/systemd/system/services.target.wants/templ1@one.service" "../templ1@one.service"
-islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@one.service" "../templ1@one.service"
-islink "$root/etc/systemd/system/services.target.wants/templ1@two.service" "../templ1@two.service"
-islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@two.service" "../templ1@two.service"
+islink "$root/etc/systemd/system/services.target.wants/templ1@333.service" "/etc/systemd/system/templ1@.service"
+islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@333.service" "/etc/systemd/system/templ1@.service"
+islink "$root/etc/systemd/system/services.target.wants/templ1@one.service" "/etc/systemd/system/templ1@.service"
+islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@one.service" "/etc/systemd/system/templ1@.service"
+islink "$root/etc/systemd/system/services.target.wants/templ1@two.service" "/etc/systemd/system/templ1@.service"
+islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@two.service" "/etc/systemd/system/templ1@.service"
"$systemctl" --root="$root" disable 'templ1@one.service'
test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service"
-islink "$root/etc/systemd/system/services.target.wants/templ1@333.service" "../templ1@.service"
-islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@333.service" "../templ1@.service"
+islink "$root/etc/systemd/system/services.target.wants/templ1@333.service" "/etc/systemd/system/templ1@.service"
+islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@333.service" "/etc/systemd/system/templ1@.service"
test ! -h "$root/etc/systemd/system/services.target.wants/templ1@one.service"
test ! -h "$root/etc/systemd/system/other@templ1.target.requires/templ1@one.service"
-islink "$root/etc/systemd/system/services.target.wants/templ1@two.service" "../templ1@two.service"
-islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@two.service" "../templ1@two.service"
+islink "$root/etc/systemd/system/services.target.wants/templ1@two.service" "/etc/systemd/system/templ1@.service"
+islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@two.service" "/etc/systemd/system/templ1@.service"
# disable remaining links here
"$systemctl" --root="$root" disable 'templ1@.service'
@@ -400,18 +400,18 @@ RequiredBy=another-template@.target
EOF
"$systemctl" --root="$root" enable 'templ2@.service'
-islink "$root/etc/systemd/system/another-template@.target.requires/templ2@.service" "../templ2@.service"
+islink "$root/etc/systemd/system/another-template@.target.requires/templ2@.service" "/etc/systemd/system/templ2@.service"
"$systemctl" --root="$root" enable 'templ2@two.service'
-islink "$root/etc/systemd/system/another-template@.target.requires/templ2@.service" "../templ2@.service"
-islink "$root/etc/systemd/system/another-template@.target.requires/templ2@two.service" "../templ2@two.service"
+islink "$root/etc/systemd/system/another-template@.target.requires/templ2@.service" "/etc/systemd/system/templ2@.service"
+islink "$root/etc/systemd/system/another-template@.target.requires/templ2@two.service" "/etc/systemd/system/templ2@.service"
"$systemctl" --root="$root" disable 'templ2@other.service'
-islink "$root/etc/systemd/system/another-template@.target.requires/templ2@.service" "../templ2@.service"
-islink "$root/etc/systemd/system/another-template@.target.requires/templ2@two.service" "../templ2@two.service"
+islink "$root/etc/systemd/system/another-template@.target.requires/templ2@.service" "/etc/systemd/system/templ2@.service"
+islink "$root/etc/systemd/system/another-template@.target.requires/templ2@two.service" "/etc/systemd/system/templ2@.service"
"$systemctl" --root="$root" disable 'templ2@two.service'
-islink "$root/etc/systemd/system/another-template@.target.requires/templ2@.service" "../templ2@.service"
+islink "$root/etc/systemd/system/another-template@.target.requires/templ2@.service" "/etc/systemd/system/templ2@.service"
test ! -h "$root/etc/systemd/system/another-template@.target.requires/templ2@two.service"
"$systemctl" --root="$root" disable 'templ2@.service'
@@ -433,8 +433,8 @@ EOF
test ! -h "$root/etc/systemd/system/link4.service" # this is our file
test ! -h "$root/etc/systemd/system/link4@.service"
test ! -h "$root/etc/systemd/system/link4@inst.service"
-islink "$root/etc/systemd/system/link4alias.service" "link4.service"
-islink "$root/etc/systemd/system/link4alias2.service" "link4.service"
+islink "$root/etc/systemd/system/link4alias.service" "/etc/systemd/system/link4.service"
+islink "$root/etc/systemd/system/link4alias2.service" "/etc/systemd/system/link4.service"
"$systemctl" --root="$root" disable 'link4.service'
test ! -h "$root/etc/systemd/system/link4.service"
@@ -453,8 +453,8 @@ EOF
# Apparently this works. I'm not sure what to think.
"$systemctl" --root="$root" enable '/etc/systemd/system/link4.service'
test ! -h "$root/etc/systemd/system/link4.service" # this is our file
-islink "$root/etc/systemd/system/link4alias.service" "link4.service"
-islink "$root/etc/systemd/system/link4alias2.service" "link4.service"
+islink "$root/etc/systemd/system/link4alias.service" "/etc/systemd/system/link4.service"
+islink "$root/etc/systemd/system/link4alias2.service" "/etc/systemd/system/link4.service"
"$systemctl" --root="$root" disable '/etc/systemd/system/link4.service'
test ! -h "$root/etc/systemd/system/link4.service"
@@ -472,8 +472,8 @@ EOF
"$systemctl" --root="$root" enable 'link5.service'
test ! -h "$root/etc/systemd/system/link5.service" # this is our file
-islink "$root/etc/systemd/system/link5alias.service" "link5.service"
-islink "$root/etc/systemd/system/link5alias2.service" "link5.service"
+islink "$root/etc/systemd/system/link5alias.service" "/etc/systemd/system/link5.service"
+islink "$root/etc/systemd/system/link5alias2.service" "/etc/systemd/system/link5.service"
"$systemctl" --root="$root" disable 'link5.service'
test ! -h "$root/etc/systemd/system/link5alias.service"
@@ -495,6 +495,10 @@ islink "$root/etc/systemd/system/link5copy.service" '/link5copy.service'
test ! -h "$root/etc/systemd/system/link5alias.service"
test ! -h "$root/etc/systemd/system/link5alias2.service"
+# FIXME: we must create link5alias2 and link5alias as relative links to link5.service
+# When they are independent links to /link5.service, systemd doesn't know that
+# they are aliases, because we do not follow symlinks outside of the search paths.
+
"$systemctl" --root="$root" disable 'link5copy.service'
test ! -h "$root/etc/systemd/system/link5copy.service"
test ! -h "$root/etc/systemd/system/link5alias.service"
@@ -502,8 +506,8 @@ test ! -h "$root/etc/systemd/system/link5alias2.service"
"$systemctl" --root="$root" enable '/link5copy.service'
islink "$root/etc/systemd/system/link5copy.service" '/link5copy.service'
-islink "$root/etc/systemd/system/link5alias.service" 'link5copy.service'
-islink "$root/etc/systemd/system/link5alias2.service" 'link5copy.service'
+islink "$root/etc/systemd/system/link5alias.service" '/link5copy.service'
+islink "$root/etc/systemd/system/link5alias2.service" '/link5copy.service'
"$systemctl" --root="$root" disable 'link5copy.service'
test ! -h "$root/etc/systemd/system/link5copy.service"
@@ -522,10 +526,10 @@ EOF
"$systemctl" --root="$root" enable 'link5@.path'
test ! -h "$root/etc/systemd/system/link5@.path" # this is our file
-islink "$root/etc/systemd/system/target5@.target.wants/link5@.path" "../link5@.path"
-islink "$root/etc/systemd/system/target5@.target.requires/link5@.path" "../link5@.path"
-islink "$root/etc/systemd/system/target5@inst.target.wants/link5@.path" "../link5@.path"
-islink "$root/etc/systemd/system/target5@inst.target.requires/link5@.path" "../link5@.path"
+islink "$root/etc/systemd/system/target5@.target.wants/link5@.path" "/etc/systemd/system/link5@.path"
+islink "$root/etc/systemd/system/target5@.target.requires/link5@.path" "/etc/systemd/system/link5@.path"
+islink "$root/etc/systemd/system/target5@inst.target.wants/link5@.path" "/etc/systemd/system/link5@.path"
+islink "$root/etc/systemd/system/target5@inst.target.requires/link5@.path" "/etc/systemd/system/link5@.path"
"$systemctl" --root="$root" disable 'link5@.path'
test ! -h "$root/etc/systemd/system/link5@.path" # this is our file
@@ -564,7 +568,7 @@ check_alias() {
Alias=target@$1:%$1.socket
EOF
SYSTEMD_LOG_LEVEL=debug "$systemctl" --root="$root" enable 'some-some-link6@.socket' || return 1
- islink "$root/etc/systemd/system/target@$1:$2.socket" "some-some-link6@.socket" || return 2
+ islink "$root/etc/systemd/system/target@$1:$2.socket" "/etc/systemd/system/some-some-link6@.socket" || return 2
}
# TODO: our architecture names are different than what uname -m returns.
@@ -670,10 +674,10 @@ RequiredBy=another-target2@.target
EOF
"$systemctl" --root="$root" enable 'some-some-link7.socket'
-islink "$root/etc/systemd/system/target@some-some-link7.target.wants/some-some-link7.socket" "../some-some-link7.socket"
-islink "$root/etc/systemd/system/another-target@.target.wants/some-some-link7.socket" "../some-some-link7.socket"
-islink "$root/etc/systemd/system/target2@some-some-link7.target.requires/some-some-link7.socket" "../some-some-link7.socket"
-islink "$root/etc/systemd/system/another-target2@.target.requires/some-some-link7.socket" "../some-some-link7.socket"
+islink "$root/etc/systemd/system/target@some-some-link7.target.wants/some-some-link7.socket" "/etc/systemd/system/some-some-link7.socket"
+islink "$root/etc/systemd/system/another-target@.target.wants/some-some-link7.socket" "/etc/systemd/system/some-some-link7.socket"
+islink "$root/etc/systemd/system/target2@some-some-link7.target.requires/some-some-link7.socket" "/etc/systemd/system/some-some-link7.socket"
+islink "$root/etc/systemd/system/another-target2@.target.requires/some-some-link7.socket" "/etc/systemd/system/some-some-link7.socket"
"$systemctl" --root="$root" disable 'some-some-link7.socket'
test ! -h "$root/etc/systemd/system/target@some-some-link7.target.wants/some-some-link7.socket"