source: BLFS/gen_config.sh@ b533b78

2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since b533b78 was 69f2b81, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

BLFS: Typo fix.

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