return r;
}
-static void install_debug_shell_dropin(void) {
+static int install_debug_shell_dropin(void) {
const char *tty = arg_debug_tty ?: arg_default_debug_tty;
int r;
if (!tty || path_equal(tty, skip_dev_prefix(DEBUGTTY)))
- return;
+ return 0;
r = write_drop_in_format(arg_dest, "debug-shell.service", 50, "tty",
- "[Unit]\n"
- "Description=Early root shell on /dev/%s FOR DEBUGGING ONLY\n"
- "ConditionPathExists=\n"
- "[Service]\n"
- "TTYPath=/dev/%s",
- tty, tty);
+ "# Automatically generated by systemd-debug-generator\n\n"
+ "[Unit]\n"
+ "Description=Early root shell on /dev/%s FOR DEBUGGING ONLY\n"
+ "ConditionPathExists=\n"
+ "\n[Service]\n"
+ "TTYPath=/dev/%s\n",
+ tty, tty);
if (r < 0)
- log_warning_errno(r, "Failed to write drop-in for debug-shell.service, ignoring: %m");
+ return log_warning_errno(r, "Failed to write drop-in for debug-shell.service: %m");
+
+ return 1;
}
static int process_unit_credentials(const char *credentials_dir) {
static int run(const char *dest, const char *dest_early, const char *dest_late) {
const char *credentials_dir;
- int r = 0;
+ int r;
assert_se(arg_dest = dest_early);
if (strv_extend(&arg_wants, "debug-shell.service") < 0)
return log_oom();
- install_debug_shell_dropin();
+ RET_GATHER(r, install_debug_shell_dropin());
}
if (get_credentials_dir(&credentials_dir) >= 0)