]>
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 | |
24 | } | |
25 | ||
ce85f613 MT |
26 | case "$1" in |
27 | build) | |
4ce0b818 | 28 | # check for prerequisites |
38e7c3ac | 29 | check_build |
cfccf561 MT |
30 | # compile the distro right now |
31 | build | |
8db8436b MT |
32 | # beeps when finished |
33 | echo -ne '\a' | |
ce85f613 | 34 | ;; |
38e7c3ac | 35 | |
ce85f613 MT |
36 | shell) |
37 | # enter a shell inside LFS chroot | |
38 | # may be used to change kernel settings | |
39 | prepareenv | |
40 | entershell | |
41 | ;; | |
cfccf561 MT |
42 | |
43 | batch) | |
44 | # build the distro in background | |
cfccf561 MT |
45 | case "$2" in |
46 | start) | |
94c4cae8 | 47 | batch_start $3 |
cfccf561 MT |
48 | ;; |
49 | _run) | |
50 | batch_run | |
51 | ;; | |
52 | attach|watch) | |
53 | batch_attach | |
54 | ;; | |
3349c6c9 MT |
55 | *) |
56 | usage | |
57 | ;; | |
cfccf561 MT |
58 | esac |
59 | ;; | |
60 | ||
61 | stats) | |
62 | # show some stats about the compiler(s) | |
cfccf561 MT |
63 | case "$2" in |
64 | ccache) | |
65 | ccache_stats | |
66 | ;; | |
67 | distcc) | |
68 | distcc_mon | |
69 | ;; | |
70 | esac | |
71 | ;; | |
38e7c3ac | 72 | |
ce85f613 MT |
73 | clean) |
74 | echo -ne "Cleaning ${BOLD}$MACHINE${NORMAL} buildtree" | |
ce85f613 | 75 | |
38e7c3ac | 76 | for i in $(mount | grep $BASEDIR | cut -d " " -f 1); do |
ce85f613 MT |
77 | umount $i |
78 | done | |
79 | ||
80 | stdumount | |
ce85f613 MT |
81 | |
82 | rm -rf $BASEDIR/build_${MACHINE} | |
83 | rm -rf $BASEDIR/log_${MACHINE} | |
84 | rm -rf $BASEDIR/packages | |
98be0467 | 85 | rm -f $FAILED $RUNNING 2>/dev/null |
ce85f613 MT |
86 | |
87 | if [ -h $TOOLS_DIR ]; then | |
88 | rm -f $TOOLS_DIR | |
89 | fi | |
90 | beautify message DONE | |
91 | ;; | |
38e7c3ac | 92 | |
da1befdd | 93 | source|src) |
fa0dac0f | 94 | LOGFILE=$BASEDIR/log_${MACHINE}/_build.00-preparation.log |
da1befdd MT |
95 | case "$2" in |
96 | get|pull|download) | |
97 | getsource | |
98 | ;; | |
99 | put|push|upload) | |
100 | putsource | |
101 | ;; | |
102 | esac | |
ce85f613 | 103 | ;; |
38e7c3ac | 104 | |
ce85f613 | 105 | toolchain) |
da1befdd MT |
106 | case "$2" in |
107 | get|pull|download) | |
108 | gettoolchain | |
109 | ;; | |
110 | put|push|upload) | |
111 | puttoolchain | |
112 | ;; | |
113 | "") | |
114 | prepareenv | |
115 | # Check if host can build the toolchain | |
116 | check_toolchain | |
b91fa051 | 117 | |
da1befdd | 118 | build_spy compiling |
b91fa051 | 119 | |
da1befdd | 120 | toolchain_build |
b91fa051 | 121 | |
da1befdd MT |
122 | stdumount |
123 | echo -ne "\ntarball creation " | |
124 | [ -d $BASEDIR/cache/toolchains ] || mkdir $BASEDIR/cache/toolchains | |
125 | cd $BASEDIR && tar cj --exclude='log_${MACHINE}/_build.*.log' \ | |
126 | --file=cache/toolchains/$TOOLCHAINNAME.tar.bz2 \ | |
127 | build_${MACHINE} log_${MACHINE} >> $LOGFILE | |
128 | beautify message DONE | |
129 | echo `ls -sh cache/toolchains/$TOOLCHAINNAME.tar.bz2` | |
130 | ||
131 | stdumount | |
38e7c3ac | 132 | |
da1befdd MT |
133 | build_spy idle |
134 | ;; | |
135 | *) | |
136 | usage | |
137 | ;; | |
138 | esac | |
ce85f613 | 139 | ;; |
bd4be397 MT |
140 | |
141 | check) | |
bd4be397 MT |
142 | check_sanity $2 |
143 | ;; | |
38e7c3ac | 144 | |
4b7f6462 | 145 | g[iu]t) |
4b7f6462 MT |
146 | COMMAND=$2 |
147 | shift 2 | |
148 | case "$COMMAND" in | |
0627b392 | 149 | update|pull) |
4b7f6462 | 150 | git_pull $* |
ce85f613 MT |
151 | ;; |
152 | commit|ci) | |
0627b392 | 153 | git_commit $* |
ce85f613 | 154 | ;; |
e4cff7fc | 155 | dist|export|archive) |
4b7f6462 | 156 | git_export $* |
e4cff7fc | 157 | ;; |
8e878964 | 158 | push) |
4b7f6462 | 159 | git_push $* |
8e878964 | 160 | ;; |
ce85f613 | 161 | diff|di) |
4b7f6462 | 162 | git_diff $* |
ce85f613 MT |
163 | ;; |
164 | log) | |
4b7f6462 | 165 | git_log $* |
ce85f613 | 166 | ;; |
3763394e | 167 | put-key) |
3763394e MT |
168 | ssh_cert $* |
169 | ;; | |
4b7f6462 MT |
170 | *) # If no command matches run git directly |
171 | git $* | |
172 | ;; | |
ce85f613 MT |
173 | esac |
174 | ;; | |
38e7c3ac | 175 | |
ce85f613 | 176 | *) |
3349c6c9 | 177 | usage |
ce85f613 | 178 | ;; |
38e7c3ac | 179 | |
ce85f613 | 180 | esac |