mirror of
https://github.com/nix-community/disko.git
synced 2026-12-03 06:23:28 +01:00
btrfs: create all subvolumes
This commit is contained in:
1 parent
40f3218b14
commit
7be0f0cab5
2 files changed
+5
-3
No files matched your search
+3
-3
@@ -67,8 +67,8 @@
|
|||||||
default = { dev }: ''
|
default = { dev }: ''
|
||||||
mkfs.btrfs ${dev} ${toString config.extraArgs}
|
mkfs.btrfs ${dev} ${toString config.extraArgs}
|
||||||
${lib.concatMapStrings (subvol: ''
|
${lib.concatMapStrings (subvol: ''
|
||||||
MNTPOINT=$(mktemp -d)
|
|
||||||
(
|
(
|
||||||
|
MNTPOINT=$(mktemp -d)
|
||||||
mount ${dev} "$MNTPOINT" -o subvol=/
|
mount ${dev} "$MNTPOINT" -o subvol=/
|
||||||
trap 'umount $MNTPOINT; rm -rf $MNTPOINT' EXIT
|
trap 'umount $MNTPOINT; rm -rf $MNTPOINT' EXIT
|
||||||
btrfs subvolume create "$MNTPOINT"/${subvol.name} ${toString subvol.extraArgs}
|
btrfs subvolume create "$MNTPOINT"/${subvol.name} ${toString subvol.extraArgs}
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
else null;
|
else null;
|
||||||
in
|
in
|
||||||
lib.optionalAttrs (mountpoint != null) {
|
lib.optionalAttrs (mountpoint != null) {
|
||||||
fs.${mountpoint} = ''
|
${mountpoint} = ''
|
||||||
if ! findmnt ${dev} "${rootMountPoint}${mountpoint}" > /dev/null 2>&1; then
|
if ! findmnt ${dev} "${rootMountPoint}${mountpoint}" > /dev/null 2>&1; then
|
||||||
mount ${dev} "${rootMountPoint}${mountpoint}" \
|
mount ${dev} "${rootMountPoint}${mountpoint}" \
|
||||||
${lib.concatMapStringsSep " " (opt: "-o ${opt}") (subvol.mountOptions ++ [ "subvol=${subvol.name}" ])} \
|
${lib.concatMapStringsSep " " (opt: "-o ${opt}") (subvol.mountOptions ++ [ "subvol=${subvol.name}" ])} \
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
config.subvolumes;
|
config.subvolumes;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
fs = subvolMounts.fs // lib.optionalAttrs (config.mountpoint != null) {
|
fs = subvolMounts // lib.optionalAttrs (config.mountpoint != null) {
|
||||||
${config.mountpoint} = ''
|
${config.mountpoint} = ''
|
||||||
if ! findmnt ${dev} "${rootMountPoint}${config.mountpoint}" > /dev/null 2>&1; then
|
if ! findmnt ${dev} "${rootMountPoint}${config.mountpoint}" > /dev/null 2>&1; then
|
||||||
mount ${dev} "${rootMountPoint}${config.mountpoint}" \
|
mount ${dev} "${rootMountPoint}${config.mountpoint}" \
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ makeDiskoTest {
|
|||||||
extraTestScript = ''
|
extraTestScript = ''
|
||||||
machine.succeed("test -e /test");
|
machine.succeed("test -e /test");
|
||||||
machine.succeed("btrfs subvolume list / | grep -qs 'path test$'");
|
machine.succeed("btrfs subvolume list / | grep -qs 'path test$'");
|
||||||
|
machine.succeed("btrfs subvolume list / | grep -qs 'path nix$'");
|
||||||
|
machine.succeed("btrfs subvolume list / | grep -qs 'path home$'");
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference in new issue
Block a user