50FilesystemResizeMounted.in 944 Bytes
Newer Older
1
#! /bin/bash
Nikos Skalkotos's avatar
Nikos Skalkotos committed
2
3

### BEGIN TASK INFO
4
# Provides:		FilesystemResizeMounted
Nikos Skalkotos's avatar
Nikos Skalkotos committed
5
# RunBefore:            UmountImage
6
# RunAfter:		InstallUnattend
Nikos Skalkotos's avatar
Nikos Skalkotos committed
7
# Short-Description:	Resize filesystem to use all the available space
8
### END TASK INFO
Nikos Skalkotos's avatar
Nikos Skalkotos committed
9
10

set -e
11
. "@commondir@/common.sh"
Nikos Skalkotos's avatar
Nikos Skalkotos committed
12
13

if [ ! -d "$SNF_IMAGE_TARGET" ]; then
14
    log_error "Target directory \`$SNF_IMAGE_TARGET' is missing"
Nikos Skalkotos's avatar
Nikos Skalkotos committed
15
16
fi

17
18
19
20
if [ "$SNF_IMAGE_PROPERTY_OSFAMILY" != "windows" ]; then
    exit 0
fi

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

if [ "$ptype" = "ntfs" ]; then
26
27
28
    # Write a diskpart script to %SystemDrive%\Windows\SnfScripts. Sysprep will
    # try to execute this script during the specialize pass.
    cat > "$SNF_IMAGE_TARGET/Windows/SnfScripts/ExtendFilesystem" <<EOF
Nikos Skalkotos's avatar
Nikos Skalkotos committed
29
select disk 0
30
select volume $id
Nikos Skalkotos's avatar
Nikos Skalkotos committed
31
32
33
extend filesystem
exit
EOF
34
fi
Nikos Skalkotos's avatar
Nikos Skalkotos committed
35
36
37
38

exit 0

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