Compare commits
3 Commits
3539a131d8
...
358b27f061
Author | SHA1 | Date | |
---|---|---|---|
358b27f061 | |||
1b43c55679 | |||
be186d5975 |
@ -4,7 +4,9 @@ set -x
|
||||
# The script that expands root partition
|
||||
[ -d /usr/local/bin ] || mkdir --verbose /usr/local/bin
|
||||
curl 'https://git.resf.org/thefossguy/sbc-images/raw/branch/rocky-generic/scripts/expand-rootfs.sh' --output /usr/local/bin/expand-rootfs.sh || exit 1
|
||||
curl 'https://git.resf.org/thefossguy/sbc-images/raw/branch/rocky-generic/scripts/expand-rootfs.service' --output /etc/systemd/system/expand-rootfs.service || exit 1
|
||||
[ -f /usr/local/bin/expand-rootfs.sh ] && \
|
||||
chmod --verbose +x /usr/local/bin/expand-rootfs.sh
|
||||
systemctl enable expand-rootfs.service
|
||||
|
||||
%end
|
||||
|
10
scripts/expand-rootfs.service
Normal file
10
scripts/expand-rootfs.service
Normal file
@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=Expand root filesystem
|
||||
|
||||
[Service]
|
||||
ExecStart=$(command -v bash) /usr/local/bin/expand-rootfs.sh
|
||||
Type=oneshot
|
||||
User=root
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
@ -18,5 +18,12 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
growpart "${PARENT_ROOT_DEVICE}" "${ROOT_PARTITION}"
|
||||
resize2fs "${ROOT_DEVICE}"
|
||||
growpart "${PARENT_ROOT_DEVICE}" "${ROOT_PARTITION}" && GP_OK='true'
|
||||
resize2fs "${ROOT_DEVICE}" && RESIZE_OK='true'
|
||||
|
||||
if [[ "${GP_OK}" == 'true' && "${RESIZE_OK}" == 'true' ]]; then
|
||||
systemctl disable expand-rootfs.service
|
||||
rm /etc/systemd/system/expand-rootfs.service
|
||||
systemctl daemon-reload
|
||||
rm /usr/local/bin/expand-rootfs.sh
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user