return q;
if (!unit_name_is_valid(dst, valid_dst_type)) {
- /* Generate a proper error here: EUCLEAN if the name is generally bad,
- * EIDRM if the template status doesn't match. */
+ /* Generate a proper error here: EUCLEAN if the name is generally bad, EIDRM if the
+ * template status doesn't match. If we are doing presets don't bother reporting the
+ * error. This also covers cases like 'systemctl preset serial-getty@.service', which
+ * has no DefaultInstance, so there is nothing we can do. At the same time,
+ * 'systemctl enable serial-getty@.service' should fail, the user should specify an
+ * instance like in 'systemctl enable serial-getty@ttyS0.service'.
+ */
+ if (file_flags & UNIT_FILE_IGNORE_AUXILIARY_FAILURE)
+ continue;
+
if (unit_name_is_valid(dst, UNIT_NAME_ANY)) {
unit_file_changes_add(changes, n_changes, -EIDRM, dst, n);
r = -EIDRM;
int q;
/* Returns number of symlinks that where supposed to be installed. */
- q = install_context_apply(scope, file_flags, plus, paths, config_path, SEARCH_LOAD, changes, n_changes);
+ q = install_context_apply(scope,
+ file_flags | UNIT_FILE_IGNORE_AUXILIARY_FAILURE,
+ plus, paths, config_path, SEARCH_LOAD, changes, n_changes);
if (r >= 0) {
if (q < 0)
r = q;
};
enum UnitFileFlags {
- UNIT_FILE_RUNTIME = 1 << 0, /* Public API via DBUS, do not change */
- UNIT_FILE_FORCE = 1 << 1, /* Public API via DBUS, do not change */
- UNIT_FILE_PORTABLE = 1 << 2, /* Public API via DBUS, do not change */
- UNIT_FILE_DRY_RUN = 1 << 3,
+ UNIT_FILE_RUNTIME = 1 << 0, /* Public API via DBUS, do not change */
+ UNIT_FILE_FORCE = 1 << 1, /* Public API via DBUS, do not change */
+ UNIT_FILE_PORTABLE = 1 << 2, /* Public API via DBUS, do not change */
+ UNIT_FILE_DRY_RUN = 1 << 3,
+ UNIT_FILE_IGNORE_AUXILIARY_FAILURE = 1 << 4,
_UNIT_FILE_FLAGS_MASK_PUBLIC = UNIT_FILE_RUNTIME|UNIT_FILE_PORTABLE|UNIT_FILE_FORCE,
};