source: BLFS/gen_config.sh@ 5743d54

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

Let gen_config.sh to get package version from packages database.

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