1 | #!/bin/bash
|
---|
2 | #
|
---|
3 | # $Id$
|
---|
4 | #
|
---|
5 |
|
---|
6 | export outFile=Config.in # file for reading and writing to.
|
---|
7 | export inFile=packages # file for reading and writing to.
|
---|
8 |
|
---|
9 | declare PKG_NAME
|
---|
10 | declare PKG_XML_FILE
|
---|
11 | declare PKG_DIR
|
---|
12 | declare PKG_VER
|
---|
13 | declare INST_VER
|
---|
14 | declare SAVE_IFS=${IFS}
|
---|
15 | declare -a DIR_TREE
|
---|
16 | declare PREV_DIR1="none"
|
---|
17 | declare PREV_DIR2="none"
|
---|
18 | declare MENU_SET1="n"
|
---|
19 | declare MENU_SET2="n"
|
---|
20 |
|
---|
21 | > $outFile
|
---|
22 |
|
---|
23 | #---------------------#
|
---|
24 | # MAIN #
|
---|
25 | #---------------------#
|
---|
26 | : <<enddoc
|
---|
27 | This script will create a Config.in file from the contents
|
---|
28 | of the file <packages>.
|
---|
29 | Packages previously installed will not be included.
|
---|
30 | enddoc
|
---|
31 |
|
---|
32 | echo -en "\tGenerating Config.in from package data ..."
|
---|
33 | while [ 0 ]
|
---|
34 | do
|
---|
35 |
|
---|
36 | # read -r || break 1
|
---|
37 | read || break 1
|
---|
38 |
|
---|
39 | set -- $REPLY
|
---|
40 | PKG_NAME=$1
|
---|
41 | PKG_XML_FILE=$(basename $2)
|
---|
42 | PKG_DIR=$(dirname $2)
|
---|
43 | PKG_VER=$3
|
---|
44 | INST_VER=$4
|
---|
45 | # These are the META packages.
|
---|
46 | if [ $PKG_DIR = "." ]; then
|
---|
47 | SET_COMMENT=y
|
---|
48 | # Do not include previously installed packages....
|
---|
49 | if [ -n "${PKG_VER}" ] && [ "x${PKG_VER}" = "x${INST_VER}" ]; then
|
---|
50 | continue
|
---|
51 | fi
|
---|
52 |
|
---|
53 | META_PKG=$(echo ${PKG_NAME} | tr [a-z] [A-Z])
|
---|
54 | echo -e "config CONFIG_$META_PKG" >> $outFile
|
---|
55 | echo -e "\tbool \"$META_PKG $PKG_VER $INST_VER\"" >> $outFile
|
---|
56 | echo -e "\tdefault n" >> $outFile
|
---|
57 |
|
---|
58 | echo -e "menu \"$(echo ${PKG_NAME} | tr [a-z] [A-Z]) components\"" >> $outFile
|
---|
59 | echo -e "\tdepends\tCONFIG_$META_PKG" >> $outFile
|
---|
60 | # Include the dependency data for this meta package
|
---|
61 | while [ 0 ]; do
|
---|
62 | read || break 1
|
---|
63 | PKG_NAME=${REPLY}
|
---|
64 | PKG_VER=$(grep "^${PKG_NAME}[[:space:]]" $inFile | cut -f3)
|
---|
65 | INST_VER=$(grep "^${PKG_NAME}[[:space:]]" $inFile | cut -f4)
|
---|
66 | if [ -n "${PKG_VER}" ] && [ "x${PKG_VER}" = "x${INST_VER}" ]; then
|
---|
67 | continue
|
---|
68 | fi
|
---|
69 | (
|
---|
70 | cat << EOF
|
---|
71 | config DEP_${META_PKG}_${PKG_NAME}
|
---|
72 | bool "$PKG_NAME ${PKG_VER} ${INST_VER}"
|
---|
73 | default y
|
---|
74 |
|
---|
75 | EOF
|
---|
76 | ) >> $outFile
|
---|
77 | done <./libs/${PKG_NAME}.dep
|
---|
78 | echo -e "endmenu" >> $outFile
|
---|
79 | continue
|
---|
80 | fi
|
---|
81 | [[ "${SET_COMMENT}" = "y" ]] && echo "comment \"\"" >>$outFile; unset SET_COMMENT
|
---|
82 |
|
---|
83 | # Deal with a few unusable (at target level) package names
|
---|
84 | case ${PKG_NAME} in
|
---|
85 | xorg7-* ) continue ;;
|
---|
86 | alsa-* ) continue ;;
|
---|
87 | x-config | x-setup ) continue ;;
|
---|
88 | esac
|
---|
89 |
|
---|
90 | # IF this package name-version exists in the tracking dir
|
---|
91 | # do not add this package to the list of installable pkgs.
|
---|
92 | if [ -n "${PKG_VER}" ] && [ "x${PKG_VER}" = "x${INST_VER}" ]; then
|
---|
93 | continue
|
---|
94 | fi
|
---|
95 |
|
---|
96 | IFS="/"
|
---|
97 | DIR_TREE=(${PKG_DIR})
|
---|
98 | IFS="$SAVE_IFS"
|
---|
99 |
|
---|
100 | # Define a top level menu
|
---|
101 | if [ "$PREV_DIR1" != "${DIR_TREE[1]}" ]; then
|
---|
102 | [[ "${DIR_TREE[1]}" = "kde" ]] && continue
|
---|
103 | [[ "${DIR_TREE[1]}" = "gnome" ]] && continue
|
---|
104 |
|
---|
105 | if [ $MENU_SET1 = "y" ]; then
|
---|
106 | # Close out any open secondary menu
|
---|
107 | if [ $MENU_SET2 = "y" ]; then
|
---|
108 | echo -e "\tendmenu" >> $outFile
|
---|
109 | # Reset 'menu open' flag
|
---|
110 | MENU_SET2="n"
|
---|
111 | fi
|
---|
112 | # Close the current top level menu
|
---|
113 | echo -e "endmenu\n" >> $outFile
|
---|
114 | fi
|
---|
115 | # Open a new top level menu
|
---|
116 | echo -e "menu "$(echo ${DIR_TREE[1]:0:1} | tr [a-z] [A-Z])${DIR_TREE[1]:1}"" >> $outFile
|
---|
117 | MENU_SET1="y"
|
---|
118 | fi
|
---|
119 |
|
---|
120 | # Define a secondary menu
|
---|
121 | if [ "$PREV_DIR2" != "${DIR_TREE[2]}" ]; then
|
---|
122 | # Close out the previous open menu structure
|
---|
123 | if [ $MENU_SET2 = "y" ]; then
|
---|
124 | echo -e "\tendmenu\n" >> $outFile
|
---|
125 | fi
|
---|
126 | # Initialize a new 2nd level menu structure.
|
---|
127 | echo -e "\tmenu "$(echo ${DIR_TREE[2]:0:1} | tr [a-z] [A-Z])${DIR_TREE[2]:1}"" >> $outFile
|
---|
128 | MENU_SET2="y"
|
---|
129 | fi
|
---|
130 | (
|
---|
131 | cat << EOF
|
---|
132 | config CONFIG_$PKG_NAME
|
---|
133 | bool "$PKG_NAME ${PKG_VER} ${INST_VER}"
|
---|
134 | default n
|
---|
135 | EOF
|
---|
136 | ) >> $outFile
|
---|
137 |
|
---|
138 | PREV_DIR1=${DIR_TREE[1]}
|
---|
139 | PREV_DIR2=${DIR_TREE[2]}
|
---|
140 | done <"$inFile"
|
---|
141 |
|
---|
142 | if [ $MENU_SET2 = "y" ]; then echo -e "\tendmenu" >> $outFile; fi
|
---|
143 | if [ $MENU_SET1 = "y" ]; then echo "endmenu" >> $outFile; fi
|
---|
144 |
|
---|
145 | (
|
---|
146 | cat << EOF
|
---|
147 |
|
---|
148 | comment ""
|
---|
149 |
|
---|
150 | menu "Default packages for resolving dependencies"
|
---|
151 |
|
---|
152 | choice
|
---|
153 | prompt "Default print server"
|
---|
154 | config PS_cups
|
---|
155 | bool "cups"
|
---|
156 | config PS_LPRng
|
---|
157 | bool "LPRng"
|
---|
158 | endchoice
|
---|
159 | config PRINT_SERVER
|
---|
160 | string
|
---|
161 | default cups if PS_cups
|
---|
162 | default LPRng if PS_LPRng
|
---|
163 |
|
---|
164 | choice
|
---|
165 | prompt "Mail server"
|
---|
166 | config MS_sendmail
|
---|
167 | bool "sendmail"
|
---|
168 | config MS_postfix
|
---|
169 | bool "postfix"
|
---|
170 | config MS_exim
|
---|
171 | bool "exim"
|
---|
172 | endchoice
|
---|
173 | config MAIL_SERVER
|
---|
174 | string
|
---|
175 | default sendmail if MS_sendmail
|
---|
176 | default postfix if MS_postfix
|
---|
177 | default exim if MS_exim
|
---|
178 |
|
---|
179 | choice
|
---|
180 | prompt "Postscript package"
|
---|
181 | config GS_espgs
|
---|
182 | bool "espgs"
|
---|
183 | config GS_ghostscript
|
---|
184 | bool "ghostscript"
|
---|
185 | endchoice
|
---|
186 | config GHOSTSCRIPT
|
---|
187 | string
|
---|
188 | default espgs if GS_espgs
|
---|
189 | default ghostscript if GS_ghostscript
|
---|
190 |
|
---|
191 | choice
|
---|
192 | prompt "Kerberos 5"
|
---|
193 | config KER_mitkrb
|
---|
194 | bool "mitkrb"
|
---|
195 | config KER_heimdal
|
---|
196 | bool "heimdal"
|
---|
197 | endchoice
|
---|
198 | config KBR5
|
---|
199 | string
|
---|
200 | default heimdal if KER_heimdal
|
---|
201 | default mitkrb if KER_mitkrb
|
---|
202 |
|
---|
203 | choice
|
---|
204 | prompt "Window package"
|
---|
205 | config WIN_xorg7
|
---|
206 | bool "Xorg7"
|
---|
207 | config WIN_xorg
|
---|
208 | bool "Xorg"
|
---|
209 | config WIN_xfree86
|
---|
210 | bool "xfree86"
|
---|
211 | endchoice
|
---|
212 | config X11
|
---|
213 | string
|
---|
214 | default xorg7 if WIN_xorg7
|
---|
215 | default xorg if WIN_xorg
|
---|
216 | default xfree86 if WIN_xfree86
|
---|
217 | endmenu
|
---|
218 |
|
---|
219 | choice
|
---|
220 | prompt "Dependency level"
|
---|
221 | default DEPLVL_2
|
---|
222 |
|
---|
223 | config DEPLVL_1
|
---|
224 | bool "Required dependencies only"
|
---|
225 |
|
---|
226 | config DEPLVL_2
|
---|
227 | bool "Required and recommended dependencies"
|
---|
228 |
|
---|
229 | config DEPLVL_3
|
---|
230 | bool "Required, recommended and optional dependencies"
|
---|
231 |
|
---|
232 | endchoice
|
---|
233 | config optDependency
|
---|
234 | int
|
---|
235 | default 1 if DEPLVL_1
|
---|
236 | default 2 if DEPLVL_2
|
---|
237 | default 3 if DEPLVL_3
|
---|
238 |
|
---|
239 |
|
---|
240 | config SUDO
|
---|
241 | bool "Build as User"
|
---|
242 | default y
|
---|
243 | help
|
---|
244 | Select if sudo will be used (you want build as a normal user)
|
---|
245 | otherwise sudo is not needed (you want build as root)
|
---|
246 | EOF
|
---|
247 | ) >> $outFile
|
---|
248 | echo "done"
|
---|
249 |
|
---|
250 |
|
---|