packer/scripts/cloud.sh: use packaged growpart and core-service

This commit is contained in:
classabbyamp 2024-07-23 21:23:42 -04:00 committed by classabbyamp
parent 9e31c2f262
commit 54b983f8e3
1 changed files with 2 additions and 12 deletions

View File

@ -5,20 +5,10 @@ echo "Defaults:void !requiretty" >> /etc/sudoers.d/99-void
chmod 0440 /etc/sudoers.d/99-void
mv /etc/sudoers.d/{,10-}wheel
xbps-fetch -o /usr/bin/growpart https://raw.githubusercontent.com/canonical/cloud-utils/ubuntu/0.31-22-g37d4e32a-0ubuntu1/bin/growpart
chmod +x /usr/bin/growpart
xbps-install -Sy util-linux coreutils sed shinit
xbps-install -Sy util-linux coreutils sed shinit cloud-guest-utils
ln -s /etc/sv/shinit /var/service/
cat <<'EOF' > /etc/runit/core-services/10-resize-root.sh
#!/bin/sh
rpart=$(findmnt -r -o SOURCE -v -n /)
rnum=$(cat /sys/class/block/$(basename $rpart)/partition)
/usr/bin/growpart ${rpart%%$rnum} $rnum
resize2fs $rpart
EOF
sed -i -e 's/#ENABLE/ENABLE/' /etc/default/growpart
passwd -dl void
passwd -dl root