Customise partman-btrfs for witOS
This commit is contained in:
parent
a8d10cfbc5
commit
88f7226135
3 changed files with 107 additions and 43 deletions
13
debian/control
vendored
13
debian/control
vendored
|
|
@ -1,17 +1,18 @@
|
||||||
Source: partman-btrfs
|
Source: partman-btrfs
|
||||||
Section: debian-installer
|
Section: debian-installer
|
||||||
Priority: standard
|
Priority: standard
|
||||||
Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
|
Maintainer: witOS Team <team@witos.dev>
|
||||||
Uploaders: Anton Zinoviev <zinoviev@debian.org>,
|
Uploaders: Andrew Ying <andrew@witine.com>
|
||||||
Nicholas D Steeves <nsteeves@gmail.com>
|
|
||||||
Build-Depends: debhelper-compat (= 13), dh-di, po-debconf
|
Build-Depends: debhelper-compat (= 13), dh-di, po-debconf
|
||||||
Rules-Requires-Root: no
|
Rules-Requires-Root: no
|
||||||
Vcs-Browser: https://salsa.debian.org/installer-team/partman-btrfs
|
XS-Debian-Vcs-Browser: https://salsa.debian.org/installer-team/partman-btrfs
|
||||||
Vcs-Git: https://salsa.debian.org/installer-team/partman-btrfs.git
|
XS-Debian-Vcs-Git: https://salsa.debian.org/installer-team/partman-btrfs.git
|
||||||
|
Vcs-Browser: https://git.witine.com/witos/partman-btrfs
|
||||||
|
Vcs-Git: https://git.witine.com/witos/partman-btrfs.git
|
||||||
|
|
||||||
Package: partman-btrfs
|
Package: partman-btrfs
|
||||||
Package-Type: udeb
|
Package-Type: udeb
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Depends: ${misc:Depends}, btrfs-progs-udeb, btrfs-modules, partman-basicfilesystems, partman-base
|
Depends: ${misc:Depends}, btrfs-progs-udeb, btrfs-modules, partman-basicfilesystems, partman-base, witos-release
|
||||||
Provides: partman-filesystem
|
Provides: partman-filesystem
|
||||||
Description: Add to partman support for btrfs
|
Description: Add to partman support for btrfs
|
||||||
|
|
|
||||||
102
fstab.d/btrfs
102
fstab.d/btrfs
|
|
@ -2,33 +2,79 @@
|
||||||
|
|
||||||
. /lib/partman/lib/base.sh
|
. /lib/partman/lib/base.sh
|
||||||
|
|
||||||
|
fs_found="unknown"
|
||||||
|
var_log_found="unknown"
|
||||||
|
|
||||||
|
# There is no btrfs fsck
|
||||||
|
pass=0
|
||||||
|
|
||||||
for dev in $DEVICES/*; do
|
for dev in $DEVICES/*; do
|
||||||
[ -d $dev ] || continue
|
[ -d $dev ] || continue
|
||||||
cd $dev
|
cd $dev
|
||||||
open_dialog PARTITIONS
|
open_dialog PARTITIONS
|
||||||
while { read_line num id size type fs path name; [ "$id" ]; }; do
|
while { read_line num id size type fs path name; [ "$id" ]; }; do
|
||||||
[ $fs != free ] || continue
|
[ $fs != free ] || continue
|
||||||
[ -f "$id/method" ] || continue
|
[ -f "$id/method" ] || continue
|
||||||
[ -f "$id/acting_filesystem" ] || continue
|
[ -f "$id/acting_filesystem" ] || continue
|
||||||
method=$(cat $id/method)
|
method=$(cat $id/method)
|
||||||
filesystem=$(cat $id/acting_filesystem)
|
filesystem=$(cat $id/acting_filesystem)
|
||||||
case "$filesystem" in
|
mountpoint=$(cat $id/mountpoint)
|
||||||
btrfs)
|
case "$filesystem" in
|
||||||
[ -f "$id/mountpoint" ] || continue
|
btrfs)
|
||||||
mountpoint=$(cat $id/mountpoint)
|
[ -f "$id/mountpoint" ] || continue
|
||||||
# due to #249322, #255135, #258117:
|
# due to #249322, #255135, #258117:
|
||||||
if [ "$mountpoint" = "/tmp" ]; then
|
if [ "$mountpoint" = "/tmp" ]; then
|
||||||
rm -f $id/options/noexec
|
rm -f $id/options/noexec
|
||||||
fi
|
fi
|
||||||
if [ "$mountpoint" = "/" ]; then
|
options=$(get_mountoptions $dev $id)
|
||||||
options="$(get_mountoptions $dev $id),subvol=@rootfs"
|
if [ "$mountpoint" = "/" ]; then
|
||||||
else
|
# /var/log
|
||||||
options=$(get_mountoptions $dev $id)
|
if [ "$var_log_found" = "unknown" ]; then
|
||||||
fi
|
var_log_options="${options:+$options,}subvol=log"
|
||||||
# There is no btrfs fsck
|
var_log_path="$path"
|
||||||
echo "$path" "$mountpoint" btrfs $options 0 0
|
var_log_mp="${mountpoint}var/log"
|
||||||
;;
|
var_log_found="false"
|
||||||
esac
|
fi
|
||||||
done
|
|
||||||
close_dialog
|
# /run/witos
|
||||||
|
if [ "$fs_found" = "unknown" ]; then
|
||||||
|
fs_options="$options"
|
||||||
|
fs_path="$path"
|
||||||
|
fs_mp="${mountpoint}run/witos"
|
||||||
|
fs_found="false"
|
||||||
|
fi
|
||||||
|
|
||||||
|
db_get witos-release/version
|
||||||
|
witos_version="$RET"
|
||||||
|
options="${options:+$options,}subvol=images/${witos_version:-dev}"
|
||||||
|
|
||||||
|
elif [ "$mountpoint" = "/var/log" ]; then
|
||||||
|
options="${options:+$options,}subvol=log"
|
||||||
|
var_log_found="true"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$path" "$mountpoint" btrfs "$options" 0 $pass
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
if [ "$mountpoint" = "/run/witos" ]; then
|
||||||
|
fs_found="true"
|
||||||
|
elif [ "$mountpoint" = "/var/log" ]; then
|
||||||
|
var_log_found="true"
|
||||||
|
elif [ "$mountpoint" = "/var" ]; then
|
||||||
|
var_log_found="true"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
close_dialog
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ "$var_log_found" = "false" ]; then
|
||||||
|
echo "$var_log_path" "$var_log_mp" btrfs "$var_log_options" 0 $pass
|
||||||
|
var_log_found="true"
|
||||||
|
fi
|
||||||
|
if [ "$fs_found" = "false" ]; then
|
||||||
|
echo "$fs_path" "$fs_mp" btrfs "$fs_options" 0 $pass
|
||||||
|
fs_found="true"
|
||||||
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
. /lib/partman/lib/base.sh
|
||||||
|
|
||||||
set -- $1
|
set -- $1
|
||||||
|
|
||||||
fs=$1
|
fs=$1
|
||||||
|
|
@ -11,19 +13,34 @@ pass=$6
|
||||||
|
|
||||||
case $type in
|
case $type in
|
||||||
btrfs)
|
btrfs)
|
||||||
# import workaround from Kali's partman-btrfs commit:7f43d2c
|
|
||||||
options="${options%,subvol=*}"
|
options="${options%,subvol=*}"
|
||||||
#for removing the option subvol,when thats the only option
|
#for removing the option subvol,when thats the only option
|
||||||
#eg: options=="subvol=@", no comma present
|
#eg: options=="subvol=@", no comma present
|
||||||
options="${options%subvol=*}"
|
options="${options%subvol=*}"
|
||||||
mount -t btrfs ${options:+-o "$options"} $fs /target"$mp" || exit 1
|
mount -t btrfs ${options:+-o "$options"} $fs /target$mp || exit 1
|
||||||
if [ $mp = / ]; then
|
case $mp in
|
||||||
btrfs subvolume create /target$mp/@rootfs
|
/)
|
||||||
chmod 755 /target$mp/@rootfs
|
mkdir /target$mp/images
|
||||||
umount /target$mp
|
chmod 755 /target$mp/images
|
||||||
options="${options:+$options,}subvol=@rootfs"
|
db_get witos-release/version
|
||||||
mount -t btrfs -o $options $fs /target$mp
|
witos_version="$RET"
|
||||||
fi
|
btrfs subvolume create /target$mp/images/${witos_version:-dev}
|
||||||
|
chmod 755 /target$mp/images/${witos_version:-dev}
|
||||||
|
umount /target$mp
|
||||||
|
options="${options:+$options,}subvol=images/${witos_version:-dev}"
|
||||||
|
mount -t btrfs -o $options $fs /target$mp
|
||||||
|
;;
|
||||||
|
/var/log)
|
||||||
|
btrfs subvolume create /target$mp/log
|
||||||
|
chmod 755 /target$mp/log
|
||||||
|
umount /target$mp
|
||||||
|
options="${options:+$options,}subvol=log"
|
||||||
|
mount -t btrfs -o $options $fs /target$mp
|
||||||
|
;;
|
||||||
|
/run/witos)
|
||||||
|
umount /target$mp
|
||||||
|
;;
|
||||||
|
esac
|
||||||
echo "umount /target$mp"
|
echo "umount /target$mp"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue