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 |
|
|
|
# override |
|
|
#BUILDROOT="/mnt/test-buildroot" |
|
|
#BUILD_ARCH=( x86_64 i686 ) |
|
|
#BUILDROOT_PROFILE="R11" |
|
|
#SMAGE_SVN_REPO="svn://cvs.magellan-linux.de/smage/trunk" |
|
|
#MAGE_SVN_REPO="svn://cvs.magellan-linux.de/mage/trunk" |
|
|
|
|
10 |
if [ ! -f ${BUILDROOT}/.stamps/mage_svn-checkout-ok ] |
if [ ! -f ${BUILDROOT}/.stamps/mage_svn-checkout-ok ] |
11 |
then |
then |
12 |
die "svn checkout of mage required. run buildserver-svn first." |
die "svn checkout of mage required. run buildserver-svn first." |
14 |
|
|
15 |
# create buildroot layout |
# create buildroot layout |
16 |
install -d ${BUILDROOT}/.stamps |
install -d ${BUILDROOT}/.stamps |
17 |
install -d ${BUILDROOT}/tmp/mage-tree |
install -d ${BUILDROOT}/ssh |
18 |
for arch in ${BUILD_ARCH[*]} src |
for arch in ${BUILD_ARCH[*]} src |
19 |
do |
do |
20 |
install -d ${BUILDROOT}/${arch} |
install -d ${BUILDROOT}/${arch} |
21 |
|
install -d ${BUILDROOT}/mage-tree/${arch} |
22 |
install -d ${BUILDROOT}/packages/${arch} |
install -d ${BUILDROOT}/packages/${arch} |
23 |
install -d ${BUILDROOT}/meta/${arch} |
install -d ${BUILDROOT}/meta/${arch} |
24 |
|
install -d ${BUILDROOT}/build-info/${arch} |
25 |
done |
done |
26 |
|
|
27 |
# |
# |
34 |
mage-bootstrap \ |
mage-bootstrap \ |
35 |
--root ${BUILDROOT}/${arch} \ |
--root ${BUILDROOT}/${arch} \ |
36 |
--magerc ${BUILDSERVER_CONFIG_DIR}/profiles/${BUILDROOT_PROFILE}/${arch}/mage.rc \ |
--magerc ${BUILDSERVER_CONFIG_DIR}/profiles/${BUILDROOT_PROFILE}/${arch}/mage.rc \ |
37 |
--profile "${BUILDROOT_PROFILE}" \ |
--profile "${MAGE_PROFILE}" \ |
38 |
--basesystem "${BOOTSTRAP_BASESYSTEM}" \ |
--basesystem "${BOOTSTRAP_BASESYSTEM}" \ |
39 |
|| die "'${arch}' bootstrap" |
|| die "'${arch}' bootstrap" |
40 |
touch ${BUILDROOT}/.stamps/${arch}_bootstrap-ok |
touch ${BUILDROOT}/.stamps/${arch}_bootstrap-ok |
60 |
[[ -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 |
61 |
runarch ${arch} env-rebuild || die "${arch} environment rebuild for proxy setup" |
runarch ${arch} env-rebuild || die "${arch} environment rebuild for proxy setup" |
62 |
|
|
63 |
|
# always enable bootstrap mode to supress the startups of any services |
64 |
|
:> ${BUILDROOT}/${arch}/etc/env.d/00mage-buildserver |
65 |
|
echo "MAGE_BOOTSTRAP=\"true\"" >> ${BUILDROOT}/${arch}/etc/env.d/00mage-buildserver |
66 |
|
|
67 |
# install subversion |
# install subversion |
68 |
if [ ! -f ${BUILDROOT}/.stamps/${arch}_subversion-ok ] |
if [ ! -f ${BUILDROOT}/.stamps/${arch}_subversion-ok ] |
69 |
then |
then |
109 |
echo "Warning: ccache already configured for arch '${arch}'" |
echo "Warning: ccache already configured for arch '${arch}'" |
110 |
fi |
fi |
111 |
fi |
fi |
112 |
|
|
113 |
|
# update-ca-certificates |
114 |
|
runarch "${arch}" update-ca-certificates # no die here, cmd may missing |
115 |
|
|
116 |
|
# create list of protected packages |
117 |
|
echo "BUILDSERVER_CACHE_DIR=\"${BUILDSERVER_CACHE_DIR}\"" > ${BUILDROOT}/${arch}/.runrc |
118 |
|
cat >> ${BUILDROOT}/${arch}/.runrc << "EOF" |
119 |
|
if [ -f /etc/rc.d/init.d/functions ] |
120 |
|
then |
121 |
|
source /etc/rc.d/init.d/functions |
122 |
|
else |
123 |
|
die "/etc/rc.d/init.d/functions not found" |
124 |
|
fi |
125 |
|
if [ -f /etc/mage.rc.global ] |
126 |
|
then |
127 |
|
source /etc/mage.rc.global |
128 |
|
else |
129 |
|
die "/etc/mage.rc.global not found" |
130 |
|
fi |
131 |
|
if [ -f /etc/mage.rc ] |
132 |
|
then |
133 |
|
source /etc/mage.rc |
134 |
|
else |
135 |
|
die "/etc/mage.rc not found" |
136 |
|
fi |
137 |
|
|
138 |
|
env-rebuild |
139 |
|
source /etc/profile |
140 |
|
|
141 |
|
echo "generate protected packages info data" |
142 |
|
install -d ${BUILDSERVER_CACHE_DIR}/protected |
143 |
|
|
144 |
|
for mage in $(find ${INSTALLDB} -name \*.${MAGESUFFIX}) |
145 |
|
do |
146 |
|
pkgname=$(basename ${mage} .${MAGESUFFIX}) |
147 |
|
pkgname="${pkgname%-*-*}" |
148 |
|
echo "${pkgname}" > ${BUILDSERVER_CACHE_DIR}/protected/"${pkgname}" |
149 |
|
done |
150 |
|
EOF |
151 |
|
runarch-script ${arch} .runrc || die "${arch} protect-gen failed" |
152 |
|
if [ -f ${BUILDROOT}/${arch}/.runrc ] |
153 |
|
then |
154 |
|
rm ${BUILDROOT}/${arch}/.runrc |
155 |
|
fi |
156 |
|
|
157 |
# cleanup |
# cleanup |
158 |
runarch "${arch}" mage clean || die "${arch} mage clean" |
runarch "${arch}" mage clean || die "${arch} mage clean" |
159 |
|
|