24 lines
549 B
Bash
Executable File
24 lines
549 B
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
BTRFS_ROOT="{{@@ filesystem.partitions['/'] @@}}"
|
|
|
|
if ! mountpoint "$BTRFS_ROOT"
|
|
then
|
|
mkdir -p "$BTRFS_ROOT"
|
|
mount "$BTRFS_ROOT"
|
|
fi
|
|
cd "$BTRFS_ROOT"
|
|
|
|
|
|
{%@@ set new_partitions = filesystem.partitions.update({root_subvol: '/'}) @@%}
|
|
{%@@ for name, path in filesystem.partitions.items() @@%}
|
|
test -e "./{{@@ name @@}}" ||
|
|
btrfs subvolume create "./{{@@ name @@}}"
|
|
test -d "{{@@ path @@}}" ||
|
|
mkdir -p "{{@@ path @@}}"
|
|
mountpoint "{{@@ path @@}}" ||
|
|
mount "{{@@ path @@}}"
|
|
{%@@ endfor @@%}
|