aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xinclude/partition.sh66
-rw-r--r--src/fripost-partman-udeb/debian/control2
2 files changed, 38 insertions, 30 deletions
diff --git a/include/partition.sh b/include/partition.sh
index 10c17a0..35f259a 100755
--- a/include/partition.sh
+++ b/include/partition.sh
@@ -85,16 +85,26 @@ encrypt=$RET
db_set grub-installer/bootdev "${device%% *}"
db_fset grub-installer/bootdev seen true
+part_efi=
part_boot=
+part_swap=
part_system=
# Create boot and system partitions
for d in $device; do
- pb=$( fripost_mkpart $d boot 64M )
- ps=$( fripost_mkpart $d system 100% )
- part_boot="${part_boot:+$part_boot }$pb"
- part_system="${part_system:+$part_system }$ps"
- /sbin/parted -s $d align-check opt ${ps#$d} \
- || fatal "$ps is not aligned"
+ p=$( fripost_mkpart $d boot 64M )
+ part_boot="${part_boot:+$part_boot }$p"
+
+ p=$( fripost_mkpart $d swap 1G ) # FIXME
+ part_swap="${part_swap:+$part_swap }$p"
+ /sbin/parted -s $d align-check opt ${p#$d} \
+ || fatal "$p is not aligned"
+
+ p=$( fripost_mkpart $d system 100% )
+ part_system="${part_system:+$part_system }$p"
+ /sbin/parted -s $d align-check opt ${p#$d} \
+ || fatal "$p is not aligned"
+
+ log "Done with device $d"
done
# Create an array on top of that
@@ -106,6 +116,11 @@ if [ ${raidLevel:-} ]; then
fripost_mdadm_create "$part_boot" -f -R -l $raidLevel \
${raidNumActiveDevices:+-n $raidNumActiveDevices} $devices
+ devices="$part_swap"
+ part_swap=/dev/md/swap
+ fripost_mdadm_create "$part_swap" -f -R -l raid0 \
+ ${raidNumActiveDevices:+-n $raidNumActiveDevices} $devices
+
devices="$part_system"
part_system=/dev/md/system
fripost_mdadm_create "$part_system" -f -R -l $raidLevel \
@@ -148,31 +163,24 @@ if [ $encrypt = true ]; then
fi
-# Ensure LVM2 is installed in the target chroot; create logical volumes
-# for /, swap and /home.
-apt-install lvm2 || true
-vg=$(hostname)
-pvcreate -ff -y $part_system
-vgcreate $vg $part_system
-
-lvcreate -L 5G -n root $vg # FIXME
-lvcreate -L 1G -n swap $vg # FIXME
-lvcreate -l 100%FREE -n home $vg # FIXME
-vgchange -ay $vg
-
-
# Format the partitions
-fripost_mkfs ext2 $part_boot -E resize=512M -m1 -b 4096
-fripost_mkfs ext4 /dev/$vg/root -b 4096
-fripost_mkfs ext4 /dev/$vg/home -b 4096
-mkswap /dev/$vg/swap
+fripost_mkfs ext2 "$part_boot" -F -E resize=512M -m1 -b 4096
+fripost_mkfs btrfs "$part_system" -f
+mkswap "$part_swap"
+
+# Create BTRFS subvolumes
+mkdir -p /target
+apt-install btrfs-tools || true
+mount -t btrfs -o compress=lzo "$part_system" /target
+btrfs subvol create /target/@
+btrfs subvol create /target/@home
+umount /target
# Stuff the fstab and mount the devices in the target
-fripost_fstab $part_boot /boot ext2 noatime
-[ -d /proc/efi -o -d /sys/firmware/efi ] && \
-fripost_fstab $part_efi /boot/efi vfat defaults
-fripost_fstab /dev/$vg/root / ext4 noatime,errors=remount-ro
-fripost_fstab /dev/$vg/swap none swap sw
-fripost_fstab /dev/$vg/home /home ext4 noatime
+fripost_fstab "$part_boot" /boot ext2 defaults
+fripost_fstab "$part_efi" /boot/efi vfat defaults
+fripost_fstab "$part_system" / btrfs compress=lzo,subvol=@
+fripost_fstab "$part_system" /home btrfs compress=lzo,subvol=@home
+fripost_fstab "$part_swap" none swap sw
fripost_mount_partitions
diff --git a/src/fripost-partman-udeb/debian/control b/src/fripost-partman-udeb/debian/control
index 355bc68..94e76f6 100644
--- a/src/fripost-partman-udeb/debian/control
+++ b/src/fripost-partman-udeb/debian/control
@@ -8,7 +8,7 @@ Package: fripost-partman
XC-Package-Type: udeb
Architecture: any
Depends: cdebconf-udeb, parted-udeb, xfsprogs-udeb, hw-detect, md-modules,
- mdadm-udeb, lvm2-udeb, dmsetup-udeb, ntfstools-udeb, xfs-modules,
+ mdadm-udeb, btrfs-tools-udeb, dmsetup-udeb, ntfstools-udeb, xfs-modules,
ext2-modules, ext3-modules, openssh-server-udeb, cryptsetup-udeb,
crypto-dm-modules, ${misc:Depends}, ${shlibs:Depends}
Provides: created-fstab, made-filesystems, mounted-partitions,