source: BLFS/gen_config.sh@ d66cbc2

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

Fixed typo.

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