Statistics
| Branch: | Tag: | Revision:

root / snf-image-helper / tasks / 50FilesystemResizeMounted.in @ 10bf026d

History | View | Annotate | Download (1.8 kB)

1 0a35a4ab Nikos Skalkotos
#! /bin/bash
2 c349d1b3 Nikos Skalkotos
3 7e5d635b Nikos Skalkotos
# Copyright (C) 2011 GRNET S.A. 
4 7e5d635b Nikos Skalkotos
#
5 7e5d635b Nikos Skalkotos
# This program is free software; you can redistribute it and/or modify
6 7e5d635b Nikos Skalkotos
# it under the terms of the GNU General Public License as published by
7 7e5d635b Nikos Skalkotos
# the Free Software Foundation; either version 2 of the License, or
8 7e5d635b Nikos Skalkotos
# (at your option) any later version.
9 7e5d635b Nikos Skalkotos
#
10 7e5d635b Nikos Skalkotos
# This program is distributed in the hope that it will be useful, but
11 7e5d635b Nikos Skalkotos
# WITHOUT ANY WARRANTY; without even the implied warranty of
12 7e5d635b Nikos Skalkotos
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 7e5d635b Nikos Skalkotos
# General Public License for more details.
14 7e5d635b Nikos Skalkotos
#
15 7e5d635b Nikos Skalkotos
# You should have received a copy of the GNU General Public License
16 7e5d635b Nikos Skalkotos
# along with this program; if not, write to the Free Software
17 7e5d635b Nikos Skalkotos
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 7e5d635b Nikos Skalkotos
# 02110-1301, USA.
19 7e5d635b Nikos Skalkotos
20 c349d1b3 Nikos Skalkotos
### BEGIN TASK INFO
21 42f09a19 Nikos Skalkotos
# Provides:		FilesystemResizeMounted
22 c349d1b3 Nikos Skalkotos
# RunBefore:            UmountImage
23 ce222bd6 Nikos Skalkotos
# RunAfter:		InstallUnattend
24 c349d1b3 Nikos Skalkotos
# Short-Description:	Resize filesystem to use all the available space
25 6a95db10 Vangelis Koukis
### END TASK INFO
26 c349d1b3 Nikos Skalkotos
27 c349d1b3 Nikos Skalkotos
set -e
28 bad5ca1f Nikos Skalkotos
. "@commondir@/common.sh"
29 c349d1b3 Nikos Skalkotos
30 2a0c492d Nikos Skalkotos
# Check if the task should be prevented from running.
31 2a0c492d Nikos Skalkotos
check_if_excluded
32 2a0c492d Nikos Skalkotos
33 c349d1b3 Nikos Skalkotos
if [ ! -d "$SNF_IMAGE_TARGET" ]; then
34 8704ee47 Nikos Skalkotos
    log_error "Target directory \`$SNF_IMAGE_TARGET' is missing"
35 c349d1b3 Nikos Skalkotos
fi
36 c349d1b3 Nikos Skalkotos
37 de7269cd Nikos Skalkotos
if [ "$SNF_IMAGE_PROPERTY_OSFAMILY" != "windows" ]; then
38 de7269cd Nikos Skalkotos
    exit 0
39 de7269cd Nikos Skalkotos
fi
40 de7269cd Nikos Skalkotos
41 2f43ca2e Nikos Skalkotos
table=$(get_partition_table "$SNF_IMAGE_DEV")
42 8576747b Nikos Skalkotos
partition=$(get_partition_by_num "$table" "$SNF_IMAGE_RESIZE_PART")
43 01da0f7d Nikos Skalkotos
id=$(cut -d: -f1 <<< "$partition")
44 01da0f7d Nikos Skalkotos
ptype=$(cut -d: -f5 <<< "$partition")
45 42f09a19 Nikos Skalkotos
46 42f09a19 Nikos Skalkotos
if [ "$ptype" = "ntfs" ]; then
47 5d3735b5 Nikos Skalkotos
    # Write a diskpart script to %SystemDrive%\Windows\SnfScripts. Sysprep will
48 5d3735b5 Nikos Skalkotos
    # try to execute this script during the specialize pass.
49 5d3735b5 Nikos Skalkotos
    cat > "$SNF_IMAGE_TARGET/Windows/SnfScripts/ExtendFilesystem" <<EOF
50 c349d1b3 Nikos Skalkotos
select disk 0
51 42f09a19 Nikos Skalkotos
select volume $id
52 c349d1b3 Nikos Skalkotos
extend filesystem
53 c349d1b3 Nikos Skalkotos
exit
54 c349d1b3 Nikos Skalkotos
EOF
55 5d3735b5 Nikos Skalkotos
fi
56 c349d1b3 Nikos Skalkotos
57 c349d1b3 Nikos Skalkotos
exit 0
58 c349d1b3 Nikos Skalkotos
59 c349d1b3 Nikos Skalkotos
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :