Statistics
| Branch: | Tag: | Revision:

root / snf-image-helper / tasks / 20FilesystemResizeUnmounted.in @ 42f09a19

History | View | Annotate | Download (751 Bytes)

1
#! /bin/bash
2

    
3
### BEGIN TASK INFO
4
# Provides:		FilesystemResizeUnmounted
5
# RunBefore:		MountImage
6
# RunAfter:             FixPartitionTable
7
# Short-Description:	Resize filesystem to use all the available space
8
### END TASK INFO
9

    
10
set -e
11
. "@commondir@/common.sh"
12

    
13
if [ ! -b "$SNF_IMAGE_DEV" ]; then
14
    log_error "Device file:\`${SNF_IMAGE_DEV}' is not a block device"
15
fi
16

    
17
if [ -z "$SNF_IMAGE_TYPE" ]; then
18
    log_error "Image type does not exist"
19
fi
20

    
21
last_partition=$(get_last_partition "$SNF_IMAGE_DEV")
22
id=$(echo "$last_partition" | cut -d: -f1)
23
ptype=$(echo "$last_partition" | cut -d: -f5)
24

    
25
if [[ "$ptype" =~ ext[234] ]]; then
26
    device="$SNF_IMAGE_DEV""$id"
27
    "$RESIZE2FS" "$device"
28
fi
29

    
30
exit 0
31

    
32
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :