Contents of /trunk/mage-buildserver/buildserver-prepare.sh
Parent Directory | Revision Log
Revision 2749 -
(show annotations)
(download)
(as text)
Wed Aug 13 14:28:18 2014 UTC (10 years, 1 month ago) by niro
File MIME type: application/x-sh
File size: 5179 byte(s)
Wed Aug 13 14:28:18 2014 UTC (10 years, 1 month ago) by niro
File MIME type: application/x-sh
File size: 5179 byte(s)
-fixed path issues with profile, use BUILDSERVER_CACHE_DIR for pretected packages, create ssh/build-info mappings and always export MAGE_BOOTSTRAP to never start
1 | #!/bin/bash |
2 | |
3 | # get configuration |
4 | BUILDSERVER_CONFIG_DIR="/etc/mage-buildserver" |
5 | BUILDSERVER_CACHE_DIR="/var/cache/mage-buildserver" |
6 | source ${BUILDSERVER_CONFIG_DIR}/buildserver.conf |
7 | |
8 | source ${BUILDSERVER_LIB_DIR}/buildserver-functions.sh |
9 | |
10 | # override |
11 | #BUILDROOT="/mnt/test-buildroot" |
12 | #BUILD_ARCH=( x86_64 i686 ) |
13 | #BUILDROOT_PROFILE="R11" |
14 | #SMAGE_SVN_REPO="svn://cvs.magellan-linux.de/smage/trunk" |
15 | #MAGE_SVN_REPO="svn://cvs.magellan-linux.de/mage/trunk" |
16 | |
17 | if [ ! -f ${BUILDROOT}/.stamps/mage_svn-checkout-ok ] |
18 | then |
19 | die "svn checkout of mage required. run buildserver-svn first." |
20 | fi |
21 | |
22 | # create buildroot layout |
23 | install -d ${BUILDROOT}/.stamps |
24 | install -d ${BUILDROOT}/tmp/mage-tree |
25 | install -d ${BUILDROOT}/ssh |
26 | for arch in ${BUILD_ARCH[*]} src |
27 | do |
28 | install -d ${BUILDROOT}/${arch} |
29 | install -d ${BUILDROOT}/packages/${arch} |
30 | install -d ${BUILDROOT}/meta/${arch} |
31 | install -d ${BUILDROOT}/build-info/${arch} |
32 | done |
33 | |
34 | # |
35 | # arch specific |
36 | # |
37 | for arch in src ${BUILD_ARCH[*]} |
38 | do |
39 | if [ ! -f ${BUILDROOT}/.stamps/${arch}_bootstrap-ok ] |
40 | then |
41 | mage-bootstrap \ |
42 | --root ${BUILDROOT}/${arch} \ |
43 | --magerc ${BUILDSERVER_CONFIG_DIR}/profiles/${BUILDROOT_PROFILE}/${arch}/mage.rc \ |
44 | --profile "${BUILDROOT_PROFILE}" \ |
45 | --basesystem "${BOOTSTRAP_BASESYSTEM}" \ |
46 | || die "'${arch}' bootstrap" |
47 | touch ${BUILDROOT}/.stamps/${arch}_bootstrap-ok |
48 | else |
49 | echo "Warning: bootstrap already done for arch '${arch}'" |
50 | fi |
51 | done |
52 | |
53 | # create initial mage-tree for all arches |
54 | ${BUILDSERVER_LIB_DIR}/buildserver-setup-mage-tree.sh |
55 | |
56 | for arch in src ${BUILD_ARCH[*]} |
57 | do |
58 | |
59 | echo "DEBUG: arch='${arch}' BUILD_ARCH[*]='${BUILD_ARCH[*]}'" |
60 | |
61 | # honor any proxy settings |
62 | :> ${BUILDROOT}/${arch}/etc/env.d/01proxy |
63 | [[ -n ${http_proxy} ]] && echo "http_proxy=\"${http_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy |
64 | [[ -n ${https_proxy} ]] && echo "https_proxy=\"${https_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy |
65 | [[ -n ${ftp_proxy} ]] && echo "ftp_proxy=\"${ftp_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy |
66 | [[ -n ${ftps_proxy} ]] && echo "ftps_proxy=\"${ftps_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy |
67 | [[ -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" |
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 |
75 | if [ ! -f ${BUILDROOT}/.stamps/${arch}_subversion-ok ] |
76 | then |
77 | runarch "${arch}" mage install subversion || die "${arch} install subversion" |
78 | touch ${BUILDROOT}/.stamps/${arch}_subversion-ok |
79 | else |
80 | echo "Warning: subversion already installed for arch '${arch}'" |
81 | fi |
82 | |
83 | # install openssh |
84 | if [ ! -f ${BUILDROOT}/.stamps/${arch}_openssh-ok ] |
85 | then |
86 | runarch "${arch}" mage install openssh || die "${arch} install openssh" |
87 | touch ${BUILDROOT}/.stamps/${arch}_openssh-ok |
88 | else |
89 | echo "Warning: openssh already installed for arch '${arch}'" |
90 | fi |
91 | |
92 | if [[ ${arch} != src ]] |
93 | then |
94 | if [ ! -f ${BUILDROOT}/.stamps/${arch}_common-devutils-ok ] |
95 | then |
96 | runarch "${arch}" mage install "${BOOTSTRAP_DEVUTILS}" || die "${arch} install '${BOOTSTRAP_DEVUTILS}'" |
97 | touch ${BUILDROOT}/.stamps/${arch}_common-devutils-ok |
98 | else |
99 | echo "Warning: '${BOOTSTRAP_DEVUTILS}' already installed for arch '${arch}'" |
100 | fi |
101 | |
102 | # install ccache |
103 | if [ ! -f ${BUILDROOT}/.stamps/${arch}_ccache-ok ] |
104 | then |
105 | runarch "${arch}" mage install ccache || die "${arch} install ccache" |
106 | touch ${BUILDROOT}/.stamps/${arch}_ccache-ok |
107 | else |
108 | echo "Warning: ccache already installed for arch '${arch}'" |
109 | fi |
110 | # setup ccache |
111 | if [ ! -f ${BUILDROOT}/.stamps/${arch}_setup-ccache-ok ] |
112 | then |
113 | runarch "${arch}" ccache -M 4G || die "${arch} setup ccache" |
114 | touch ${BUILDROOT}/.stamps/${arch}_setup-ccache-ok |
115 | else |
116 | echo "Warning: ccache already configured for arch '${arch}'" |
117 | fi |
118 | fi |
119 | |
120 | # update-ca-certificates |
121 | 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 |
165 | runarch "${arch}" mage clean || die "${arch} mage clean" |
166 | |
167 | echo "Buildroot for arch '${arch}' sucessfully created."; echo |
168 | done |
Properties
Name | Value |
---|---|
svn:executable | * |