From 7870db8b10caf0d78d9472531a31e87aa865ab6b Mon Sep 17 00:00:00 2001 From: Rickard Nilsson Date: Tue, 9 Apr 2013 16:36:38 +0200 Subject: [PATCH] unionfs: Add mount helper (mount.unionfs-fuse) This makes it possible to mount unionfs directly with mount or fstab. Example fstab entry: none /mnt/union unionf-fuse allow-other,dirs=/source1=RW,/source2=RW Note, the dirs= option need to be the last option, due to limitations in the mount helper provided by unionfs-fuse. Maybe we should write a better helper ourselves. Also, you need to specify your branches as dirs= option, NOT as the device, since the latest version of libmount always interprets "=" characters in the device name as a tag (like LABEL, UUID etc) and will try to resolve the tag before calling the mount helper. This will of course not succeed and the mount will fail. --- pkgs/tools/filesystems/unionfs-fuse/default.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pkgs/tools/filesystems/unionfs-fuse/default.nix b/pkgs/tools/filesystems/unionfs-fuse/default.nix index 43d7a5a8d18..5b681ab170c 100644 --- a/pkgs/tools/filesystems/unionfs-fuse/default.nix +++ b/pkgs/tools/filesystems/unionfs-fuse/default.nix @@ -5,12 +5,24 @@ stdenv.mkDerivation rec { src = fetchurl { url = "http://podgorny.cz/unionfs-fuse/releases/${name}.tar.xz"; - sha256 = "0qpnr4czgc62vsfnmv933w62nq3xwcbnvqch72qakfgca75rsp4d"; }; buildInputs = [ cmake fuse ]; + # Put the unionfs mount helper in place as mount.unionfs-fuse. This makes it + # possible to do: + # mount -t unionfs-fuse none /dest -o dirs=/source1=RW,/source2=RO + # + # This must be done in preConfigure because the build process removes + # helper from the source directory during the build. + preConfigure = '' + ensureDir $out/sbin + cp -a mount.unionfs $out/sbin/mount.unionfs-fuse + substituteInPlace $out/sbin/mount.unionfs-fuse --replace mount.fuse ${fuse}/sbin/mount.fuse + substituteInPlace $out/sbin/mount.unionfs-fuse --replace unionfs $out/bin/unionfs + ''; + meta = { description = "FUSE UnionFS implementation"; homepage = http://podgorny.cz/moin/UnionFsFuse;