source: BLFS/gen_config.sh@ ba72197

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

Fixed typo.

  • Property mode set to 100755
File size: 5.8 KB
Line 
1#!/bin/bash
2#
3# $Id$
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
50 if [ -n "${PKG_VER}" ] && [ "x${PKG_VER}" = "x${INST_VER}" ]; then
51 continue
52 fi
53 # Set installed version for updated meta-packages
54 [ -n "${INST_VER}" ] && INST_STRING="[installed ${INST_VER}]"
55
56 META_PKG=$(echo ${PKG_NAME} | tr [a-z] [A-Z])
57(
58cat << EOF
59 config CONFIG_$META_PKG
60 bool "$META_PKG $PKG_VER $INST_STRING"
61 default n
62
63 menu "$(echo ${PKG_NAME} | tr [a-z] [A-Z]) components"
64 depends CONFIG_$META_PKG
65
66EOF
67) >> $outFile
68
69 unset INST_STRING
70
71 # Include the dependency data for this meta package
72 while [ 0 ]; do
73 read || break 1
74 PKG_NAME=${REPLY}
75 PKG_VER=$(grep "^${PKG_NAME}[[:space:]]" $inFile | cut -f3)
76 INST_VER=$(grep "^${PKG_NAME}[[:space:]]" $inFile | cut -f4)
77 # Skip installed meta-package components
78 if [ -n "${PKG_VER}" ] && [ "x${PKG_VER}" = "x${INST_VER}" ]; then
79 continue
80 fi
81 # Set installed version for updated meta-packages components
82 [ -n "${INST_VER}" ] && INST_STRING="[installed ${INST_VER}]"
83(
84cat << EOF
85 config DEP_${META_PKG}_${PKG_NAME}
86 bool "$PKG_NAME ${PKG_VER} ${INST_STRING}"
87 default y
88
89EOF
90) >> $outFile
91 unset INST_STRING
92 done <./libs/${PKG_NAME}.dep
93 echo -e "endmenu" >> $outFile
94 continue
95 fi
96 [[ "${SET_COMMENT}" = "y" ]] && echo "comment \"\"" >>$outFile; unset SET_COMMENT
97
98 # Deal with a few unusable (at target level) package names
99 case ${PKG_NAME} in
100 xorg7-* ) continue ;;
101 alsa-* ) continue ;;
102 x-config | x-setup ) continue ;;
103 esac
104
105 # Skip installed packages
106 if [ -n "${PKG_VER}" ] && [ "x${PKG_VER}" = "x${INST_VER}" ]; then
107 continue
108 fi
109 # Set installed version for updated packages
110 [ -n "${INST_VER}" ] && INST_STRING="[installed ${INST_VER}]"
111
112 IFS="/"
113 DIR_TREE=(${PKG_DIR})
114 IFS="$SAVE_IFS"
115
116 # Define a top level menu
117 if [ "$PREV_DIR1" != "${DIR_TREE[1]}" ]; then
118 [[ "${DIR_TREE[1]}" = "kde" ]] && continue
119 [[ "${DIR_TREE[1]}" = "gnome" ]] && continue
120
121 if [ $MENU_SET1 = "y" ]; then
122 # Close out any open secondary menu
123 if [ $MENU_SET2 = "y" ]; then
124 echo -e "\tendmenu" >> $outFile
125 # Reset 'menu open' flag
126 MENU_SET2="n"
127 fi
128 # Close the current top level menu
129 echo -e "endmenu\n" >> $outFile
130 fi
131 # Open a new top level menu
132 echo -e "menu "$(echo ${DIR_TREE[1]:0:1} | tr [a-z] [A-Z])${DIR_TREE[1]:1}"" >> $outFile
133 MENU_SET1="y"
134 fi
135
136 # Define a secondary menu
137 if [ "$PREV_DIR2" != "${DIR_TREE[2]}" ]; then
138 # Close out the previous open menu structure
139 if [ $MENU_SET2 = "y" ]; then
140 echo -e "\tendmenu\n" >> $outFile
141 fi
142 # Initialize a new 2nd level menu structure.
143 echo -e "\tmenu "$(echo ${DIR_TREE[2]:0:1} | tr [a-z] [A-Z])${DIR_TREE[2]:1}"" >> $outFile
144 MENU_SET2="y"
145 fi
146(
147cat << EOF
148 config CONFIG_$PKG_NAME
149 bool "$PKG_NAME ${PKG_VER} ${INST_STRING}"
150 default n
151EOF
152) >> $outFile
153
154 unset INST_STRING
155
156 PREV_DIR1=${DIR_TREE[1]}
157 PREV_DIR2=${DIR_TREE[2]}
158done <"$inFile"
159
160if [ $MENU_SET2 = "y" ]; then echo -e "\tendmenu" >> $outFile; fi
161if [ $MENU_SET1 = "y" ]; then echo "endmenu" >> $outFile; fi
162
163(
164cat << EOF
165
166comment ""
167
168menu "Default packages for resolving dependencies"
169
170choice
171 prompt "Default print server"
172 config PS_cups
173 bool "cups"
174 config PS_LPRng
175 bool "LPRng"
176endchoice
177config PRINT_SERVER
178 string
179 default cups if PS_cups
180 default LPRng if PS_LPRng
181
182choice
183 prompt "Mail server"
184 config MS_sendmail
185 bool "sendmail"
186 config MS_postfix
187 bool "postfix"
188 config MS_exim
189 bool "exim"
190endchoice
191config MAIL_SERVER
192 string
193 default sendmail if MS_sendmail
194 default postfix if MS_postfix
195 default exim if MS_exim
196
197choice
198 prompt "Postscript package"
199 config GS_espgs
200 bool "espgs"
201 config GS_ghostscript
202 bool "ghostscript"
203endchoice
204config GHOSTSCRIPT
205 string
206 default espgs if GS_espgs
207 default ghostscript if GS_ghostscript
208
209choice
210 prompt "Kerberos 5"
211 config KER_mitkrb
212 bool "mitkrb"
213 config KER_heimdal
214 bool "heimdal"
215endchoice
216config KBR5
217 string
218 default heimdal if KER_heimdal
219 default mitkrb if KER_mitkrb
220
221choice
222 prompt "Window package"
223 config WIN_xorg7
224 bool "Xorg7"
225 config WIN_xorg
226 bool "Xorg"
227 config WIN_xfree86
228 bool "xfree86"
229endchoice
230config X11
231 string
232 default xorg7 if WIN_xorg7
233 default xorg if WIN_xorg
234 default xfree86 if WIN_xfree86
235endmenu
236
237choice
238 prompt "Dependency level"
239 default DEPLVL_2
240
241 config DEPLVL_1
242 bool "Required dependencies only"
243
244 config DEPLVL_2
245 bool "Required and recommended dependencies"
246
247 config DEPLVL_3
248 bool "Required, recommended and optional dependencies"
249
250endchoice
251config optDependency
252 int
253 default 1 if DEPLVL_1
254 default 2 if DEPLVL_2
255 default 3 if DEPLVL_3
256
257
258config SUDO
259 bool "Build as User"
260 default y
261 help
262 Select if sudo will be used (you want build as a normal user)
263 otherwise sudo is not needed (you want build as root)
264EOF
265) >> $outFile
266echo "done"
267
268
Note: See TracBrowser for help on using the repository browser.