source: BLFS/gen_config.sh@ 8a8b55a

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

BLFS: added alternatives.conf parameters to gen_config.sh

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