From 1b43c5567972471fbf6e09422ae3f729ef0515a1 Mon Sep 17 00:00:00 2001 From: Pratham Patel Date: Wed, 3 Jan 2024 12:28:41 +0530 Subject: [PATCH] disable and remove expand-rootfs service if it exits cleanly --- scripts/expand-rootfs.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/expand-rootfs.sh b/scripts/expand-rootfs.sh index f244bd9..a1bc2cb 100755 --- a/scripts/expand-rootfs.sh +++ b/scripts/expand-rootfs.sh @@ -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