aboutsummaryrefslogtreecommitdiff
path: root/release/tools/gce-package.sh
blob: 5d8ec331130334f61a923695836f0153f370db38 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh
#
# $FreeBSD$
#

# Script to handle packaging cloud images for GCE.
#
# XXX:
# This script only exists to help in automating image creation,
# and reimplementing this is intended (in other words, this is
# temporary).

usage() {
	echo "Usage:"
	echo "$(basename ${0}) -D <destdir> -I <input_file> -S <src_tree>"
	exit 1
}

main() {
	while getopts "D:I:W:" opt; do
		case ${opt} in
			D)
				DESTDIR="${OPTARG}"
				;;
			I)
				INFILE="${OPTARG}"
				;;
			S)
				WORLDDIR="${OPTARG}"
				;;
			*)
				usage
				;;
		esac
	done
	shift $(( ${OPTIND} - 1 ))

	if [ -z "${DESTDIR}" -o -z "${INFILE}" -o -z "${WORLDDIR}" ]; then
		usage
	fi

	OUTFILE="$(make -C ${WORLDDIR}/release -V OSRELEASE).tar.gz"

	cd ${DESTDIR} && tar --format=gnutar -zcf ${OUTFILE} ${INFILE}
}

main "$@"