source: BLFS/gen_config.sh@ 8b0d3b3

experimental
Last change on this file since 8b0d3b3 was ec12033, checked in by Manuel Canales Esparcia <manuel@…>, 18 years ago

Finished packages clean-up and version fixes.

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