switchroot: Allow letting ostree-prepare-root mount /var

In some scenarios, it might make sense to let `ostree-prepare-root` do
the `/var` mount from the state root as before. For example, one may
want to do some system configuration before the switch root. This of
course comes at the expense of supporting `/var` as a mount point in
`/etc/fstab`.

Closes: #1617
Approved by: cgwalters
This commit is contained in:
Jonathan Lebon authored and Atomic Bot committed 2018-06-07 21:41:32 +00:00
1 parent 6f3b5620de
commit ecdebeb20e
3 files changed
+21 -4

No files matched your search

+10
View File
@@ -49,6 +49,16 @@ main(int argc, char *argv[])
exit (EXIT_SUCCESS);
}
/* We conflict with the magic ostree-mount-deployment-var file for ostree-prepare-root */
{ struct stat stbuf;
if (fstatat (AT_FDCWD, INITRAMFS_MOUNT_VAR, &stbuf, 0) == 0)
{
if (unlinkat (AT_FDCWD, INITRAMFS_MOUNT_VAR, 0) < 0)
err (EXIT_FAILURE, "Can't unlink " INITRAMFS_MOUNT_VAR);
exit (EXIT_SUCCESS);
}
}
if (argc > 1 && argc != 4)
errx (EXIT_FAILURE, "This program takes three or no arguments");