1 | #!/bin/bash
|
---|
2 | #
|
---|
3 | # $Id$
|
---|
4 | #
|
---|
5 | set -e
|
---|
6 |
|
---|
7 | #-----------------------#
|
---|
8 | get_pkg_ver() { # Find package version for a given package ID
|
---|
9 | #-----------------------#
|
---|
10 | local pkg_id=$1
|
---|
11 |
|
---|
12 | case ${pkg_id} in
|
---|
13 | # ALSA packages version
|
---|
14 | alsa* ) pkg_id=alsa ;;
|
---|
15 |
|
---|
16 | # KDE packages version
|
---|
17 | kdevelop ) : ;;
|
---|
18 | kde*config ) : ;;
|
---|
19 | kde* ) pkg_id=kde ;;
|
---|
20 |
|
---|
21 | # Xorg7 packages version
|
---|
22 | xorg7-server ) pkg_id=xorg-server ;;
|
---|
23 | xterm2 ) pkg_id=xterm ;;
|
---|
24 | xorg7* ) pkg_id=xorg7 ;;
|
---|
25 |
|
---|
26 | # Others (ID value don't match entity name)
|
---|
27 | wireless_tools ) pkg_id=wireless-tools ;;
|
---|
28 | bind-utils ) pkg_id=bind ;;
|
---|
29 | html-tidy ) pkg_id=tidy ;;
|
---|
30 | jdk ) pkg_id=jdk-src ;;
|
---|
31 | reiserfs ) pkg_id=reiser ;;
|
---|
32 | xfs ) pkg_id=xfsprogs ;;
|
---|
33 | esac
|
---|
34 |
|
---|
35 | xmllint --noent ./blfs-xml/book/bookinfo.xml 2>/dev/null | \
|
---|
36 | grep -i " ${pkg_id}-version " | cut -d "\"" -f2
|
---|
37 |
|
---|
38 | }
|
---|
39 |
|
---|
40 | #-----------------------#
|
---|
41 | generate_packages() { # Master packages file
|
---|
42 | #-----------------------#
|
---|
43 | local pkg_id file pkg_ver
|
---|
44 | local ALSA_VER GNOME_VER GNOME_MINOR_VER KDE_VER KDE_KOFFICE_VER XORG7_VER
|
---|
45 |
|
---|
46 | > packages.tmp
|
---|
47 |
|
---|
48 | # Extract Id and path for sect1 files
|
---|
49 | for file in `find $BLFS_XML -name "*.xml"` ; do
|
---|
50 | pkg_id=$(grep "sect1 id" $file | sed -e 's/<sect1 id="//;s/".*//')
|
---|
51 | pkg_ver=$(get_pkg_ver $pkg_id)
|
---|
52 | [[ ! -z "$pkg_id" ]] && echo -e "$pkg_id\t$file\t$pkg_ver" >> packages.tmp
|
---|
53 | done
|
---|
54 |
|
---|
55 | # IDs clean-up (unuseful pages or commented-out packages, could be more)
|
---|
56 | sed -i '/template/d;/ntroduction/d;/preface/d;/alsa.xml/d' packages.tmp
|
---|
57 | sed -i '/obsolete/d;/postlfs-/d;/-client.xml/d;/xorg7.xml/d' packages.tmp
|
---|
58 | sed -i '/courier.xml/d;/-other\t/d;/others-/d;/other-/d' packages.tmp
|
---|
59 | sed -i '/fw-firewall\t/d;/gcc2\t/d;/cvsserver\t/d;/svnserver\t/d' packages.tmp
|
---|
60 | sed -i '/fam\t/d;/libungif\t/d;/ncpfs\t/d;/slrn\t/d;/konq\t/d' packages.tmp
|
---|
61 | sed -i '/gst-plugins\t/d;/openquicktime\t/d;/compressdoc\t/d' packages.tmp
|
---|
62 |
|
---|
63 | # Meta-packages version
|
---|
64 | ALSA_VER=$(get_pkg_ver alsa)
|
---|
65 | GNOME_VER=$(get_pkg_ver gnome)
|
---|
66 | GNOME_MINOR_VER=$(get_pkg_ver gnome-minor)
|
---|
67 | KDE_VER=$(get_pkg_ver kde)
|
---|
68 | KDE_KOFFICE_VER=$(get_pkg_ver koffice)
|
---|
69 | XORG7_VER=$(get_pkg_ver xorg7)
|
---|
70 |
|
---|
71 | # Add header with meta-packages pseudo Id
|
---|
72 | {
|
---|
73 | cat << EOF
|
---|
74 | alsa $BLFS_XML $ALSA_VER
|
---|
75 | gnome-core $BLFS_XML $GNOME_VER$GNOME_MINOR_VER
|
---|
76 | gnome-full $BLFS_XML $GNOME_VER$GNOME_MINOR_VER
|
---|
77 | kde-core $BLFS_XML $KDE_VER
|
---|
78 | kde-full $BLFS_XML $KDE_VER
|
---|
79 | kde-koffice $BLFS_XML $KDE_KOFFICE_VER
|
---|
80 | xorg7 $BLFS_XML $XORG7_VER
|
---|
81 | EOF
|
---|
82 | } >> packages.tmp
|
---|
83 |
|
---|
84 | # Dump packages list
|
---|
85 | sort packages.tmp -b --key=2 --field-separator=/ --output=packages
|
---|
86 |
|
---|
87 | # Clean up
|
---|
88 | rm packages.tmp
|
---|
89 | }
|
---|
90 |
|
---|
91 | # Pre-made *.dep files for meta-packages
|
---|
92 |
|
---|
93 | #--------------------------#
|
---|
94 | generate_gnome_core() { # GNOME core
|
---|
95 | #--------------------------#
|
---|
96 | local line base_xml package
|
---|
97 |
|
---|
98 | > gnome-core.dep.tmp
|
---|
99 |
|
---|
100 | for line in `grep "xi:include" $BLFS_XML/gnome/core/core.xml` ; do
|
---|
101 | base_xml=`echo $line | sed 's/^.*href="//;s/".*//'`
|
---|
102 | package=`grep "gnome/core/$base_xml" packages | cut -f1`
|
---|
103 | [[ -n "$package" ]] && echo $package >> gnome-core.dep.tmp
|
---|
104 | done
|
---|
105 |
|
---|
106 | # Replace dummy packages with the proper ones
|
---|
107 | sed -i 's/GNOME-//g' gnome-core.dep.tmp
|
---|
108 |
|
---|
109 | tac gnome-core.dep.tmp > libs/gnome-core.dep
|
---|
110 | rm gnome-core.dep.tmp
|
---|
111 | }
|
---|
112 |
|
---|
113 | #--------------------------#
|
---|
114 | generate_gnome_full() { # GNOME full
|
---|
115 | #--------------------------#
|
---|
116 | local line base_xml package
|
---|
117 |
|
---|
118 | echo "gnome-core" > gnome-full.dep.tmp
|
---|
119 |
|
---|
120 | for line in `grep "xi:include" $BLFS_XML/gnome/add/add.xml` ; do
|
---|
121 | base_xml=`echo $line | sed 's/^.*href="//;s/".*//'`
|
---|
122 | package=`grep "gnome/add/$base_xml" packages | cut -f1`
|
---|
123 | [[ -n "$package" ]] && echo $package >> gnome-full.dep.tmp
|
---|
124 | done
|
---|
125 |
|
---|
126 | tac gnome-full.dep.tmp > libs/gnome-full.dep
|
---|
127 | rm gnome-full.dep.tmp
|
---|
128 | }
|
---|
129 |
|
---|
130 | #--------------------------#
|
---|
131 | generate_kde_core() { # KDE core
|
---|
132 | #--------------------------#
|
---|
133 | local line base_xml package
|
---|
134 |
|
---|
135 | > kde-core.dep.tmp
|
---|
136 |
|
---|
137 | for line in `grep "xi:include" $BLFS_XML/kde/core/core.xml` ; do
|
---|
138 | base_xml=`echo $line | sed 's/^.*href="//;s/".*//'`
|
---|
139 | package=`grep "kde/core/$base_xml" packages | cut -f1`
|
---|
140 | [[ -n "$package" ]] && echo $package >> kde-core.dep.tmp
|
---|
141 | done
|
---|
142 |
|
---|
143 | tac kde-core.dep.tmp > libs/kde-core.dep
|
---|
144 | rm kde-core.dep.tmp
|
---|
145 | }
|
---|
146 |
|
---|
147 | #--------------------------#
|
---|
148 | generate_kde_full() { # KDE full
|
---|
149 | #--------------------------#
|
---|
150 | local line base_xml package
|
---|
151 |
|
---|
152 | echo "kde-core" > kde-full.dep.tmp
|
---|
153 |
|
---|
154 | for line in `grep "xi:include" $BLFS_XML/kde/add/add.xml` ; do
|
---|
155 | base_xml=`echo $line | sed 's/^.*href="//;s/".*//'`
|
---|
156 | package=`grep "kde/add/$base_xml" packages | cut -f1`
|
---|
157 | [[ -n "$package" ]] && echo $package >> kde-full.dep.tmp
|
---|
158 | done
|
---|
159 |
|
---|
160 | for line in `grep "xi:include" $BLFS_XML/kde/devel/devel.xml` ; do
|
---|
161 | base_xml=`echo $line | sed 's/^.*href="//;s/".*//'`
|
---|
162 | package=`grep "kde/devel/$base_xml" packages | cut -f1`
|
---|
163 | [[ -n "$package" ]] && echo $package >> kde-full.dep.tmp
|
---|
164 | done
|
---|
165 |
|
---|
166 | tac kde-full.dep.tmp > libs/kde-full.dep
|
---|
167 | rm kde-full.dep.tmp
|
---|
168 | }
|
---|
169 |
|
---|
170 | #--------------------------#
|
---|
171 | generate_kde_koffice() { # KDE full + Koffice
|
---|
172 | #--------------------------#
|
---|
173 | echo -e "koffice\nkde-full\nkde-core" > libs/kde-koffice.dep
|
---|
174 | }
|
---|
175 |
|
---|
176 | #--------------------------#
|
---|
177 | generate_alsa() { # ALSA packages
|
---|
178 | #--------------------------#
|
---|
179 | echo -e "alsa-oss\nalsa-firmware\nalsa-tools\nalsa-utils\n\
|
---|
180 | alsa-plugins\nalsa-lib" > libs/alsa.dep
|
---|
181 | }
|
---|
182 |
|
---|
183 | #--------------------------#
|
---|
184 | generate_xorg7() { # Xorg7 packages
|
---|
185 | #--------------------------#
|
---|
186 | echo -e "x-config\nx-setup\nrman\nxterm2\nxorg7-driver\nxorg7-server\nluit\n\
|
---|
187 | xorg7-font\nxorg7-data\nxorg7-app\nxbitmaps\nmesalib\nlibdrm\n\
|
---|
188 | xorg7-lib\nxorg7-util\nxorg7-proto" > libs/xorg7.dep
|
---|
189 | }
|
---|