source: BLFS/gen_config.sh@ 491e09b

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

Bug fix.

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