source: BLFS/gen_config.sh@ 2d0a2e5

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

Making TRACKING_DIR a configurable value.

  • Property mode set to 100755
File size: 5.3 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
[2d0a2e5]9declare TRACKING_DIR=tracking-dir
[bc4a8dc]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
[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
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....
[c88f294]49 if [ -e $TRACKING_DIR/${PKG_NAME}-${PKG_VER} ]; then continue; fi
[69d25ea]50
[711f160]51 META_PKG=$(echo ${PKG_NAME} | tr [a-z] [A-Z])
[8b7df52]52 echo -e "config CONFIG_$META_PKG" >> $outFile
[c88f294]53 echo -e "\tbool \"$META_PKG $PKG_VER\"" >> $outFile
[8b7df52]54 echo -e "\tdefault n" >> $outFile
55
56 echo -e "menu \"$(echo ${PKG_NAME} | tr [a-z] [A-Z]) components\"" >> $outFile
[491e09b]57 echo -e "\tdepends\tCONFIG_$META_PKG" >> $outFile
[711f160]58 # Include the dependency data for this meta package
59 while [ 0 ]; do
60 read || break 1
[c88f294]61 PKG_NAME=${REPLY}
62 PKG_VER=$(grep "^$PKG_NAME[[:space:]]" $inFile | cut -f3)
[711f160]63(
64cat << EOF
65 config DEP_${META_PKG}_${PKG_NAME}
66 bool "$PKG_NAME ${PKG_VER}"
67 default y
68
69EOF
[ee8dc26]70) >> $outFile
[711f160]71 done <./libs/${PKG_NAME}.dep
72 echo -e "endmenu" >> $outFile
[bc4a8dc]73 continue
74 fi
[ee8dc26]75 [[ "${SET_COMMENT}" = "y" ]] && echo "comment \"\"" >>$outFile; unset SET_COMMENT
76
[ec12033]77 # Deal with a few unusable (at target level) package names
[bc4a8dc]78 case ${PKG_NAME} in
[ec12033]79 xorg7-* ) continue ;;
[8eb9b2d]80 alsa-* ) continue ;;
[ec12033]81 x-config | x-setup ) continue ;;
[bc4a8dc]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
[ee8dc26]87
[bc4a8dc]88 IFS="/"
89 DIR_TREE=(${PKG_DIR})
90 IFS="$SAVE_IFS"
91
[c88f294]92 # Define a top level menu
[bc4a8dc]93 if [ "$PREV_DIR1" != "${DIR_TREE[1]}" ]; then
[711f160]94 [[ "${DIR_TREE[1]}" = "kde" ]] && continue
95 [[ "${DIR_TREE[1]}" = "gnome" ]] && continue
[ee8dc26]96
97 if [ $MENU_SET1 = "y" ]; then
[bc4a8dc]98 # Close out any open secondary menu
[ee8dc26]99 if [ $MENU_SET2 = "y" ]; then
[bc4a8dc]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
[ee8dc26]109 MENU_SET1="y"
[bc4a8dc]110 fi
111
[c88f294]112 # Define a secondary menu
[bc4a8dc]113 if [ "$PREV_DIR2" != "${DIR_TREE[2]}" ]; then
114 # Close out the previous open menu structure
[ee8dc26]115 if [ $MENU_SET2 = "y" ]; then
[bc4a8dc]116 echo -e "\tendmenu\n" >> $outFile
117 fi
[ee8dc26]118 # Initialize a new 2nd level menu structure.
[bc4a8dc]119 echo -e "\tmenu "$(echo ${DIR_TREE[2]:0:1} | tr [a-z] [A-Z])${DIR_TREE[2]:1}"" >> $outFile
[ee8dc26]120 MENU_SET2="y"
[bc4a8dc]121 fi
122(
123cat << EOF
124 config CONFIG_$PKG_NAME
125 bool "$PKG_NAME ${PKG_VER}"
[ee8dc26]126 default n
[bc4a8dc]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
[7d888a4]139
140comment ""
141
142menu "Default packages for resolving dependencies"
[8a8b55a]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
[ee8dc26]154 default LPRng if PS_LPRng
[8b7df52]155
[8a8b55a]156choice
157 prompt "Mail server"
158 config MS_sendmail
[69d25ea]159 bool "sendmail"
[8a8b55a]160 config MS_postfix
161 bool "postfix"
[28c8973]162 config MS_exim
[8a8b55a]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"
[bcbf830]185 config KER_mitkrb
[8a8b55a]186 bool "mitkrb"
187 config KER_heimdal
[ee8dc26]188 bool "heimdal"
[8a8b55a]189endchoice
190config KBR5
191 string
192 default heimdal if KER_heimdal
193 default mitkrb if KER_mitkrb
194
195choice
[45bc8d6]196 prompt "Window package"
[8a8b55a]197 config WIN_xorg7
198 bool "Xorg7"
199 config WIN_xorg
200 bool "Xorg"
201 config WIN_xfree86
202 bool "xfree86"
[ee8dc26]203endchoice
[8a8b55a]204config X11
205 string
206 default xorg7 if WIN_xorg7
207 default xorg if WIN_xorg
208 default xfree86 if WIN_xfree86
[7d888a4]209endmenu
[8a8b55a]210
[ee8dc26]211choice
[8b7df52]212 prompt "Dependency level"
[b5effd5]213 default DEPLVL_2
[ee8dc26]214
[b5effd5]215 config DEPLVL_1
[8a8b55a]216 bool "Required dependencies only"
[ee8dc26]217
[b5effd5]218 config DEPLVL_2
[8a8b55a]219 bool "Required and recommended dependencies"
[ee8dc26]220
[b5effd5]221 config DEPLVL_3
[8a8b55a]222 bool "Required, recommended and optional dependencies"
[ee8dc26]223
[8a8b55a]224endchoice
225config optDependency
226 int
[b5effd5]227 default 1 if DEPLVL_1
228 default 2 if DEPLVL_2
229 default 3 if DEPLVL_3
[ee8dc26]230
231
[8a8b55a]232config SUDO
[bc4a8dc]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
[2d0a2e5]239config TRACKING_DIR
240 string
241 default $TRACKING_DIR
242
[bc4a8dc]243EOF
244) >> $outFile
[8eb9b2d]245echo "done"
[bc4a8dc]246
247
Note: See TracBrowser for help on using the repository browser.