source: BLFS/gen_config.sh@ 5f14bd3

experimental
Last change on this file since 5f14bd3 was 86f740c, checked in by George Boudreau <georgeb@…>, 18 years ago

Remove unecessary code

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