source: BLFS/gen_config.sh@ 8b7df52

experimental
Last change on this file since 8b7df52 was 8b7df52, checked in by George Boudreau <georgeb@…>, 18 years ago

Updated gen_config.sh, added meta-package selection

  • Property mode set to 100755
File size: 5.7 KB
RevLine 
[bc4a8dc]1#!/bin/bash
2#
3# $Id:$
4#
5
6export outFile=aConfig.in # file for reading and writing to.
7export inFile=packages.sorted # 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
31sort packages -b --key=2 --field-separator=/ --output=packages.sorted
32
33> $outFile
34
35#---------------------#
36# MAIN #
37#---------------------#
38: <<enddoc
39 This script will create a Config.in file from the contents
40 of the file <packages>.
41 Packages previously installed will not be included.
42enddoc
43
44while [ 0 ]
45do
46
47# read -r || break 1
48 read || break 1
49 if [[ "${REPLY}" = "" ]] || \
50 [[ "${REPLY:0:1}" = "=" ]] || \
51 [[ "${REPLY:0:1}" = "#" ]]; then
52 continue
53 fi
54
55 set -- $REPLY
56 PKG_NAME=$1
57 PKG_XML_FILE=$(basename $2)
58 PKG_DIR=$(dirname $2)
[711f160]59 # These are the META packages. for gnome and kde (soon ALSA and Xorg7)
[bc4a8dc]60 if [ $PKG_DIR = "." ]; then
[711f160]61 SET_COMMENT=y
[8b7df52]62 # Do not include previously installed packages....
[bc4a8dc]63 if [ -e $TRACKING_DIR/${PKG_NAME} ]; then continue; fi
[8b7df52]64
[711f160]65 META_PKG=$(echo ${PKG_NAME} | tr [a-z] [A-Z])
[8b7df52]66 echo -e "config CONFIG_$META_PKG" >> $outFile
67 echo -e "\tbool \"$META_PKG\"" >> $outFile
68 echo -e "\tdefault n" >> $outFile
69
70 echo -e "menu \"$(echo ${PKG_NAME} | tr [a-z] [A-Z]) components\"" >> $outFile
71 echo -e "\tdepends\tCONFIG_$META_PKG\"" >> $outFile
[711f160]72 # Include the dependency data for this meta package
73 while [ 0 ]; do
74 read || break 1
75 PKG_NAME=${REPLY}
76 get_pkg_ver "${PKG_NAME}"
77(
78cat << EOF
79 config DEP_${META_PKG}_${PKG_NAME}
80 bool "$PKG_NAME ${PKG_VER}"
81 default y
82
83EOF
84) >> $outFile
85 done <./libs/${PKG_NAME}.dep
86 echo -e "endmenu" >> $outFile
[bc4a8dc]87 continue
88 fi
[7d888a4]89 [[ "${SET_COMMENT}" = "y" ]] && echo "comment \"\"" >>$outFile; unset SET_COMMENT
[711f160]90
[bc4a8dc]91 # Deal with a few unusable chapter names
92 case ${PKG_NAME} in
93 other-* | others-* ) continue
94 ;;
95 xorg7-* ) # Deal with sub-elements of Xorg7, mandatory for build.
96 # No need to (even possible?) to build separately
97 continue
98 ;;
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
[711f160]112 [[ "${DIR_TREE[1]}" = "kde" ]] && continue
113 [[ "${DIR_TREE[1]}" = "gnome" ]] && continue
114
[bc4a8dc]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
[7d888a4]157
158comment ""
159
160menu "Default packages for resolving dependencies"
[8a8b55a]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
[8b7df52]173
[8a8b55a]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"
[bcbf830]203 config KER_mitkrb
[8a8b55a]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
[7d888a4]227endmenu
[8a8b55a]228
229choice
[8b7df52]230 prompt "Dependency level"
[b5effd5]231 default DEPLVL_2
[8a8b55a]232
[b5effd5]233 config DEPLVL_1
[8a8b55a]234 bool "Required dependencies only"
235
[b5effd5]236 config DEPLVL_2
[8a8b55a]237 bool "Required and recommended dependencies"
238
[b5effd5]239 config DEPLVL_3
[8a8b55a]240 bool "Required, recommended and optional dependencies"
241
242endchoice
243config optDependency
244 int
[b5effd5]245 default 1 if DEPLVL_1
246 default 2 if DEPLVL_2
247 default 3 if DEPLVL_3
[8a8b55a]248
249
250config SUDO
[bc4a8dc]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
259
260
261
Note: See TracBrowser for help on using the repository browser.