mirror of
https://github.com/nix-community/disko.git
synced 2024-09-11 06:25:33 +03:00
Merge pull request #11 from nix-community/change-mount-code
use findmnt and mount with X-mount.mkdir
This commit is contained in:
commit
e97ddb5138
@ -88,9 +88,8 @@ let {
|
||||
|
||||
mount.filesystem = q: x: {
|
||||
fs.${x.mountpoint} = ''
|
||||
if ! [ "$(mount | sed -n 's:\([^ ]\+\) on /mnt${x.mountpoint} .*:\1:p')" = ${q.device} ]; then
|
||||
mkdir -p /mnt${x.mountpoint}
|
||||
mount ${q.device} /mnt${x.mountpoint}
|
||||
if ! findmnt "${q.device}" "/mnt${x.mountpoint}" > /dev/null 2>&1; then
|
||||
mount "${q.device}" "/mnt${x.mountpoint}" -o X-mount.mkdir
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
@ -85,6 +85,8 @@ let
|
||||
};
|
||||
};
|
||||
};
|
||||
tsp-create = pkgs.writeScript "create" ((pkgs.callPackage ../. {}).create disko-config);
|
||||
tsp-mount = pkgs.writeScript "mount" ((pkgs.callPackage ../. {}).mount disko-config);
|
||||
in makeTest' {
|
||||
name = "disko";
|
||||
|
||||
@ -105,8 +107,9 @@ in makeTest' {
|
||||
|
||||
testScript = ''
|
||||
machine.succeed("echo 'secret' > /tmp/secret.key");
|
||||
machine.succeed("${pkgs.writeScript "create" ((pkgs.callPackage ../. {}).create disko-config)}");
|
||||
machine.succeed("${pkgs.writeScript "mount" ((pkgs.callPackage ../. {}).mount disko-config)}");
|
||||
machine.succeed("${tsp-create}");
|
||||
machine.succeed("${tsp-mount}");
|
||||
machine.succeed("${tsp-mount}"); # verify that the command is idempotent
|
||||
machine.succeed("test -b /dev/mapper/pool-raw");
|
||||
'';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user