#!/bin/sh # checks of partman-scubed3, before partman finishes: # - a base device must be configured (Configure scubed3) # - no swap on a scubed3 partition, no /boot # - other file systems on scubed3 (/home, ...) need root on scubed3: the # initramfs starts scubed3 only for root on scubed3, and opens the LUKS # volumes of the view of root; a note says that whoever has the boot # passphrase sees them # - root on scubed3 is on the partition root (the initramfs boots from it), # and needs a /boot partition that is not on scubed3 . /lib/partman/lib/scubed3-base.sh error () { db_fset $1 seen false db_input critical $1 db_go || true exit 1 } if [ "$(s3_bases)" ] && ! s3_running; then error partman-scubed3/not_configured fi have_boot=no s3_root=no others= for dev in $DEVICES/*; do [ -d "$dev" ] || continue cd $dev ours=no s3_is_ours $dev && ours=yes ids= open_dialog PARTITIONS while { read_line num id size type fs path name; [ "$id" ]; }; do [ "$fs" != free ] || continue ids="$ids $id" done close_dialog for id in $ids; do [ -f $id/method ] || continue method=$(cat $id/method) mnt= [ -f $id/mountpoint ] && mnt=$(cat $id/mountpoint) if [ $ours = no ]; then [ "$mnt" = /boot ] && have_boot=yes continue fi case $method in swap) error partman-scubed3/no_swap ;; format|keep) case "$mnt" in /) s3_root=yes [ "$(cat $dev/device)" = "$(s3_luks_dev root)" ] || error partman-scubed3/root_not_root ;; /boot|/boot/*) error partman-scubed3/no_boot ;; "") ;; *) others="${others:+$others, }$mnt" ;; esac ;; dontuse) ;; *) db_subst partman-scubed3/not_supported METHOD "$method" error partman-scubed3/not_supported ;; esac done done if [ "$others" ] && [ $s3_root = no ]; then db_subst partman-scubed3/others_need_root MOUNTPOINTS "$others" error partman-scubed3/others_need_root fi if [ $s3_root = yes ] && [ $have_boot = no ]; then error partman-scubed3/root_needs_boot fi # once: the other file systems are not hidden from the root partition if [ "$others" ]; then db_fget partman-scubed3/others_note seen if [ "$RET" != true ]; then db_subst partman-scubed3/others_note MOUNTPOINTS "$others" db_input critical partman-scubed3/others_note || true db_go || true db_fset partman-scubed3/others_note seen true fi fi exit 0