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 | #(
|
---|
65 | #cat << EOF
|
---|
66 | # config META_$META_PKG
|
---|
67 | # bool "$(echo ${PKG_NAME} | tr [a-z] [A-Z]) components"
|
---|
68 | #EOF
|
---|
69 | #) >> $outFile
|
---|
70 | echo -e "menu \"$(echo ${PKG_NAME} | tr [a-z] [A-Z]) components\"" >> $outFile
|
---|
71 | # Include the dependency data for this meta package
|
---|
72 | while [ 0 ]; do
|
---|
73 | read || break 1
|
---|
74 | PKG_NAME=${REPLY}
|
---|
75 | get_pkg_ver "${PKG_NAME}"
|
---|
76 | (
|
---|
77 | cat << EOF
|
---|
78 | config DEP_${META_PKG}_${PKG_NAME}
|
---|
79 | # depends META_${META_PKG}
|
---|
80 | bool "$PKG_NAME ${PKG_VER}"
|
---|
81 | default y
|
---|
82 |
|
---|
83 | EOF
|
---|
84 | ) >> $outFile
|
---|
85 | done <./libs/${PKG_NAME}.dep
|
---|
86 | echo -e "endmenu" >> $outFile
|
---|
87 | continue
|
---|
88 | fi
|
---|
89 | [[ "${SET_COMMENT}" = "y" ]] && echo "comment \"--\"" >>$outFile; unset SET_COMMENT
|
---|
90 |
|
---|
91 | # Deal with a few unusable chapter names
|
---|
92 | case ${PKG_NAME} in
|
---|
93 | other-* | others-* ) continue
|
---|
94 | ;;
|
---|
95 | xorg7-* ) # Deal with sub-elements of Xorg7, mandatory for build.
|
---|
96 | # No need to (even possible?) to build separately
|
---|
97 | continue
|
---|
98 | ;;
|
---|
99 | esac
|
---|
100 |
|
---|
101 | # IF this package name-version exists in the tracking dir
|
---|
102 | # do not add this package to the list of installable pkgs.
|
---|
103 | get_pkg_ver "${PKG_NAME}"
|
---|
104 | if [ -e $TRACKING_DIR/${PKG_NAME}-${PKG_VER} ]; then continue; fi
|
---|
105 |
|
---|
106 | IFS="/"
|
---|
107 | DIR_TREE=(${PKG_DIR})
|
---|
108 | IFS="$SAVE_IFS"
|
---|
109 |
|
---|
110 | # Define a top level menu
|
---|
111 | if [ "$PREV_DIR1" != "${DIR_TREE[1]}" ]; then
|
---|
112 | [[ "${DIR_TREE[1]}" = "kde" ]] && continue
|
---|
113 | [[ "${DIR_TREE[1]}" = "gnome" ]] && continue
|
---|
114 |
|
---|
115 | if [ $MENU_SET1 = "y" ]; then
|
---|
116 | # Close out any open secondary menu
|
---|
117 | if [ $MENU_SET2 = "y" ]; then
|
---|
118 | echo -e "\tendmenu" >> $outFile
|
---|
119 | # Reset 'menu open' flag
|
---|
120 | MENU_SET2="n"
|
---|
121 | fi
|
---|
122 | # Close the current top level menu
|
---|
123 | echo -e "endmenu\n" >> $outFile
|
---|
124 | fi
|
---|
125 | # Open a new top level menu
|
---|
126 | echo -e "menu "$(echo ${DIR_TREE[1]:0:1} | tr [a-z] [A-Z])${DIR_TREE[1]:1}"" >> $outFile
|
---|
127 | MENU_SET1="y"
|
---|
128 | fi
|
---|
129 |
|
---|
130 | # Define a secondary menu
|
---|
131 | if [ "$PREV_DIR2" != "${DIR_TREE[2]}" ]; then
|
---|
132 | # Close out the previous open menu structure
|
---|
133 | if [ $MENU_SET2 = "y" ]; then
|
---|
134 | echo -e "\tendmenu\n" >> $outFile
|
---|
135 | fi
|
---|
136 | # Initialize a new 2nd level menu structure.
|
---|
137 | echo -e "\tmenu "$(echo ${DIR_TREE[2]:0:1} | tr [a-z] [A-Z])${DIR_TREE[2]:1}"" >> $outFile
|
---|
138 | MENU_SET2="y"
|
---|
139 | fi
|
---|
140 | (
|
---|
141 | cat << EOF
|
---|
142 | config CONFIG_$PKG_NAME
|
---|
143 | bool "$PKG_NAME ${PKG_VER}"
|
---|
144 | default n
|
---|
145 | EOF
|
---|
146 | ) >> $outFile
|
---|
147 |
|
---|
148 | PREV_DIR1=${DIR_TREE[1]}
|
---|
149 | PREV_DIR2=${DIR_TREE[2]}
|
---|
150 | done <"$inFile"
|
---|
151 |
|
---|
152 | if [ $MENU_SET2 = "y" ]; then echo -e "\tendmenu" >> $outFile; fi
|
---|
153 | if [ $MENU_SET1 = "y" ]; then echo "endmenu" >> $outFile; fi
|
---|
154 |
|
---|
155 | (
|
---|
156 | cat << EOF
|
---|
157 | comment "Default packages for resolving dependencies"
|
---|
158 |
|
---|
159 | choice
|
---|
160 | prompt "Default print server"
|
---|
161 | config PS_cups
|
---|
162 | bool "cups"
|
---|
163 | config PS_LPRng
|
---|
164 | bool "LPRng"
|
---|
165 | endchoice
|
---|
166 | config PRINT_SERVER
|
---|
167 | string
|
---|
168 | default cups if PS_cups
|
---|
169 | default LPRng if PS_LPRng
|
---|
170 | choice
|
---|
171 | prompt "Mail server"
|
---|
172 | config MS_sendmail
|
---|
173 | bool "sendmail'
|
---|
174 | config MS_postfix
|
---|
175 | bool "postfix"
|
---|
176 | config MS_exim"
|
---|
177 | bool "exim"
|
---|
178 | endchoice
|
---|
179 | config MAIL_SERVER
|
---|
180 | string
|
---|
181 | default sendmail if MS_sendmail
|
---|
182 | default postfix if MS_postfix
|
---|
183 | default exim if MS_exim
|
---|
184 |
|
---|
185 | choice
|
---|
186 | prompt "Postscript package"
|
---|
187 | config GS_espgs
|
---|
188 | bool "espgs"
|
---|
189 | config GS_ghostscript
|
---|
190 | bool "ghostscript"
|
---|
191 | endchoice
|
---|
192 | config GHOSTSCRIPT
|
---|
193 | string
|
---|
194 | default espgs if GS_espgs
|
---|
195 | default ghostscript if GS_ghostscript
|
---|
196 |
|
---|
197 | choice
|
---|
198 | prompt "Kerberos 5"
|
---|
199 | config KER_mitkrb
|
---|
200 | bool "mitkrb"
|
---|
201 | config KER_heimdal
|
---|
202 | bool "heimdal"
|
---|
203 | endchoice
|
---|
204 | config KBR5
|
---|
205 | string
|
---|
206 | default heimdal if KER_heimdal
|
---|
207 | default mitkrb if KER_mitkrb
|
---|
208 |
|
---|
209 | choice
|
---|
210 | prompt "Window package
|
---|
211 | config WIN_xorg7
|
---|
212 | bool "Xorg7"
|
---|
213 | config WIN_xorg
|
---|
214 | bool "Xorg"
|
---|
215 | config WIN_xfree86
|
---|
216 | bool "xfree86"
|
---|
217 | endchoice
|
---|
218 | config X11
|
---|
219 | string
|
---|
220 | default xorg7 if WIN_xorg7
|
---|
221 | default xorg if WIN_xorg
|
---|
222 | default xfree86 if WIN_xfree86
|
---|
223 |
|
---|
224 | comment "--"
|
---|
225 |
|
---|
226 | choice
|
---|
227 | prompt "Select dependency level"
|
---|
228 | default DEP_2
|
---|
229 |
|
---|
230 | config DEP_1
|
---|
231 | bool "Required dependencies only"
|
---|
232 |
|
---|
233 | config DEP_2
|
---|
234 | bool "Required and recommended dependencies"
|
---|
235 |
|
---|
236 | config DEP_3
|
---|
237 | bool "Required, recommended and optional dependencies"
|
---|
238 |
|
---|
239 | endchoice
|
---|
240 |
|
---|
241 | config optDependency
|
---|
242 | int
|
---|
243 | default 1 if DEP_1
|
---|
244 | default 2 if DEP_2
|
---|
245 | default 3 if DEP_3
|
---|
246 |
|
---|
247 |
|
---|
248 | config SUDO
|
---|
249 | bool "Build as User"
|
---|
250 | default y
|
---|
251 | help
|
---|
252 | Select if sudo will be used (you want build as a normal user)
|
---|
253 | otherwise sudo is not needed (you want build as root)
|
---|
254 |
|
---|
255 | EOF
|
---|
256 | ) >> $outFile
|
---|
257 |
|
---|
258 |
|
---|
259 |
|
---|