Statistics
| Branch: | Tag: | Revision:

root / snf-image-helper / tasks / 40FilesystemResizeMounted.in @ de7269cd

History | View | Annotate | Download (991 Bytes)

1
#! /bin/bash
2

    
3
### BEGIN TASK INFO
4
# Provides:		FilesystemResizeMounted
5
# RunBefore:            UmountImage
6
# RunAfter:		MountImage
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 [ ! -d "$SNF_IMAGE_TARGET" ]; then
14
    log_error "Target directory \`$SNF_IMAGE_TARGET' is missing"
15
fi
16

    
17
if [ "$SNF_IMAGE_PROPERTY_OSFAMILY" != "windows" ]; then
18
    exit 0
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" = "ntfs" ]; then
26
    # Write a diskpart script to %SystemDrive%\Windows\SnfScripts. Sysprep will
27
    # try to execute this script during the specialize pass.
28
    mkdir -p "$SNF_IMAGE_TARGET/Windows/SnfScripts"
29
    cat > "$SNF_IMAGE_TARGET/Windows/SnfScripts/ExtendFilesystem" <<EOF
30
select disk 0
31
select volume $id
32
extend filesystem
33
exit
34
EOF
35
fi
36

    
37
exit 0
38

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