X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fgpt-auto-generator%2Fgpt-auto-generator.c;h=25440e771ece5bfa90d2cd4d13c710ba9e9d6a87;hb=e4c0fbe50c9a4a26efa4ae2b2350215be29b8660;hp=b6f6a74a22a387a8b542f72f530cea8fe0b18226;hpb=1ca208fb4f93e5869704af1812cbff7130a2fc03;p=elogind.git diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c index b6f6a74a2..25440e771 100644 --- a/src/gpt-auto-generator/gpt-auto-generator.c +++ b/src/gpt-auto-generator/gpt-auto-generator.c @@ -54,7 +54,7 @@ static const char *arg_dest = "/tmp"; -define_trivial_cleanup_func(blkid_probe, blkid_free_probe) +DEFINE_TRIVIAL_CLEANUP_FUNC(blkid_probe, blkid_free_probe); #define _cleanup_blkid_freep_probe_ _cleanup_(blkid_free_probep) static int verify_gpt_partition(const char *node, sd_id128_t *type, unsigned *nr, char **fstype) { @@ -182,7 +182,7 @@ static int add_swap(const char *path, const char *fstype) { } static int add_home(const char *path, const char *fstype) { - _cleanup_free_ char *unit = NULL, *lnk = NULL; + _cleanup_free_ char *unit = NULL, *lnk = NULL, *fsck = NULL; _cleanup_fclose_ FILE *f = NULL; if (dir_is_empty("/home") <= 0) @@ -200,19 +200,23 @@ static int add_home(const char *path, const char *fstype) { return -errno; } + fsck = unit_name_from_path_instance("systemd-fsck", path, ".service"); + if (!fsck) + return log_oom(); + fprintf(f, "# Automatically generated by systemd-gpt-auto-generator\n\n" "[Unit]\n" "DefaultDependencies=no\n" - "After=" SPECIAL_LOCAL_FS_PRE_TARGET "\n" + "Requires=%s\n" + "After=" SPECIAL_LOCAL_FS_PRE_TARGET " %s\n" "Conflicts=" SPECIAL_UMOUNT_TARGET "\n" "Before=" SPECIAL_UMOUNT_TARGET " " SPECIAL_LOCAL_FS_TARGET "\n\n" "[Mount]\n" "What=%s\n" "Where=/home\n" - "Type=%s\n" - "FsckPassNo=2\n", - path, fstype); + "Type=%s\n", + fsck, fsck, path, fstype); fflush(f); if (ferror(f)) {