|
| 1 | +{ |
| 2 | + pkgs ? import <nixpkgs> { }, |
| 3 | + diskoLib ? pkgs.callPackage ../lib { }, |
| 4 | +}: |
| 5 | +diskoLib.testLib.makeDiskoTest { |
| 6 | + inherit pkgs; |
| 7 | + name = "btrfs-mountoptions-per-mount-allowed"; |
| 8 | + disko-config = pkgs.lib.recursiveUpdate (import ../example/btrfs-subvolumes.nix) { |
| 9 | + disko.devices.disk.main.content.partitions.root.content.subvolumes = { |
| 10 | + "/home".mountOptions = [ "noexec" ]; |
| 11 | + "/nosuid" = { |
| 12 | + mountpoint = "/nosuid"; |
| 13 | + mountOptions = [ "nosuid" ]; |
| 14 | + }; |
| 15 | + "/nodev" = { |
| 16 | + mountpoint = "/nodev"; |
| 17 | + mountOptions = [ "nodev" ]; |
| 18 | + }; |
| 19 | + "/noatime" = { |
| 20 | + mountpoint = "/noatime"; |
| 21 | + mountOptions = [ "noatime" ]; |
| 22 | + }; |
| 23 | + }; |
| 24 | + }; |
| 25 | + extraTestScript = '' |
| 26 | + machine.succeed("mountpoint /"); |
| 27 | + machine.succeed("mountpoint /home"); |
| 28 | + machine.succeed("mountpoint /nosuid"); |
| 29 | + machine.succeed("mountpoint /nodev"); |
| 30 | + machine.succeed("mountpoint /noatime"); |
| 31 | + machine.succeed("findmnt -no OPTIONS /home | tr ',' '\n' | grep -qx noexec"); |
| 32 | + machine.succeed("findmnt -no OPTIONS /nosuid | tr ',' '\n' | grep -qx nosuid"); |
| 33 | + machine.succeed("findmnt -no OPTIONS /nodev | tr ',' '\n' | grep -qx nodev"); |
| 34 | + machine.succeed("findmnt -no OPTIONS /noatime | tr ',' '\n' | grep -qx noatime"); |
| 35 | + machine.fail("findmnt -no OPTIONS / | tr ',' '\n' | grep -qx noexec"); |
| 36 | + machine.fail("findmnt -no OPTIONS / | tr ',' '\n' | grep -qx nosuid"); |
| 37 | + machine.fail("findmnt -no OPTIONS / | tr ',' '\n' | grep -qx nodev"); |
| 38 | + machine.fail("findmnt -no OPTIONS / | tr ',' '\n' | grep -qx noatime"); |
| 39 | + ''; |
| 40 | +} |
0 commit comments