Annotation of /trunk/mage-buildserver/buildserver-prepare.sh
Parent Directory | Revision Log
Revision 2730 -
(hide annotations)
(download)
(as text)
Sun Aug 10 19:35:40 2014 UTC (9 years, 10 months ago) by niro
File MIME type: application/x-sh
File size: 4649 byte(s)
Sun Aug 10 19:35:40 2014 UTC (9 years, 10 months ago) by niro
File MIME type: application/x-sh
File size: 4649 byte(s)
-protect buildserver essential packages from uninstallation like the compiler libc etc
1 | niro | 2588 | #!/bin/bash |
2 | |||
3 | # get configuration | ||
4 | BUILDSERVER_CONFIG_DIR="/etc/mage-buildserver" | ||
5 | source ${BUILDSERVER_CONFIG_DIR}/buildserver.conf | ||
6 | |||
7 | source ${BUILDSERVER_LIB_DIR}/buildserver-functions.sh | ||
8 | |||
9 | # override | ||
10 | #BUILDROOT="/mnt/test-buildroot" | ||
11 | #BUILD_ARCH=( x86_64 i686 ) | ||
12 | #BUILDROOT_PROFILE="R11" | ||
13 | #SMAGE_SVN_REPO="svn://cvs.magellan-linux.de/smage/trunk" | ||
14 | #MAGE_SVN_REPO="svn://cvs.magellan-linux.de/mage/trunk" | ||
15 | |||
16 | if [ ! -f ${BUILDROOT}/.stamps/mage_svn-checkout-ok ] | ||
17 | then | ||
18 | die "svn checkout of mage required. run buildserver-svn first." | ||
19 | fi | ||
20 | |||
21 | # create buildroot layout | ||
22 | install -d ${BUILDROOT}/.stamps | ||
23 | install -d ${BUILDROOT}/tmp/mage-tree | ||
24 | for arch in ${BUILD_ARCH[*]} src | ||
25 | do | ||
26 | install -d ${BUILDROOT}/${arch} | ||
27 | install -d ${BUILDROOT}/packages/${arch} | ||
28 | install -d ${BUILDROOT}/meta/${arch} | ||
29 | done | ||
30 | |||
31 | # | ||
32 | # arch specific | ||
33 | # | ||
34 | for arch in src ${BUILD_ARCH[*]} | ||
35 | do | ||
36 | if [ ! -f ${BUILDROOT}/.stamps/${arch}_bootstrap-ok ] | ||
37 | then | ||
38 | mage-bootstrap \ | ||
39 | --root ${BUILDROOT}/${arch} \ | ||
40 | --magerc ${BUILDSERVER_CONFIG_DIR}/profiles/${BUILDROOT_PROFILE}/${arch}/mage.rc \ | ||
41 | --profile "${BUILDROOT_PROFILE}" \ | ||
42 | --basesystem "${BOOTSTRAP_BASESYSTEM}" \ | ||
43 | || die "'${arch}' bootstrap" | ||
44 | touch ${BUILDROOT}/.stamps/${arch}_bootstrap-ok | ||
45 | else | ||
46 | echo "Warning: bootstrap already done for arch '${arch}'" | ||
47 | fi | ||
48 | done | ||
49 | |||
50 | # create initial mage-tree for all arches | ||
51 | ${BUILDSERVER_LIB_DIR}/buildserver-setup-mage-tree.sh | ||
52 | |||
53 | for arch in src ${BUILD_ARCH[*]} | ||
54 | do | ||
55 | |||
56 | echo "DEBUG: arch='${arch}' BUILD_ARCH[*]='${BUILD_ARCH[*]}'" | ||
57 | |||
58 | # honor any proxy settings | ||
59 | :> ${BUILDROOT}/${arch}/etc/env.d/01proxy | ||
60 | [[ -n ${http_proxy} ]] && echo "http_proxy=\"${http_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy | ||
61 | [[ -n ${https_proxy} ]] && echo "https_proxy=\"${https_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy | ||
62 | [[ -n ${ftp_proxy} ]] && echo "ftp_proxy=\"${ftp_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy | ||
63 | [[ -n ${ftps_proxy} ]] && echo "ftps_proxy=\"${ftps_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy | ||
64 | [[ -n ${no_proxy} ]] && echo "no_proxy=\"${no_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy | ||
65 | runarch ${arch} env-rebuild || die "${arch} environment rebuild for proxy setup" | ||
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 | niro | 2728 | # 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 | niro | 2588 | 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 | niro | 2729 | |
113 | # update-ca-certificates | ||
114 | runarch "${arch}" update-ca-certificates # no die here, cmd may missing | ||
115 | |||
116 | niro | 2730 | # create list of protected packages |
117 | echo "BUILDSERVER_CONFIG_DIR=\"${BUILDSERVER_CONFIG_DIR}\"" > ${BUILDROOT}/${arch}/.runrc | ||
118 | install -d ${BUILDSERVER_CONFIG_DIR}/protected | ||
119 | cat >> ${BUILDROOT}/${arch}/.runrc << "EOF" | ||
120 | env-rebuild | ||
121 | source /etc/profile | ||
122 | |||
123 | if [ -f /etc/rc.d/init.d/functions ] | ||
124 | then | ||
125 | source /etc/rc.d/init.d/functions | ||
126 | else | ||
127 | die "/etc/rc.d/init.d/functions not found" | ||
128 | fi | ||
129 | if [ -f /etc/mage.rc.global ] | ||
130 | then | ||
131 | source /etc/mage.rc.global | ||
132 | else | ||
133 | die "/etc/mage.rc.global not found" | ||
134 | fi | ||
135 | if [ -f /etc/mage.rc ] | ||
136 | then | ||
137 | source /etc/mage.rc | ||
138 | else | ||
139 | die "/etc/mage.rc not found" | ||
140 | fi | ||
141 | |||
142 | for mage in $(find ${INSTALLDB} -name \*.${MAGESUFFIX}) | ||
143 | do | ||
144 | pkgname=$(basename ${i} .${MAGESUFFIX}) | ||
145 | pkgname="${pkgname%-*-*}" | ||
146 | echo "${pkgname}" > ${BUILDSERVER_CONFIG_DIR}/protected/"${pkgname}" | ||
147 | done | ||
148 | EOF | ||
149 | |||
150 | niro | 2588 | # cleanup |
151 | runarch "${arch}" mage clean || die "${arch} mage clean" | ||
152 | |||
153 | echo "Buildroot for arch '${arch}' sucessfully created."; echo | ||
154 | done |
Properties
Name | Value |
---|---|
svn:executable | * |