source: BLFS/gen_config.sh@ 7d888a4

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

Changes to display appearance (gen_config.sh)

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