forked from RobertCNelson/omap-image-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase_image.sh
executable file
·208 lines (163 loc) · 4.6 KB
/
base_image.sh
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
#!/bin/sh -e
#
# Copyright (c) 2009-2013 Robert Nelson <robertcnelson@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
SYST=$(uname -n)
time=$(date +%Y-%m-%d)
DIR=$PWD
tempdir=$(mktemp -d)
image_type="minimal"
minimal_armel () {
rm -f "${DIR}/.project" || true
#Actual Releases will use version numbers..
case "${release}" in
wheezy)
#http://www.debian.org/releases/wheezy/
export_filename="${distro}-7.1-${image_type}-${dpkg_arch}-${time}"
;;
raring)
export_filename="${distro}-13.04-${image_type}-${dpkg_arch}-${time}"
;;
*)
export_filename="${distro}-${release}-${image_type}-${dpkg_arch}-${time}"
;;
esac
tempdir=$(mktemp -d)
cat > ${DIR}/.project <<-__EOF__
tempdir="${tempdir}"
export_filename="${export_filename}"
distro="${distro}"
release="${release}"
dpkg_arch="${dpkg_arch}"
deb_mirror="${deb_mirror}"
deb_components="${deb_components}"
apt_proxy="${apt_proxy}"
base_pkg_list="${base_pkg_list}"
image_hostname="${image_hostname}"
user_name="${user_name}"
full_name="${full_name}"
password="${password}"
chroot_ENABLE_DEB_SRC="${chroot_ENABLE_DEB_SRC}"
chroot_KERNEL_HTTP_DIR="${chroot_KERNEL_HTTP_DIR}"
__EOF__
cat ${DIR}/.project
/bin/sh -e "${DIR}/RootStock-NG.sh" || { exit 1 ; }
}
compression () {
echo "Starting Compression"
cd ${DIR}/deploy/
tar cvf ${export_filename}.tar ./${export_filename}
if [ -f ${DIR}/release ] ; then
if [ "x${SYST}" = "x${RELEASE_HOST}" ] ; then
if [ -d /mnt/farm/testing/pending/ ] ; then
cp -v ${export_filename}.tar /mnt/farm/testing/pending/${export_filename}.tar
cp -v arm*.tar /mnt/farm/images/
if [ ! -f /mnt/farm/testing/pending/compress.txt ] ; then
echo "xz -z -7 -v ${export_filename}.tar" > /mnt/farm/testing/pending/compress.txt
else
echo "xz -z -7 -v ${export_filename}.tar" >> /mnt/farm/testing/pending/compress.txt
fi
fi
fi
fi
cd ${DIR}/
}
is_ubuntu () {
image_hostname="arm"
distro="ubuntu"
user_name="ubuntu"
password="temppwd"
full_name="Demo User"
deb_mirror="ports.ubuntu.com/ubuntu-ports/"
deb_components="main universe multiverse"
. ${DIR}/var/pkg_list.sh
base_pkg_list="${base_pkgs} ${extra_pkgs}"
}
is_debian () {
image_hostname="arm"
distro="debian"
user_name="debian"
password="temppwd"
full_name="Demo User"
deb_mirror="ftp.us.debian.org/debian/"
deb_components="main contrib non-free"
. ${DIR}/var/pkg_list.sh
base_pkg_list="${base_pkgs} ${extra_pkgs}"
}
#13.04
raring_release () {
extra_pkgs="linux-firmware devmem2 python-software-properties"
is_ubuntu
release="raring"
minimal_armel
compression
}
#13.10
saucy_release () {
extra_pkgs="linux-firmware devmem2 python-software-properties"
is_ubuntu
release="saucy"
minimal_armel
compression
}
wheezy_release () {
extra_pkgs="atmel-firmware firmware-ralink libertas-firmware zd1211-firmware"
is_debian
release="wheezy"
minimal_armel
compression
}
jessie_release () {
extra_pkgs="atmel-firmware firmware-ralink libertas-firmware zd1211-firmware"
is_debian
release="jessie"
minimal_armel
compression
}
sid_release () {
extra_pkgs="atmel-firmware firmware-ralink libertas-firmware zd1211-firmware"
is_debian
release="sid"
minimal_armel
compression
}
. ${DIR}/var/check_host.sh
if [ ! "${apt_proxy}" ] ; then
apt_proxy=""
fi
if [ ! "${mirror}" ] ; then
mirror="http://rcn-ee.net/deb"
fi
if [ -f ${DIR}/rcn-ee.host ] ; then
. ${DIR}/host/rcn-ee-host.sh
fi
mkdir -p ${DIR}/deploy/
if [ -f ${DIR}/release ] ; then
chroot_ENABLE_DEB_SRC="enable"
fi
dpkg_arch="armel"
wheezy_release
#jessie_release
dpkg_arch="armhf"
wheezy_release
#jessie_release
raring_release
#saucy_release
echo "done"