The cirros image was rebuilt against the 3.13.0-83 kernel, drivers e1000e, igbvf...
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / src / sbin / resize-filesystem
1 #!/bin/sh
2 . ${CIRROS_LIB:=/lib/cirros/shlib_cirros} ||
3         { echo "failed to read ${CIRROS_LIB}" 1>&2; exit 1; }
4
5 Usage() {
6         cat <<EOF
7 ${0##*/} device [log] [summary]
8   resize the device with log sent to 'log'.
9
10   if log is provided, stderr and stdout are redirected to that file
11   if summary is provided, a summary (success/fail) will be written there
12 EOF
13 }
14
15 dev=${1:-/dev/root}
16 log="$2"
17 sumfile="$3"
18
19 [ $# -eq 1 -o $# -eq 2 -o $# -eq 3 ] ||
20         { Usage 1>&2; exit 1; }
21 [ "$1" = "-h" -o "$1" = "--help" ] && { Usage; exit 0; }
22
23 if [ -n "$log" -o "$log" = "-" ]; then
24         time_call resize2fs "$dev" >"$log" 2>&1
25 else
26         time_call resize2fs "$dev"
27 fi
28 ret=$?
29 delta=$_RET_TIME
30 [ $ret -eq 0 ] &&
31         summary="$dev resized successfully [took ${delta}s]" ||
32         summary="$dev resize failed ($ret) [took ${delta}s]"
33
34 if [ "$log" = "-" ]; then
35         echo "$summary"
36 elif [ -n "$log" ]; then
37         echo "$summary" >> "$log"
38 fi
39 if [ -n "$sumfile" ]; then
40         [ "$sumfile" = "-" ] && echo "$summary" || echo "$summary" >> "$sumfile"
41 fi
42
43 exit $ret
44
45 # vi: ts=4 noexpandtab