source: BLFS/gen_config.sh@ 69d25ea

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

Typo fix.

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