source: BLFS/gen_config.sh@ e557f50

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

Let gen_config.sh to get package version from packages database.

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