Created
May 22, 2025 00:51
-
-
Save ohmantics/bf3821d5e988ab7ee9a941e23031ca5e to your computer and use it in GitHub Desktop.
Upgrade Proxmox that uses zectl to set boot environments (with ZFSBootMenu to pick amongst them)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
if [[ $# -ne 1 ]]; then | |
echo 'Too many/few arguments, expecting one (new bootenv name)' >&2 | |
exit 1 | |
fi | |
name=$1 | |
#echo "***CREATING***" | |
zectl create "${name}" | |
#echo "***MOUNTING***" | |
mountpoint="$(zectl mount ${name})" | |
pushd "${mountpoint}" > /dev/null | |
mount -t proc /proc proc/ | |
mount --rbind /dev dev/ | |
mount --rbind /sys sys/ | |
mount --make-rslave dev/ | |
mount --make-rslave sys/ | |
popd | |
#echo "***UPGRADING***" | |
chroot "${mountpoint}" apt dist-upgrade | |
#echo "***UNMOUNTING***" | |
umount -R "${mountpoint}"/proc | |
umount -R "${mountpoint}"/dev | |
umount -R "${mountpoint}"/sys | |
zectl unmount "${name}" | |
rmdir "${mountpoint}" | |
#echo "***DONE***" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment