#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/statfs.h>
-#include <blkid.h>
+#include <blkid/blkid.h>
#ifdef HAVE_LINUX_BTRFS_H
#include <linux/btrfs.h>
errno = 0;
r = blkid_do_safeprobe(b);
- if (r == -2)
- return -ENODEV;
- else if (r == 1)
- return -ENODEV;
+ if (r == -2 || r == 1) /* no result or uncertain */
+ return -EBADSLT;
else if (r != 0)
return errno ? -errno : -EIO;
}
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)
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)) {
if (!lnk)
return log_oom();
-
mkdir_parents_label(lnk, 0755);
if (symlink(unit, lnk) < 0) {
log_error("Failed to create symlink %s: %m", lnk);
r = verify_gpt_partition(node, &type_id, &nr, &fstype);
if (r < 0) {
+ /* skip child devices which are not detected properly */
+ if (r == -EBADSLT)
+ continue;
log_error("Failed to verify GPT partition %s: %s",
node, strerror(-r));
return r;