2 |
|
|
3 |
# get configuration |
# get configuration |
4 |
BUILDSERVER_CONFIG_DIR="/etc/mage-buildserver" |
BUILDSERVER_CONFIG_DIR="/etc/mage-buildserver" |
5 |
|
BUILDSERVER_CACHE_DIR="/var/cache/mage-buildserver" |
6 |
source ${BUILDSERVER_CONFIG_DIR}/buildserver.conf |
source ${BUILDSERVER_CONFIG_DIR}/buildserver.conf |
7 |
|
|
8 |
source ${BUILDSERVER_LIB_DIR}/buildserver-functions.sh |
source ${BUILDSERVER_LIB_DIR}/buildserver-functions.sh |
9 |
|
|
10 |
# override |
# fallback |
11 |
#BUILDROOT="/mnt/test-buildroot" |
if [[ -z ${MAGE_PROFILE} ]] |
12 |
#BUILD_ARCH=( x86_64 i686 ) |
then |
13 |
#BUILDROOT_PROFILE="R11" |
echo "Warning: using '${BUILDROOT_PROFILE}' as MAGE_PROFILE. You should define MAGE_PROFILE in the profile.conf." |
14 |
#SMAGE_SVN_REPO="svn://cvs.magellan-linux.de/smage/trunk" |
MAGE_PROFILE="${BUILDROOT_PROFILE}" |
15 |
#MAGE_SVN_REPO="svn://cvs.magellan-linux.de/mage/trunk" |
fi |
16 |
|
|
17 |
if [ ! -f ${BUILDROOT}/.stamps/mage_svn-checkout-ok ] |
if [ ! -f ${BUILDROOT}/.stamps/mage_svn-checkout-ok ] |
18 |
then |
then |
21 |
|
|
22 |
# create buildroot layout |
# create buildroot layout |
23 |
install -d ${BUILDROOT}/.stamps |
install -d ${BUILDROOT}/.stamps |
24 |
install -d ${BUILDROOT}/tmp/mage-tree |
install -d ${BUILDROOT}/ssh |
25 |
for arch in ${BUILD_ARCH[*]} src |
for arch in ${BUILD_ARCH[*]} src |
26 |
do |
do |
27 |
install -d ${BUILDROOT}/${arch} |
install -d ${BUILDROOT}/${arch} |
28 |
|
install -d ${BUILDROOT}/mage-tree/${arch} |
29 |
install -d ${BUILDROOT}/packages/${arch} |
install -d ${BUILDROOT}/packages/${arch} |
30 |
install -d ${BUILDROOT}/meta/${arch} |
install -d ${BUILDROOT}/meta/${arch} |
31 |
|
install -d ${BUILDROOT}/build-info/${arch} |
32 |
done |
done |
33 |
|
|
34 |
# |
# |
41 |
mage-bootstrap \ |
mage-bootstrap \ |
42 |
--root ${BUILDROOT}/${arch} \ |
--root ${BUILDROOT}/${arch} \ |
43 |
--magerc ${BUILDSERVER_CONFIG_DIR}/profiles/${BUILDROOT_PROFILE}/${arch}/mage.rc \ |
--magerc ${BUILDSERVER_CONFIG_DIR}/profiles/${BUILDROOT_PROFILE}/${arch}/mage.rc \ |
44 |
--profile "${BUILDROOT_PROFILE}" \ |
--profile "${MAGE_PROFILE}" \ |
45 |
--basesystem "${BOOTSTRAP_BASESYSTEM}" \ |
--basesystem "${BOOTSTRAP_BASESYSTEM}" \ |
46 |
|| die "'${arch}' bootstrap" |
|| die "'${arch}' bootstrap" |
47 |
touch ${BUILDROOT}/.stamps/${arch}_bootstrap-ok |
touch ${BUILDROOT}/.stamps/${arch}_bootstrap-ok |
67 |
[[ -n ${no_proxy} ]] && echo "no_proxy=\"${no_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy |
[[ -n ${no_proxy} ]] && echo "no_proxy=\"${no_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy |
68 |
runarch ${arch} env-rebuild || die "${arch} environment rebuild for proxy setup" |
runarch ${arch} env-rebuild || die "${arch} environment rebuild for proxy setup" |
69 |
|
|
70 |
|
# always enable bootstrap mode to supress the startups of any services |
71 |
|
:> ${BUILDROOT}/${arch}/etc/env.d/00mage-buildserver |
72 |
|
echo "MAGE_BOOTSTRAP=\"true\"" >> ${BUILDROOT}/${arch}/etc/env.d/00mage-buildserver |
73 |
|
|
74 |
# install subversion |
# install subversion |
75 |
if [ ! -f ${BUILDROOT}/.stamps/${arch}_subversion-ok ] |
if [ ! -f ${BUILDROOT}/.stamps/${arch}_subversion-ok ] |
76 |
then |
then |
120 |
# update-ca-certificates |
# update-ca-certificates |
121 |
runarch "${arch}" update-ca-certificates # no die here, cmd may missing |
runarch "${arch}" update-ca-certificates # no die here, cmd may missing |
122 |
|
|
123 |
|
# create list of protected packages |
124 |
|
echo "BUILDSERVER_CACHE_DIR=\"${BUILDSERVER_CACHE_DIR}\"" > ${BUILDROOT}/${arch}/.runrc |
125 |
|
cat >> ${BUILDROOT}/${arch}/.runrc << "EOF" |
126 |
|
if [ -f /etc/rc.d/init.d/functions ] |
127 |
|
then |
128 |
|
source /etc/rc.d/init.d/functions |
129 |
|
else |
130 |
|
die "/etc/rc.d/init.d/functions not found" |
131 |
|
fi |
132 |
|
if [ -f /etc/mage.rc.global ] |
133 |
|
then |
134 |
|
source /etc/mage.rc.global |
135 |
|
else |
136 |
|
die "/etc/mage.rc.global not found" |
137 |
|
fi |
138 |
|
if [ -f /etc/mage.rc ] |
139 |
|
then |
140 |
|
source /etc/mage.rc |
141 |
|
else |
142 |
|
die "/etc/mage.rc not found" |
143 |
|
fi |
144 |
|
|
145 |
|
env-rebuild |
146 |
|
source /etc/profile |
147 |
|
|
148 |
|
echo "generate protected packages info data" |
149 |
|
install -d ${BUILDSERVER_CACHE_DIR}/protected |
150 |
|
|
151 |
|
for mage in $(find ${INSTALLDB} -name \*.${MAGESUFFIX}) |
152 |
|
do |
153 |
|
pkgname=$(basename ${mage} .${MAGESUFFIX}) |
154 |
|
pkgname="${pkgname%-*-*}" |
155 |
|
echo "${pkgname}" > ${BUILDSERVER_CACHE_DIR}/protected/"${pkgname}" |
156 |
|
done |
157 |
|
EOF |
158 |
|
runarch-script ${arch} .runrc || die "${arch} protect-gen failed" |
159 |
|
if [ -f ${BUILDROOT}/${arch}/.runrc ] |
160 |
|
then |
161 |
|
rm ${BUILDROOT}/${arch}/.runrc |
162 |
|
fi |
163 |
|
|
164 |
# cleanup |
# cleanup |
165 |
runarch "${arch}" mage clean || die "${arch} mage clean" |
runarch "${arch}" mage clean || die "${arch} mage clean" |
166 |
|
|