~tom-gall/live-build/integrate-linaro-media-create

1812 by Tom Gall
integrate support of linaro-media-create
1
#!/bin/sh
2
3
## live-build(7) - System Build Scripts
4
## Copyright (C) 2006-2011 Daniel Baumann <daniel@debian.org>
5
##
6
## live-build comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
7
## This is free software, and you are welcome to redistribute it
8
## under certain conditions; see COPYING for details.
9
10
set -x
11
set -e
12
13
# Including common functions
14
. "${LB_BASE:-/usr/share/live/build}"/scripts/build.sh
15
16
# Setting static variables
17
DESCRIPTION="$(Echo 'build binary image with Linaro Media Create')"
18
HELP=""
19
USAGE="${PROGRAM} [--force]"
20
21
Arguments "${@}"
22
23
# Reading configuration files
24
Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
25
Set_defaults
26
27
28
Echo_message "Begin building binary image with linaro-media-create"
29
30
# Requiring stage file
31
Require_stagefile .stage/config .stage/bootstrap
32
33
if [ "${LB_LMC_BOARD}" ]
34
then
35
36
	# Checking stage file
37
	Check_stagefile .stage/binary_lmc
38
39
	# Checking lock file
40
	Check_lockfile .lock
41
42
	# Creating lock file
43
	Create_lockfile .lock
44
45
	# Restoring cache
46
	Restore_cache cache/packages_binary
47
48
	# Installing depends
49
	Install_package
50
51
	LMC_OPTIONS=" --dev $LB_LMC_BOARD "
52
53
	LMC_OPTIONS="$LMC_OPTIONS --binary binary-tar.tar.gz "
54
55
	if [ -f ${LB_LMC_HWPACK} ] 
56
	then
57
		LMC_OPTIONS="$LMC_OPTIONS --hwpack $LB_LMC_HWPACK "
58
	else
59
		Echo_message "Error: no hwpack specified"
60
	fi
61
62
	# Remove old iso image
63
	if [ -n "${LB_LMC_IMAGE_FILE}" ]
64
	then
65
		if [ -f ${LB_LMC_IMAGE_FILE} ]
66
		then
67
			rm -f ${LB_LMC_IMAGE_FILE}
68
		fi
69
70
		LMC_OPTIONS="$LMC_OPTIONS --image_file $LB_LMC_IMAGE_FILE "
71
72
		Echo_message "linaro-media-create $LMC_OPTIONS"
73
74
		linaro-media-create $LMC_OPTIONS
75
76
	elif [ -n "${LB_LMC_MMC}" ]
77
	then
78
		LMC_OPTIONS="$LMC_OPTIONS --mmc $LB_LMC_MMC "
79
80
		Echo_message "linaro-media-create $LMC_OPTIONS"
81
82
		linaro-media-create $LMC_OPTIONS
83
	
84
	else
85
		Echo_message "Error: Must specify image_file or MMC"
86
	fi
87
88
89
# Saving cache
90
Save_cache cache/packages_binary
91
92
# Removing depends
93
Remove_package
94
95
# board != none
96
fi 
97
# Creating stage file
98
Create_stagefile .stage/binary_lmc
99
set +x