chiark / gitweb /
build-sys: Add configure check for linux/btrfs.h
[elogind.git] / src / gpt-auto-generator / gpt-auto-generator.c
index 0c7635bfe40e753646e4ddcff44a75a77a54d7cf..a26655f096fe6ddf4a62b1c8bec58b7d79a18330 100644 (file)
 #include <unistd.h>
 #include <stdlib.h>
 #include <fcntl.h>
-#include <linux/btrfs.h>
 #include <sys/ioctl.h>
 #include <sys/statfs.h>
 #include <blkid.h>
 
+#ifdef HAVE_LINUX_BTRFS_H
+#include <linux/btrfs.h>
+#endif
+
 #include "path-util.h"
 #include "util.h"
 #include "mkdir.h"
@@ -40,6 +43,7 @@
  *
  * - Properly handle cryptsetup partitions
  * - Define new partition type for encrypted swap
+ * - Make /home automount rather than mount
  *
  */
 
@@ -174,7 +178,7 @@ static int add_swap(const char *path, const char *fstype) {
                 "DefaultDependencies=no\n"
                 "Conflicts=" SPECIAL_UMOUNT_TARGET "\n"
                 "Before=" SPECIAL_UMOUNT_TARGET " " SPECIAL_SWAP_TARGET "\n\n"
-                "[Mount]\n"
+                "[Swap]\n"
                 "What=%s\n",
                 path);
 
@@ -201,6 +205,9 @@ static int add_home(const char *path, const char *fstype) {
         _cleanup_free_ char *unit = NULL, *lnk = NULL;
         _cleanup_fclose_ FILE *f = NULL;
 
+        if (dir_is_empty("/home") <= 0)
+                return 0;
+
         log_debug("Adding home: %s %s", path, fstype);
 
         unit = strappend(arg_dest, "/home.mount");