]> git.ipfire.org Git - ipfire-3.x.git/blob - tools/make-interactive
Merge branch 'master' of ssh://ms@git.ipfire.org/pub/git/ipfire-3.x
[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 start)
50 batch_start $3
51 ;;
52 _run)
53 batch_run
54 ;;
55 attach|watch)
56 batch_attach
57 ;;
58 *)
59 usage
60 ;;
61 esac
62 ;;
63
64 stats)
65 # show some stats about the compiler(s)
66 case "$2" in
67 ccache)
68 ccache_stats
69 ;;
70 distcc)
71 distcc_mon
72 ;;
73 esac
74 ;;
75
76 clean)
77 echo -ne "Cleaning ${BOLD}$MACHINE${NORMAL} buildtree"
78
79 for i in $(mount | grep $BASEDIR | cut -d " " -f 1); do
80 umount $i
81 done
82
83 stdumount
84
85 rm -rf $BASEDIR/build_${MACHINE}
86 rm -rf $BASEDIR/log_${MACHINE}
87 rm -rf $BASEDIR/packages
88 rm -f $FAILED $RUNNING 2>/dev/null
89
90 if [ -h $TOOLS_DIR ]; then
91 rm -f $TOOLS_DIR
92 fi
93 beautify message DONE
94 ;;
95
96 source|src)
97 LOGFILE=$BASEDIR/log_${MACHINE}/_build.00-preparation.log
98 case "$2" in
99 get|pull|download)
100 getsource
101 ;;
102 put|push|upload)
103 putsource
104 ;;
105 esac
106 ;;
107
108 toolchain)
109 case "$2" in
110 get|pull|download)
111 gettoolchain
112 ;;
113 put|push|upload)
114 puttoolchain
115 ;;
116 "")
117 prepareenv
118 # Check if host can build the toolchain
119 check_toolchain
120
121 build_spy compiling
122
123 toolchain_build
124
125 stdumount
126 echo -ne "\ntarball creation "
127 [ -d $BASEDIR/cache/toolchains ] || mkdir $BASEDIR/cache/toolchains
128 cd $BASEDIR && tar cj --exclude='log_${MACHINE}/_build.*.log' \
129 --file=cache/toolchains/$TOOLCHAINNAME.tar.bz2 \
130 build_${MACHINE} log_${MACHINE} >> $LOGFILE
131 beautify message DONE
132 echo `ls -sh cache/toolchains/$TOOLCHAINNAME.tar.bz2`
133
134 stdumount
135
136 build_spy idle
137 ;;
138 *)
139 usage
140 ;;
141 esac
142 ;;
143
144 target)
145 case "$2" in
146 put|push|upload)
147 puttarget
148 ;;
149 *)
150 usage
151 ;;
152 esac
153 ;;
154
155 check)
156 case "$2" in
157 cpu)
158 [ -z "$3" ] && usage
159 if check_cpu $3; then
160 echo -n "CPU has flag $3"
161 beautify message DONE
162 else
163 dialogerror "CPU hasn't got flag $3"
164 exit 1
165 fi
166 ;;
167 rootfiles)
168 check_rootfiles $3
169 ;;
170 sanity)
171 check_sanity $3
172 ;;
173 *)
174 usage
175 ;;
176 esac
177 ;;
178
179 g[iu]t)
180 COMMAND=$2
181 shift 2
182 case "$COMMAND" in
183 update|pull)
184 git_pull $*
185 ;;
186 commit|ci)
187 git_commit $*
188 ;;
189 dist|export|archive)
190 git_export $*
191 ;;
192 push)
193 git_push $*
194 ;;
195 diff|di)
196 git_diff $*
197 ;;
198 log)
199 git_log $*
200 ;;
201 put-key)
202 ssh_cert $*
203 ;;
204 *) # If no command matches run git directly
205 git $*
206 ;;
207 esac
208 ;;
209
210 *)
211 usage
212 ;;
213
214 esac