Statistics
| Branch: | Tag: | Revision:

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

History | View | Annotate | Download (940 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
last_partition=$(get_last_partition "$SNF_IMAGE_DEV")
18
id=$(echo "$last_partition" | cut -d: -f1)
19
ptype=$(echo "$last_partition" | cut -d: -f5)
20

    
21
if [ "$ptype" = "ntfs" ]; then
22
    # Write a diskpart script to %SystemDrive%\Windows\SnfScripts. Sysprep will
23
    # try to execute this script during the specialize pass.
24
    mkdir -p "$SNF_IMAGE_TARGET/Windows/SnfScripts"
25
    cat > "$SNF_IMAGE_TARGET/Windows/SnfScripts/ExtendFilesystem" <<EOF
26
select disk 0
27
select volume $id
28
extend filesystem
29
exit
30
EOF
31
fi
32

    
33
cleanup
34
trap - EXIT
35

    
36
exit 0
37

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