1
0
mirror of https://github.com/ONLYOFFICE/DocSpace-buildtools.git synced 2025-04-18 13:44:02 +03:00

gh-action: Increase disk size for fedora40 (#45)

Co-authored-by: danilapog <danil.titarenko@onlyoffice.com>
Co-committed-by: danilapog <danil.titarenko@onlyoffice.com>
This commit is contained in:
danilapog 2024-10-23 14:09:01 +00:00 committed by Alexey Golubev
parent 58e88304f2
commit 48f5f6bdba

View File

@ -82,6 +82,63 @@ gpgkey=https://download.onlyoffice.com/GPG-KEY-ONLYOFFICE
END
}
#############################################################################################
# Resize Fedora disk. Execute only for 40th version.
# Globals:
# None
# Arguments:
# None
# Outputs:
# None
#############################################################################################
function resize_fedora_disk() {
# Print current disk layout
echo "Current disk layout:"
lsblk
# Install required tools if they are not available
if ! command -v parted &> /dev/null; then
echo "parted not found, installing..."
sudo dnf install -y parted
fi
if ! command -v growpart &> /dev/null; then
echo "growpart not found, installing..."
sudo dnf install -y cloud-utils-growpart
fi
# Fix GPT table to use all available space if needed
echo "Fixing GPT to use all available space..."
echo -e "fix\n" | sudo parted /dev/sda
# Use growpart to resize the partition /dev/sda2
echo "Resizing partition /dev/sda2 using growpart..."
sudo growpart /dev/sda 2
# Check the filesystem type before resizing
FSTYPE=$(df -T | grep '/$' | awk '{print $2}')
# Resize the filesystem based on the filesystem type (xfs or ext4)
if [ "$FSTYPE" == "xfs" ]; then
echo "Resizing XFS filesystem on /dev/sda2..."
sudo xfs_growfs /
elif [ "$FSTYPE" == "ext4" ]; then
echo "Resizing ext4 filesystem on /dev/sda2..."
sudo resize2fs /dev/sda2
else
echo "Unsupported filesystem type: $FSTYPE"
exit 1
fi
# Print the new disk layout
echo "Disk layout after resizing:"
lsblk
# Verify new available space
echo "Filesystem after resizing:"
df -h /
}
#############################################################################################
# Prepare vagrant boxes like: set hostname/remove postfix for DEB distributions
# Globals:
@ -107,6 +164,7 @@ function prepare_vm() {
fedora)
[[ "${TEST_REPO_ENABLE}" == 'true' ]] && add-repo-rpm
[ $(hostnamectl | grep "Operating System" | awk '{print $5}') == "40" ] && resize_fedora_disk
;;
centos)