]>
Commit | Line | Data |
---|---|---|
ce85f613 MT |
1 | #!/bin/bash |
2 | ############################################################################### | |
3 | # # | |
4 | # IPFire.org - A linux based firewall # | |
cfccf561 | 5 | # Copyright (C) 2008 Michael Tremer & Christian Schmidt # |
ce85f613 MT |
6 | # # |
7 | # This program is free software: you can redistribute it and/or modify # | |
8 | # it under the terms of the GNU General Public License as published by # | |
9 | # the Free Software Foundation, either version 3 of the License, or # | |
10 | # (at your option) any later version. # | |
11 | # # | |
12 | # This program is distributed in the hope that it will be useful, # | |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # | |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # | |
15 | # GNU General Public License for more details. # | |
16 | # # | |
17 | # You should have received a copy of the GNU General Public License # | |
18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. # | |
19 | # # | |
20 | ############################################################################### | |
21 | ||
3349c6c9 MT |
22 | usage() { |
23 | cat doc/make.sh-usage | |
c90c0df9 | 24 | exit 1 |
3349c6c9 MT |
25 | } |
26 | ||
ce85f613 MT |
27 | case "$1" in |
28 | build) | |
4ce0b818 | 29 | # check for prerequisites |
38e7c3ac | 30 | check_build |
602bc6fa MT |
31 | # check for sanity of code |
32 | check_sanity | |
cfccf561 MT |
33 | # compile the distro right now |
34 | build | |
8db8436b MT |
35 | # beeps when finished |
36 | echo -ne '\a' | |
ce85f613 | 37 | ;; |
38e7c3ac | 38 | |
ce85f613 MT |
39 | shell) |
40 | # enter a shell inside LFS chroot | |
41 | # may be used to change kernel settings | |
42 | prepareenv | |
43 | entershell | |
44 | ;; | |
cfccf561 MT |
45 | |
46 | batch) | |
47 | # build the distro in background | |
cfccf561 MT |
48 | case "$2" in |
49 | start) | |
94c4cae8 | 50 | batch_start $3 |
cfccf561 MT |
51 | ;; |
52 | _run) | |
53 | batch_run | |
54 | ;; | |
55 | attach|watch) | |
56 | batch_attach | |
57 | ;; | |
3349c6c9 MT |
58 | *) |
59 | usage | |
60 | ;; | |
cfccf561 MT |
61 | esac |
62 | ;; | |
63 | ||
689314ee MT |
64 | ccache) |
65 | # ccache options | |
cfccf561 | 66 | case "$2" in |
689314ee | 67 | stats) |
cfccf561 MT |
68 | ccache_stats |
69 | ;; | |
689314ee MT |
70 | esac |
71 | ;; | |
72 | ||
73 | distcc|distccd) | |
74 | # distcc(d) commands | |
75 | case "$2" in | |
76 | start) | |
77 | distccd_start | |
78 | ;; | |
79 | stop) | |
80 | distccd_stop | |
81 | ;; | |
4ca87d59 MT |
82 | restart) |
83 | distccd_restart | |
84 | ;; | |
689314ee | 85 | stats|mon) |
cfccf561 MT |
86 | distcc_mon |
87 | ;; | |
88 | esac | |
89 | ;; | |
38e7c3ac | 90 | |
ce85f613 | 91 | clean) |
38e7c3ac | 92 | for i in $(mount | grep $BASEDIR | cut -d " " -f 1); do |
ce85f613 MT |
93 | umount $i |
94 | done | |
95 | ||
96 | stdumount | |
ce85f613 | 97 | |
45035bca | 98 | for i in ${TARGET-${POSSIBLE_TARGETS}}; do |
9e49fc4c MT |
99 | echo -ne "Cleaning ${BOLD}$i${NORMAL} buildtree" |
100 | rm -rf $BASEDIR/build_$i | |
101 | rm -rf $BASEDIR/log_$i | |
102 | rm -rf $BASEDIR/packages_$i | |
103 | beautify message DONE | |
104 | done | |
105 | echo -ne "Removing ${BOLD}general files${NORMAL}" | |
106 | rm -f $FAILED $RUNNING 2>/dev/null | |
ce85f613 MT |
107 | beautify message DONE |
108 | ;; | |
38e7c3ac | 109 | |
da1befdd | 110 | source|src) |
fa0dac0f | 111 | LOGFILE=$BASEDIR/log_${MACHINE}/_build.00-preparation.log |
da1befdd MT |
112 | case "$2" in |
113 | get|pull|download) | |
114 | getsource | |
115 | ;; | |
116 | put|push|upload) | |
117 | putsource | |
118 | ;; | |
119 | esac | |
ce85f613 | 120 | ;; |
38e7c3ac | 121 | |
ce85f613 | 122 | toolchain) |
da1befdd MT |
123 | case "$2" in |
124 | get|pull|download) | |
125 | gettoolchain | |
126 | ;; | |
127 | put|push|upload) | |
128 | puttoolchain | |
129 | ;; | |
763463bc | 130 | ""|-*) |
da1befdd MT |
131 | prepareenv |
132 | # Check if host can build the toolchain | |
133 | check_toolchain | |
b91fa051 | 134 | |
af48bccf | 135 | build_spy_send_profile |
4a792716 | 136 | build_spy state compiling |
af48bccf | 137 | BASEDIR=$BASEDIR UUID=$UUID NAME=$NAME VERSION=$VERSION $BASEDIR/tools/make-buildspy & |
b91fa051 | 138 | |
da1befdd | 139 | toolchain_build |
b91fa051 | 140 | |
da1befdd MT |
141 | stdumount |
142 | echo -ne "\ntarball creation " | |
143 | [ -d $BASEDIR/cache/toolchains ] || mkdir $BASEDIR/cache/toolchains | |
144 | cd $BASEDIR && tar cj --exclude='log_${MACHINE}/_build.*.log' \ | |
145 | --file=cache/toolchains/$TOOLCHAINNAME.tar.bz2 \ | |
146 | build_${MACHINE} log_${MACHINE} >> $LOGFILE | |
147 | beautify message DONE | |
148 | echo `ls -sh cache/toolchains/$TOOLCHAINNAME.tar.bz2` | |
149 | ||
150 | stdumount | |
38e7c3ac | 151 | |
4a792716 | 152 | build_spy state idle |
af48bccf | 153 | [ "$3" = "--put" ] && puttoolchain |
da1befdd MT |
154 | ;; |
155 | *) | |
156 | usage | |
157 | ;; | |
158 | esac | |
ce85f613 | 159 | ;; |
bd4be397 | 160 | |
af48bccf MT |
161 | toolchains) |
162 | for i in $(check_supported_targets); do | |
763463bc | 163 | TARGET=$i $0 toolchain --put |
af48bccf MT |
164 | done |
165 | ;; | |
166 | ||
e70deaa8 MT |
167 | target) |
168 | case "$2" in | |
169 | put|push|upload) | |
170 | puttarget | |
171 | ;; | |
172 | *) | |
173 | usage | |
174 | ;; | |
175 | esac | |
176 | ;; | |
177 | ||
bd4be397 | 178 | check) |
c90c0df9 MT |
179 | case "$2" in |
180 | cpu) | |
181 | [ -z "$3" ] && usage | |
182 | if check_cpu $3; then | |
183 | echo -n "CPU has flag $3" | |
184 | beautify message DONE | |
185 | else | |
186 | dialogerror "CPU hasn't got flag $3" | |
187 | exit 1 | |
188 | fi | |
189 | ;; | |
190 | rootfiles) | |
191 | check_rootfiles $3 | |
192 | ;; | |
193 | sanity) | |
194 | check_sanity $3 | |
195 | ;; | |
aac56982 MT |
196 | target*) |
197 | check_supported_targets | |
198 | ;; | |
c90c0df9 MT |
199 | *) |
200 | usage | |
201 | ;; | |
202 | esac | |
bd4be397 | 203 | ;; |
38e7c3ac | 204 | |
4b7f6462 | 205 | g[iu]t) |
4b7f6462 MT |
206 | COMMAND=$2 |
207 | shift 2 | |
208 | case "$COMMAND" in | |
0627b392 | 209 | update|pull) |
4b7f6462 | 210 | git_pull $* |
ce85f613 MT |
211 | ;; |
212 | commit|ci) | |
0627b392 | 213 | git_commit $* |
ce85f613 | 214 | ;; |
e4cff7fc | 215 | dist|export|archive) |
4b7f6462 | 216 | git_export $* |
e4cff7fc | 217 | ;; |
8e878964 | 218 | push) |
4b7f6462 | 219 | git_push $* |
8e878964 | 220 | ;; |
ce85f613 | 221 | diff|di) |
4b7f6462 | 222 | git_diff $* |
ce85f613 MT |
223 | ;; |
224 | log) | |
4b7f6462 | 225 | git_log $* |
ce85f613 | 226 | ;; |
48a17e7d MT |
227 | gc) |
228 | git_gc | |
229 | ;; | |
3763394e | 230 | put-key) |
3763394e MT |
231 | ssh_cert $* |
232 | ;; | |
4b7f6462 MT |
233 | *) # If no command matches run git directly |
234 | git $* | |
235 | ;; | |
ce85f613 MT |
236 | esac |
237 | ;; | |
38e7c3ac | 238 | |
021ed203 MT |
239 | push) |
240 | putsource | |
241 | git_push | |
242 | ;; | |
243 | ||
244 | pull) | |
245 | LOGFILE=$BASEDIR/log_${MACHINE}/_build.00-preparation.log | |
246 | git_pull | |
247 | check_sanity | |
248 | getsource | |
249 | ;; | |
250 | ||
ce85f613 | 251 | *) |
3349c6c9 | 252 | usage |
ce85f613 | 253 | ;; |
38e7c3ac | 254 | |
ce85f613 | 255 | esac |