X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=schrootupdate;fp=schrootupdate;h=8d3d1e9ced18a9e8ba630197e7b94e72baa5472f;hb=2a1cee2e73d9291dde9af831bbe9e996199b7cbc;hp=533e087d010fdf47dd73a4a63b44d49449f3439f;hpb=935d88c091765b6aafdfc9f3d62d0dc377e5ff93;p=distro-setup diff --git a/schrootupdate b/schrootupdate index 533e087..8d3d1e9 100755 --- a/schrootupdate +++ b/schrootupdate @@ -12,3 +12,30 @@ for n in bullseye; do schroot -c $n -- apt-get -y dist-upgrade --purge --auto-remove fi done + +# if we haven't upgraded yet +if [[ ! -d /mnt/boot/debianbullseye_bootstrap ]]; then + exit 0 +fi + +dev=$(awk '$2 == "/mnt/boot" {print $1}' /etc/mtab) +if [[ ! $dev ]]; then + exit 0 +fi +mkdir -p /mnt/tmptimer +mount -o subvol=debianbullseye_bootstrap $dev /mnt/tmptimer +cd /mnt/tmptimer +for d in dev proc sys dev/pts; do + [[ -d $d ]] + if ! mountpoint $d &>/dev/null; then + mount -o bind /$d $d + fi +done +chroot . apt-get -y update +chroot . apt-get -y dist-upgrade --purge --auto-remove + +for d in dev/pts dev proc sys; do + if mountpoint $d &>/dev/null; then + umount $d + fi +done