cloud-guest-utils: add core-service for resizing rootfs

This commit is contained in:
classabbyamp 2024-07-23 22:10:30 -04:00 committed by classabbyamp
parent a21ca9b3ae
commit cbc1c7b57f
4 changed files with 34 additions and 1 deletions

View File

@ -0,0 +1,22 @@
#!/bin/sh
. /etc/default/growpart
if [ -n "$ENABLE_ROOT_GROWPART" ]; then
msg "Growing root partition"
rpart="$(findmnt -r -o SOURCE -v -n /)"
rnum="$(cat /sys/class/block/"${rpart##*/}"/partition)"
rdisk="${rpart%%"$rnum"}"
rdisk="${rdisk%p}"
rtype="$(blkid -o value -s TYPE "${rpart}")"
/usr/bin/growpart "$rdisk" "$rnum"
case "$rtype" in
ext*) resize2fs "$rpart" ;;
f2fs) resize.f2fs "$rpart" ;;
xfs) xfs_growfs -d "$rpart" ;;
*) msg_warn "Couldn't resize partition, partition type $rtype not supported" ;;
esac
fi

View File

@ -0,0 +1,2 @@
This package provides a core service that can grow the root partition on boot.
To enable it, uncomment the ENABLE_ROOT_GROWPART line in /etc/default/growpart.

View File

@ -0,0 +1,3 @@
# uncomment to enable growing the root partition on boot using growpart(1)
# currently only ext*, f2fs, and xfs are supported
#ENABLE_ROOT_GROWPART=yes

View File

@ -1,7 +1,7 @@
# Template file for 'cloud-guest-utils'
pkgname=cloud-guest-utils
version=0.33
revision=1
revision=2
build_style=gnu-makefile
depends="e2fsprogs util-linux gptfdisk"
short_desc="Useful programs inside of a VM Guest"
@ -12,6 +12,12 @@ changelog="https://github.com/canonical/cloud-utils/raw/main/ChangeLog"
distfiles="https://github.com/canonical/cloud-utils/archive/refs/tags/$version.tar.gz"
checksum=338770d637788466aacfcbcec17a8d0046f92a13cc3b25fce8fceadb02a7339f
post_install() {
vdoc "${FILESDIR}"/README.voidlinux
vinstall "${FILESDIR}"/10-resize-root.sh 644 /etc/runit/core-services
vinstall "${FILESDIR}"/growpart.default 644 /etc/default growpart
}
cloud-utils-ec2metadata_package() {
short_desc="Script for retrieving AWS-EC2 Metadata"
depends="python3"