Annotation of /trunk/mage-buildserver/helper/buildserver-build-install-prerequisites.sh
Parent Directory | Revision Log
Revision 2747 -
(hide annotations)
(download)
(as text)
Wed Aug 13 14:02:51 2014 UTC (9 years, 10 months ago) by niro
File MIME type: application/x-sh
File size: 3164 byte(s)
Wed Aug 13 14:02:51 2014 UTC (9 years, 10 months ago) by niro
File MIME type: application/x-sh
File size: 3164 byte(s)
-split off helper functions
1 | niro | 2747 | #!/bin/bash |
2 | |||
3 | BUILDSERVER_CACHE_DIR="/var/cache/mage-buildserver" | ||
4 | SMAGEFILE="$1" | ||
5 | |||
6 | if [ -f /etc/rc.d/init.d/functions ] | ||
7 | then | ||
8 | source /etc/rc.d/init.d/functions | ||
9 | else | ||
10 | die "/etc/rc.d/init.d/functions not found" | ||
11 | fi | ||
12 | if [ -f /etc/mage.rc.global ] | ||
13 | then | ||
14 | source /etc/mage.rc.global | ||
15 | else | ||
16 | die "/etc/mage.rc.global not found" | ||
17 | fi | ||
18 | if [ -f /etc/mage.rc ] | ||
19 | then | ||
20 | source /etc/mage.rc | ||
21 | else | ||
22 | die "/etc/mage.rc not found" | ||
23 | fi | ||
24 | if [ -f ${MLIBDIR}/mage4.functions.sh ] | ||
25 | then | ||
26 | source ${MLIBDIR}/mage4.functions.sh | ||
27 | else | ||
28 | die "${MLIBDIR}/mage4.functions.sh not found" | ||
29 | fi | ||
30 | if [ -f ${MLIBDIR}/smage2.functions.sh ] | ||
31 | then | ||
32 | source ${MLIBDIR}/smage2.functions.sh | ||
33 | else | ||
34 | die "${MLIBDIR}/smage2.functions.sh not found" | ||
35 | fi | ||
36 | |||
37 | # do this at least of all includes to prevent path overwrites | ||
38 | env-rebuild | ||
39 | source /etc/profile | ||
40 | |||
41 | # export default path | ||
42 | export PATH="${PATH}:${MLIBDIR}" | ||
43 | |||
44 | die() | ||
45 | { | ||
46 | echo "ERROR: $@" | ||
47 | exit 1 | ||
48 | } | ||
49 | |||
50 | is_split_target_magefile() | ||
51 | { | ||
52 | local mage="$1" | ||
53 | |||
54 | for target_mage in ${MY_SPLIT_TARGET_MAGEFILES} | ||
55 | do | ||
56 | if [[ ${mage} = ${target_mage} ]] | ||
57 | then | ||
58 | return 0 | ||
59 | fi | ||
60 | done | ||
61 | |||
62 | return 1 | ||
63 | } | ||
64 | |||
65 | load_mage_features | ||
66 | mage_setup | ||
67 | |||
68 | if [[ -z ${SMAGEFILE} ]] | ||
69 | then | ||
70 | die "no smage file given. call '$(basename $0) with/relative/path/from/buildroot/svn/smage/to/smagefile'" | ||
71 | fi | ||
72 | |||
73 | if [ -f ${SMAGESCRIPTSDIR}/${SMAGEFILE} ] | ||
74 | then | ||
75 | SILENT=1 smagesource ${SMAGESCRIPTSDIR}/${SMAGEFILE} | ||
76 | else | ||
77 | die "smagefile '${SMAGESCRIPTSDIR}/${SMAGEFILE}' not found." | ||
78 | fi | ||
79 | |||
80 | # create build info dir | ||
81 | install -d ${BUILDSERVER_CACHE_DIR}/build | ||
82 | |||
83 | if [ ! -f ${BUILDSERVER_CACHE_DIR}/build/${PNAME}-${PVER}-${PBUILD}/INSTALL_DEPS ] | ||
84 | then | ||
85 | die "${BUILDSERVER_CACHE_DIR}/build/${PNAME}-${PVER}-${PBUILD}/INSTALL_DEPS missing. run 'buildserver-build-depends first" | ||
86 | fi | ||
87 | |||
88 | if [ ! -f ${BUILDSERVER_CACHE_DIR}/build/${PNAME}-${PVER}-${PBUILD}/SRC_INSTALL_DEPS ] | ||
89 | then | ||
90 | die "${BUILDSERVER_CACHE_DIR}/build/${PNAME}-${PVER}-${PBUILD}/SRC_INSTALL_DEPS missing. run 'buildserver-build-depends first" | ||
91 | fi | ||
92 | |||
93 | INSTALL_DEPS="$(< ${BUILDSERVER_CACHE_DIR}/build/${PNAME}-${PVER}-${PBUILD}/INSTALL_DEPS)" | ||
94 | SRC_INSTALL_DEPS="$(< ${BUILDSERVER_CACHE_DIR}/build/${PNAME}-${PVER}-${PBUILD}/SRC_INSTALL_DEPS)" | ||
95 | |||
96 | if [[ -z ${SRC_INSTALL_DEPS} ]] | ||
97 | then | ||
98 | die "buildserver-build-uninstall-prerequisites: SRC_INSTALL_DEPS are empty, aborting." | ||
99 | fi | ||
100 | |||
101 | echo | ||
102 | echo "---- dependencies ----" | ||
103 | echo "INSTALL_DEPS:" | ||
104 | for i in ${INSTALL_DEPS} | ||
105 | do | ||
106 | echo " * ${i}" | ||
107 | done | ||
108 | echo "SRC_INSTALL_DEPS:" | ||
109 | for i in ${SRC_INSTALL_DEPS} | ||
110 | do | ||
111 | echo " * ${i}" | ||
112 | done | ||
113 | echo "----------------------" | ||
114 | |||
115 | #echo "DEBUG: paused"; read | ||
116 | |||
117 | # override packages path | ||
118 | SAVED_PKGDIR="${PKGDIR}" | ||
119 | PKGDIR="/var/cache/mage/tmp-packages" | ||
120 | install -d "${PKGDIR}" | ||
121 | |||
122 | # now install the packages (no srcinstall, when the user not explcitly want this) | ||
123 | fetch_packages ${INSTALL_DEPS} || die "fetching packages" | ||
124 | md5sum_packages ${INSTALL_DEPS} || die "md5 sum packages" | ||
125 | unpack_packages ${INSTALL_DEPS} || die "unpacking packages" | ||
126 | install_packages ${INSTALL_DEPS} || die "installing packages" | ||
127 | cleanpkg | ||
128 | # restore packages path | ||
129 | PKGDIR="${SAVED_PKGDIR}" | ||
130 | |||
131 | ## always run auto etc-update | ||
132 | echo "running etc-update" | ||
133 | echo "-5" | etc-update | ||
134 | |||
135 | # mark prerequisites as installed | ||
136 | touch ${BUILDSERVER_CACHE_DIR}/build/${PNAME}-${PVER}-${PBUILD}/INSTALLED_PREREQUISITES |
Properties
Name | Value |
---|---|
svn:executable | * |