]> git.ipfire.org Git - ipfire-3.x.git/blame - make.sh
make.sh: Add some more commands to make it easier.
[ipfire-3.x.git] / make.sh
CommitLineData
df5e82b3 1#!/bin/bash
60caa2d0
MT
2###############################################################################
3# #
4# IPFire.org - A linux based firewall #
5# Copyright (C) 2007, 2008, 2009 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###############################################################################
df5e82b3
MT
21#
22
166a6c21
MT
23BASEDIR=/ipfire-3.x
24
cee183e8 25. ${BASEDIR}/tools/common-include
166a6c21
MT
26
27while [ $# -gt 0 ]; do
28 case "${1}" in
29 --debug|-d)
30 DEBUG=1
31 log DEBUG "Debugging mode enabled by command line."
32 ;;
cee183e8
MT
33 --toolchain)
34 TOOLCHAIN=1
35 log DEBUG "Toolchain mode enabled by command line."
36 ;;
166a6c21
MT
37 *)
38 action=${1}
39 shift
40 break
41 ;;
42 esac
43 shift
44done
45
cee183e8
MT
46export DEBUG TOOLCHAIN
47
166a6c21
MT
48function package() {
49 local action=${1}
50 shift
51
52 case "${action}" in
53 dependencies|deps)
cee183e8
MT
54 echo -e "${BOLD}Build dependencies:${NORMAL} $(package_build_dependencies $@ | tr '\n' ' ')"
55 echo -e "${BOLD}Dependencies:${NORMAL} $(package_runtime_dependencies $@ | tr '\n' ' ')"
166a6c21
MT
56 ;;
57 find)
58 find_package $@
59 ;;
7cfd59ee
MT
60 is_built)
61 if package_is_built $(find_package $@); then
62 echo "Package is built."
e5a0c5bc 63 return 0
7cfd59ee
MT
64 else
65 echo "Package is NOT built."
e5a0c5bc 66 return 1
7cfd59ee
MT
67 fi
68 ;;
166a6c21 69 list)
cee183e8 70 package_list
166a6c21 71 ;;
7cfd59ee
MT
72 packages)
73 package_packages $(find_package $@)
74 ;;
166a6c21 75 profile|info)
cee183e8 76 package_profile $(find_package $@)
166a6c21
MT
77 ;;
78 _info)
79 package_info $(find_package $@)
80 ;;
81 esac
ca8da28e 82}
df5e82b3 83
166a6c21 84case "${action}" in
e5a0c5bc
MT
85 all)
86 for pkg in $(${NAOKI} tree); do
87 echo "${pkg}:"
88 package is_built ${pkg} && continue
89 ${NAOKI} build ${pkg} || break
90 done
91 ;;
92 build)
93 ${NAOKI} build $@
94 ;;
166a6c21 95 package|pkg)
7cfd59ee 96 package $@
166a6c21
MT
97 ;;
98 toolchain)
99 TOOLCHAIN=1
100 ${NAOKI} --toolchain tree
101 ;;
102 toolchain_build)
103 for i in $($0 toolchain); do
104 ${NAOKI} --toolchain toolchain ${i}
105 done
106 ;;
107 tree)
108 ${NAOKI} tree
109 ;;
456f92d2
MT
110 random)
111 pkgs=$(package_list)
112 while true; do
113 if [ -z "${pkgs}" ]; then
114 break
115 fi
116
117 pkgs=$(package_random ${pkgs})
118 pkg=$(awk '{print $NF }' <<<${pkgs})
119
120 ${NAOKI} build ${pkg}
121
122 pkgs=$(listremove ${pkg} ${pkgs})
123 done
124 ;;
166a6c21 125esac