summaryrefslogtreecommitdiffstats
path: root/bin/d-i_manual.sh
blob: ceeabfefb342b0cdc29a5e72ea1d47af1a19608d (plain)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash

# Copyright 2012 Holger Levsen <holger@layer-acht.org>
# released under the GPLv=2

#
# default settings
#
set -x
set -e
export LC_ALL=C
export MIRROR=http://ftp.de.debian.org/debian
export http_proxy="http://localhost:3128"
export

init_workspace() {
	#
	# clean
	#
	rm -fv *.deb *.dsc *_*.build *_*.changes *_*.tar.gz

	#
	# svn checkout and update is done by jenkins job
	#
	svn status
}

pdebuild_package() {
	#
	# prepare build
	#
	if [ -f /var/cache/pbuilder/base.tgz ] ; then
		sudo pbuilder --create
	else
		sudo pbuilder --update
	fi

	#
	# build
	#
	cd manual
	pdebuild --use-pdebuild-internal
}

build_language() {
	FORMAT=$2
	# if $FORMAT is a directoy and it's string length greater or equal then 3 (so not "." or "..")
	if [ -d "$FORMAT" ] && [ ${#FORMAT} -ge 3 ]; then
		rm -rf $FORMAT
	fi
	mkdir $FORMAT
	cd manual/build
	ARCHS=$(ls arch-options)
	for ARCH in $ARCHS ; do 
		make languages=$1 architectures=$ARCH destination=../../$FORMAT/ formats=$FORMAT
	done
}

init_workspace
#
# if $1 is not given, build the whole manual,
# else just the language $1 in format $2
#
if [ "$1" = "" ] ; then
	pdebuild_package
else
	if [ "$2" = "" ] ; then
		echo "Error: need format too."
		exit 1
	fi
	build_language $1 $2
fi