source: BLFS/gen_config.sh@ bc40917

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

Making use off installed version from packages database.
Not full tested yet.

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