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