generator.c revision f647962d64e844689f3e2acfce6102fc47e76df2
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2014 Lennart Poettering
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <string.h>
#include <unistd.h>
#include "util.h"
#include "special.h"
#include "mkdir.h"
#include "unit-name.h"
#include "generator.h"
#include "path-util.h"
#include "dropin.h"
FILE *f,
const char *dest,
const char *what,
const char *where,
const char *fstype) {
assert(f);
if (!is_device_path(what)) {
return 0;
}
int r;
r = fsck_exists(fstype);
if (r == -ENOENT) {
/* treat missing check as essentially OK */
return 0;
} else if (r < 0)
return log_warning_errno(r, "Checking was requested for %s, but fsck.%s cannot be used: %m", what, fstype);
}
char *lnk;
return -errno;
}
} else {
if (!fsck)
return log_oom();
fprintf(f,
"RequiresOverridable=%s\n"
"After=%s\n",
fsck,
fsck);
}
return 0;
}
/* Allow configuration how long we wait for a device that
* backs a mount point to show up. This is useful to support
* endless device timeouts for devices that show up only after
* user input, like crypto devices. */
usec_t u;
int r;
else {
if (filtered) {
if (!*filtered)
return log_oom();
}
return 0;
}
if (!t)
return -ENOMEM;
if (filtered) {
if (!*filtered)
return log_oom();
}
r = parse_sec(t, &u);
if (r < 0) {
log_warning("Failed to parse timeout for %s, ignoring: %s",
return 0;
}
if (!node)
return log_oom();
if (!unit)
return -ENOMEM;
"# Automatically generated by %s\n\n"
"[Unit]\nJobTimeoutSec=" USEC_FMT,
u / USEC_PER_SEC);
}