Contents of /trunk/mage-buildserver/buildserver-prepare.sh
Parent Directory | Revision Log
Revision 2791 -
(show annotations)
(download)
(as text)
Thu Aug 28 09:37:15 2014 UTC (10 years ago) by niro
File MIME type: application/x-sh
File size: 4967 byte(s)
Thu Aug 28 09:37:15 2014 UTC (10 years ago) by niro
File MIME type: application/x-sh
File size: 4967 byte(s)
-use profile specific MAGE_PROFILE variable from profile.conf instead of BUILDROOT_PROFILE as mage-profile for system bootstrap
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 | if [ ! -f ${BUILDROOT}/.stamps/mage_svn-checkout-ok ] |
11 | then |
12 | die "svn checkout of mage required. run buildserver-svn first." |
13 | fi |
14 | |
15 | # create buildroot layout |
16 | install -d ${BUILDROOT}/.stamps |
17 | install -d ${BUILDROOT}/ssh |
18 | for arch in ${BUILD_ARCH[*]} src |
19 | do |
20 | install -d ${BUILDROOT}/${arch} |
21 | install -d ${BUILDROOT}/mage-tree/${arch} |
22 | install -d ${BUILDROOT}/packages/${arch} |
23 | install -d ${BUILDROOT}/meta/${arch} |
24 | install -d ${BUILDROOT}/build-info/${arch} |
25 | done |
26 | |
27 | # |
28 | # arch specific |
29 | # |
30 | for arch in src ${BUILD_ARCH[*]} |
31 | do |
32 | if [ ! -f ${BUILDROOT}/.stamps/${arch}_bootstrap-ok ] |
33 | then |
34 | mage-bootstrap \ |
35 | --root ${BUILDROOT}/${arch} \ |
36 | --magerc ${BUILDSERVER_CONFIG_DIR}/profiles/${BUILDROOT_PROFILE}/${arch}/mage.rc \ |
37 | --profile "${MAGE_PROFILE}" \ |
38 | --basesystem "${BOOTSTRAP_BASESYSTEM}" \ |
39 | || die "'${arch}' bootstrap" |
40 | touch ${BUILDROOT}/.stamps/${arch}_bootstrap-ok |
41 | else |
42 | echo "Warning: bootstrap already done for arch '${arch}'" |
43 | fi |
44 | done |
45 | |
46 | # create initial mage-tree for all arches |
47 | ${BUILDSERVER_LIB_DIR}/buildserver-setup-mage-tree.sh |
48 | |
49 | for arch in src ${BUILD_ARCH[*]} |
50 | do |
51 | |
52 | echo "DEBUG: arch='${arch}' BUILD_ARCH[*]='${BUILD_ARCH[*]}'" |
53 | |
54 | # honor any proxy settings |
55 | :> ${BUILDROOT}/${arch}/etc/env.d/01proxy |
56 | [[ -n ${http_proxy} ]] && echo "http_proxy=\"${http_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy |
57 | [[ -n ${https_proxy} ]] && echo "https_proxy=\"${https_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy |
58 | [[ -n ${ftp_proxy} ]] && echo "ftp_proxy=\"${ftp_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy |
59 | [[ -n ${ftps_proxy} ]] && echo "ftps_proxy=\"${ftps_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy |
60 | [[ -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" |
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 |
68 | if [ ! -f ${BUILDROOT}/.stamps/${arch}_subversion-ok ] |
69 | then |
70 | runarch "${arch}" mage install subversion || die "${arch} install subversion" |
71 | touch ${BUILDROOT}/.stamps/${arch}_subversion-ok |
72 | else |
73 | echo "Warning: subversion already installed for arch '${arch}'" |
74 | fi |
75 | |
76 | # install openssh |
77 | if [ ! -f ${BUILDROOT}/.stamps/${arch}_openssh-ok ] |
78 | then |
79 | runarch "${arch}" mage install openssh || die "${arch} install openssh" |
80 | touch ${BUILDROOT}/.stamps/${arch}_openssh-ok |
81 | else |
82 | echo "Warning: openssh already installed for arch '${arch}'" |
83 | fi |
84 | |
85 | if [[ ${arch} != src ]] |
86 | then |
87 | if [ ! -f ${BUILDROOT}/.stamps/${arch}_common-devutils-ok ] |
88 | then |
89 | runarch "${arch}" mage install "${BOOTSTRAP_DEVUTILS}" || die "${arch} install '${BOOTSTRAP_DEVUTILS}'" |
90 | touch ${BUILDROOT}/.stamps/${arch}_common-devutils-ok |
91 | else |
92 | echo "Warning: '${BOOTSTRAP_DEVUTILS}' already installed for arch '${arch}'" |
93 | fi |
94 | |
95 | # install ccache |
96 | if [ ! -f ${BUILDROOT}/.stamps/${arch}_ccache-ok ] |
97 | then |
98 | runarch "${arch}" mage install ccache || die "${arch} install ccache" |
99 | touch ${BUILDROOT}/.stamps/${arch}_ccache-ok |
100 | else |
101 | echo "Warning: ccache already installed for arch '${arch}'" |
102 | fi |
103 | # setup ccache |
104 | if [ ! -f ${BUILDROOT}/.stamps/${arch}_setup-ccache-ok ] |
105 | then |
106 | runarch "${arch}" ccache -M 4G || die "${arch} setup ccache" |
107 | touch ${BUILDROOT}/.stamps/${arch}_setup-ccache-ok |
108 | else |
109 | echo "Warning: ccache already configured for arch '${arch}'" |
110 | fi |
111 | 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 |
158 | runarch "${arch}" mage clean || die "${arch} mage clean" |
159 | |
160 | echo "Buildroot for arch '${arch}' sucessfully created."; echo |
161 | done |
Properties
Name | Value |
---|---|
svn:executable | * |