X-Git-Url: https://code.grnet.gr/git/snf-image/blobdiff_plain/8576747bfa59c514902d0095c3ba991e17673595..666b80ee90706c9218e49b63bb148c134c851f6a:/snf-image-helper/tasks/20FilesystemResizeUnmounted.in diff --git a/snf-image-helper/tasks/20FilesystemResizeUnmounted.in b/snf-image-helper/tasks/20FilesystemResizeUnmounted.in index 14550d1..b68a5ec 100644 --- a/snf-image-helper/tasks/20FilesystemResizeUnmounted.in +++ b/snf-image-helper/tasks/20FilesystemResizeUnmounted.in @@ -27,6 +27,8 @@ set -e . "@commondir@/common.sh" +trap task_cleanup EXIT +report_task_start # Check if the task should be prevented from running. check_if_excluded @@ -39,14 +41,24 @@ if [ -z "$SNF_IMAGE_RESIZE_PART" ]; then exit 0 fi +if [ "x$SNF_IMAGE_PROPERTY_DO_SYNC" = "xyes" ]; then + unset EATMYDATA +fi + +if [[ "$SNF_IMAGE_PROPERTY_OSFAMILY" =~ (net)|(open)bsd ]]; then + os=${SNF_IMAGE_PROPERTY_OSFAMILY^^[bsd]} + warn "File sytem resizing currently not supported for ${os^?}" + exit 0 +fi + table=$(get_partition_table "$SNF_IMAGE_DEV") partition=$(get_partition_by_num "$table" "$SNF_IMAGE_RESIZE_PART") id=$(cut -d: -f1 <<< "$partition") ptype=$(cut -d: -f5 <<< "$partition") -if [[ "$ptype" == ext[234] ]]; then - device="${SNF_IMAGE_DEV}${id}" +device="${SNF_IMAGE_DEV}${id}" +if [[ "$ptype" == ext[234] ]]; then state=$($TUNE2FS -l "$device" | grep ^Filesystem\ state: | cut -d: -f2); state=$(echo $state) #trim the value @@ -55,12 +67,13 @@ if [[ "$ptype" == ext[234] ]]; then # system that has been mounted after the last fs check, but since we are # sure the file system is clean it's safe enough to bypass this. if [ "$state" = "clean" ]; then - $RESIZE2FS -f "$device" + $EATMYDATA $RESIZE2FS -f "$device" else log_error "The file system state of partition: \`$device' " \ " is not clean (state = $state)" fi - +elif [[ "$ptype" == "freebsd-ufs" ]]; then + $GROWFS_UFS -y "$device" else warn "Don't know how to resize partition \`$id' with file system \`$ptype'." fi