]> git.ipfire.org Git - ipfire-3.x.git/blame - tools/make-interactive
Rootfile update.
[ipfire-3.x.git] / tools / make-interactive
CommitLineData
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
22usage() {
23 cat doc/make.sh-usage
c90c0df9 24 exit 1
3349c6c9
MT
25}
26
ce85f613
MT
27case "$1" in
28build)
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
39shell)
40 # enter a shell inside LFS chroot
41 # may be used to change kernel settings
42 prepareenv
43 entershell
44 ;;
cfccf561
MT
45
46batch)
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
64ccache)
65 # ccache options
cfccf561 66 case "$2" in
689314ee 67 stats)
cfccf561
MT
68 ccache_stats
69 ;;
689314ee
MT
70 esac
71 ;;
72
73distcc|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 91clean)
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
d50ae2d1
MT
98 WHAT=${TARGET}
99 [ "$2" = "--all" ] && WHAT="${POSSIBLE_TARGETS}"
100
101 for i in ${WHAT}; do
9e49fc4c
MT
102 echo -ne "Cleaning ${BOLD}$i${NORMAL} buildtree"
103 rm -rf $BASEDIR/build_$i
104 rm -rf $BASEDIR/log_$i
105 rm -rf $BASEDIR/packages_$i
106 beautify message DONE
107 done
108 echo -ne "Removing ${BOLD}general files${NORMAL}"
109 rm -f $FAILED $RUNNING 2>/dev/null
ce85f613
MT
110 beautify message DONE
111 ;;
38e7c3ac 112
da1befdd 113source|src)
11f0ec61 114 LOGFILE=$BASEDIR/log_${TARGET}/_build.00-preparation.log
da1befdd
MT
115 case "$2" in
116 get|pull|download)
117 getsource
118 ;;
119 put|push|upload)
120 putsource
121 ;;
421f4db0
MT
122 list)
123 software_list | tee -a $BASEDIR/doc/packages-list.txt
124 ;;
da1befdd 125 esac
ce85f613 126 ;;
38e7c3ac 127
ce85f613 128toolchain)
da1befdd
MT
129 case "$2" in
130 get|pull|download)
131 gettoolchain
132 ;;
133 put|push|upload)
134 puttoolchain
135 ;;
763463bc 136 ""|-*)
da1befdd
MT
137 prepareenv
138 # Check if host can build the toolchain
139 check_toolchain
b91fa051 140
da1befdd 141 toolchain_build
b91fa051 142
da1befdd
MT
143 stdumount
144 echo -ne "\ntarball creation "
145 [ -d $BASEDIR/cache/toolchains ] || mkdir $BASEDIR/cache/toolchains
11f0ec61 146 cd $BASEDIR && tar cj --exclude='log_${TARGET}/_build.*.log' \
da1befdd 147 --file=cache/toolchains/$TOOLCHAINNAME.tar.bz2 \
11f0ec61 148 build_${TARGET} log_${TARGET} >> $LOGFILE
da1befdd
MT
149 beautify message DONE
150 echo `ls -sh cache/toolchains/$TOOLCHAINNAME.tar.bz2`
151
152 stdumount
38e7c3ac 153
492712a2 154 [ "$2" = "--put" ] && puttoolchain
da1befdd
MT
155 ;;
156 *)
157 usage
158 ;;
159 esac
ce85f613 160 ;;
bd4be397 161
af48bccf
MT
162toolchains)
163 for i in $(check_supported_targets); do
66a00f9a 164 TARGET=$i $0 clean
763463bc 165 TARGET=$i $0 toolchain --put
af48bccf
MT
166 done
167 ;;
168
e70deaa8
MT
169target)
170 case "$2" in
171 put|push|upload)
172 puttarget
173 ;;
174 *)
175 usage
176 ;;
177 esac
178 ;;
179
bd4be397 180check)
c90c0df9
MT
181 case "$2" in
182 cpu)
183 [ -z "$3" ] && usage
184 if check_cpu $3; then
185 echo -n "CPU has flag $3"
186 beautify message DONE
187 else
188 dialogerror "CPU hasn't got flag $3"
189 exit 1
190 fi
191 ;;
192 rootfiles)
193 check_rootfiles $3
194 ;;
195 sanity)
196 check_sanity $3
197 ;;
aac56982
MT
198 target*)
199 check_supported_targets
200 ;;
c90c0df9
MT
201 *)
202 usage
203 ;;
204 esac
bd4be397 205 ;;
38e7c3ac 206
4b7f6462 207g[iu]t)
4b7f6462
MT
208 COMMAND=$2
209 shift 2
210 case "$COMMAND" in
0627b392 211 update|pull)
4b7f6462 212 git_pull $*
ce85f613
MT
213 ;;
214 commit|ci)
0627b392 215 git_commit $*
ce85f613 216 ;;
e4cff7fc 217 dist|export|archive)
4b7f6462 218 git_export $*
e4cff7fc 219 ;;
8e878964 220 push)
4b7f6462 221 git_push $*
8e878964 222 ;;
ce85f613 223 diff|di)
4b7f6462 224 git_diff $*
ce85f613
MT
225 ;;
226 log)
4b7f6462 227 git_log $*
ce85f613 228 ;;
48a17e7d
MT
229 gc)
230 git_gc
231 ;;
3763394e 232 put-key)
3763394e
MT
233 ssh_cert $*
234 ;;
4b7f6462
MT
235 *) # If no command matches run git directly
236 git $*
237 ;;
ce85f613
MT
238 esac
239 ;;
38e7c3ac 240
021ed203
MT
241push)
242 putsource
243 git_push
244 ;;
245
246pull)
11f0ec61 247 LOGFILE=$BASEDIR/log_${TARGET}/_build.00-preparation.log
021ed203
MT
248 git_pull
249 check_sanity
250 getsource
251 ;;
252
95642cd9
MT
253vm|qemu)
254 case "$2" in
255 boot|start|run)
256 shift 2
257 qemu_start $*
258 ;;
259
260 clean)
261 rm -rf $BASEDIR/vm
262 ;;
263 esac
264 ;;
265
ce85f613 266*)
3349c6c9 267 usage
ce85f613 268 ;;
38e7c3ac 269
ce85f613 270esac