]> git.ipfire.org Git - ipfire-3.x.git/blob - tools/make-interactive
We also provide the files used by a package.
[ipfire-3.x.git] / tools / make-interactive
1 #!/bin/bash
2 ###############################################################################
3 # #
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2008 Michael Tremer & Christian Schmidt #
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
22 usage() {
23 cat doc/make.sh-usage
24 exit 1
25 }
26
27 case "$1" in
28 build)
29 # check for prerequisites
30 check_build
31 # check for sanity of code
32 check_sanity
33 # compile the distro right now
34 build
35 # beeps when finished
36 echo -ne '\a'
37 ;;
38
39 shell)
40 # enter a shell inside LFS chroot
41 # may be used to change kernel settings
42 prepareenv
43 entershell
44 ;;
45
46 batch)
47 # build the distro in background
48 case "$2" in
49 cron)
50 cron_run
51 ;;
52 start)
53 batch_start $3
54 ;;
55 _run)
56 batch_run
57 ;;
58 attach|watch)
59 batch_attach
60 ;;
61 *)
62 usage
63 ;;
64 esac
65 ;;
66
67 ccache)
68 # ccache options
69 case "$2" in
70 stats)
71 ccache_stats
72 ;;
73 esac
74 ;;
75
76 distcc|distccd)
77 # distcc(d) commands
78 case "$2" in
79 start)
80 distccd_start
81 ;;
82 stop)
83 distccd_stop
84 ;;
85 restart)
86 distccd_restart
87 ;;
88 stats|mon)
89 distcc_mon
90 ;;
91 esac
92 ;;
93
94 clean)
95 for i in $(mount | grep $BASEDIR | cut -d " " -f 1); do
96 umount $i
97 done
98
99 stdumount
100
101 WHAT=${TARGET}
102 [ "$2" = "--all" ] && WHAT="${POSSIBLE_TARGETS}"
103
104 for i in ${WHAT}; do
105 echo -ne "Cleaning ${BOLD}$i${NORMAL} buildtree"
106 rm -rf $BASEDIR/build_$i
107 rm -rf $BASEDIR/log_$i
108 rm -rf $BASEDIR/packages_$i
109 beautify message DONE
110 done
111 echo -ne "Removing ${BOLD}general files${NORMAL}"
112 rm -f $FAILED $RUNNING 2>/dev/null
113 beautify message DONE
114 ;;
115
116 source|src)
117 LOGFILE=$BASEDIR/log_${TARGET}/_build.00-preparation.log
118 case "$2" in
119 get|pull|download)
120 getsource
121 ;;
122 put|push|upload)
123 putsource
124 ;;
125 list)
126 software_list | tee -a $BASEDIR/doc/packages-list.txt
127 ;;
128 esac
129 ;;
130
131 toolchain)
132 case "$2" in
133 get|pull|download)
134 gettoolchain
135 ;;
136 put|push|upload)
137 puttoolchain
138 ;;
139 ""|-*)
140 prepareenv
141 # Check if host can build the toolchain
142 check_toolchain
143
144 toolchain_build
145
146 stdumount
147 echo -ne "\ntarball creation "
148 [ -d $BASEDIR/cache/toolchains ] || mkdir $BASEDIR/cache/toolchains
149 cd $BASEDIR && tar cj --exclude='log_${TARGET}/_build.*.log' \
150 --file=cache/toolchains/$TOOLCHAINNAME.tar.bz2 \
151 build_${TARGET} log_${TARGET} >> $LOGFILE
152 beautify message DONE
153 echo `ls -sh cache/toolchains/$TOOLCHAINNAME.tar.bz2`
154
155 stdumount
156
157 [ "$2" = "--put" ] && puttoolchain
158 ;;
159 *)
160 usage
161 ;;
162 esac
163 ;;
164
165 toolchains)
166 for i in $(check_supported_targets); do
167 TARGET=$i $0 clean
168 TARGET=$i $0 toolchain --put
169 done
170 ;;
171
172 target)
173 case "$2" in
174 put|push|upload)
175 puttarget
176 ;;
177 *)
178 usage
179 ;;
180 esac
181 ;;
182
183 check)
184 case "$2" in
185 cpu)
186 [ -z "$3" ] && usage
187 if check_cpu $3; then
188 echo -n "CPU has flag $3"
189 beautify message DONE
190 else
191 dialogerror "CPU hasn't got flag $3"
192 exit 1
193 fi
194 ;;
195 sanity)
196 check_sanity $3
197 ;;
198 target*)
199 check_supported_targets
200 ;;
201 *)
202 usage
203 ;;
204 esac
205 ;;
206
207 g[iu]t)
208 COMMAND=$2
209 shift 2
210 case "$COMMAND" in
211 update|pull)
212 git_pull $*
213 ;;
214 commit|ci)
215 git_commit $*
216 ;;
217 dist|export|archive)
218 git_export $*
219 ;;
220 push)
221 git_push $*
222 ;;
223 diff|di)
224 git_diff $*
225 ;;
226 log)
227 git_log $*
228 ;;
229 gc)
230 git_gc
231 ;;
232 put-key)
233 ssh_cert $*
234 ;;
235 *) # If no command matches run git directly
236 git $*
237 ;;
238 esac
239 ;;
240
241 package*|pkg)
242 case "$2" in
243 list|show|ls)
244 pkg_list_packages
245 ;;
246 info)
247 shift 2
248 format_desc() {
249 MAX_LENGTH=38
250 INPUT=$@
251
252 LINE=""
253 LENGTH=0
254 for word in $INPUT; do
255 LENGTH=$(expr $LENGTH + ${#word})
256 if [ "$LENGTH" -ge "$MAX_LENGTH" ]; then
257 printf "$LINE\n"
258 LINE=" ${word} "
259 LENGTH=${#word}
260 else
261 LINE="$LINE${word} "
262 fi
263 #echo "-- ($word) $LINE"
264 done
265 printf "$LINE\n"
266 }
267 for pkg in $@; do
268 (
269 eval "$(pkg_info ${pkg})"
270 echo "############################################################"
271 echo -e "# ${CLR_BOLD_RED}PACKAGE INFO${NORMAL}"
272 echo "############################################################"
273 for val in NAME VERSION RELEASE break GROUP MAINTAINER break URL LICENSE; do
274 if [ "${val}" == "break" ]; then
275 echo " ---------------------------------------- "
276 else
277 printf "${CLR_BOLD_RED}%-12s${NORMAL}: ${!val}\n" ${val}
278 fi
279 done
280 for val in SHORT DESC; do
281 printf "${CLR_BOLD_RED}%-12s${NORMAL}: " ${val}
282 format_desc ${!val}
283 done
284 )
285 done
286 ;;
287 group*)
288 echo "====== All available groups of packages in ${NAME}-${VERSION} ======"
289 echo
290 for group in $(pkg_list_groups); do
291 echo " * ${group}"
292 done
293 ;;
294 raw)
295 pkg_info $3
296 ;;
297 wikiinfo)
298 shift 2
299 pkg_info_wiki $@
300 ;;
301 *)
302 usage
303 ;;
304 esac
305 ;;
306
307 push)
308 putsource
309 git_push
310 ;;
311
312 pull)
313 LOGFILE=$BASEDIR/log_${TARGET}/_build.00-preparation.log
314 git_pull
315 check_sanity
316 getsource
317 ;;
318
319 rootfiles|rf)
320 case "$2" in
321 check|ch)
322 rootfiles_check $3
323 ;;
324 commit|ci|update|up)
325 rootfiles_commit
326 ;;
327 copy|cp)
328 shift 2
329 rootfiles_copy $@
330 ;;
331 fix)
332 rootfiles_check --fix
333 ;;
334 *)
335 usage
336 ;;
337 esac
338 ;;
339
340 vm|qemu)
341 case "$2" in
342 boot|start|run)
343 shift 2
344 qemu_start $*
345 ;;
346
347 clean)
348 rm -rf $BASEDIR/vm
349 ;;
350 esac
351 ;;
352
353 *)
354 usage
355 ;;
356
357 esac