1 |
#!/bin/sh |
2 |
|
3 |
distname='SME Server' |
4 |
disttag='smeserver' |
5 |
distvers=$(basename $(readlink -f $(pwd))) |
6 |
distrel=${distvers:0:1} |
7 |
distarch=$(uname -i) |
8 |
|
9 |
exec < /dev/null |
10 |
exec &> build_ISO.$distarch |
11 |
|
12 |
if ! [ -d $distarch ] |
13 |
then |
14 |
echo "No $distarch directory?" |
15 |
exit 1 |
16 |
fi |
17 |
|
18 |
# remove package that are no longer in the distro |
19 |
if [ "$distrel" == "7" ] |
20 |
then |
21 |
find -name 'qmail-workaround*' -print0 -o \ |
22 |
-name '*rkhunter*' -print0 \ |
23 |
| xargs -r0 rm |
24 |
fi |
25 |
|
26 |
for img in product updates |
27 |
do |
28 |
if [ "$distrel" == "7" ] |
29 |
then |
30 |
rm -f $(pwd)/$distarch/SME/base/comps.rpm |
31 |
cp -al $(pwd)/$distarch/SME/RPMS/comps-*.rpm $(pwd)/$distarch/SME/base/comps.rpm |
32 |
/usr/bin/mkcramfs \ |
33 |
$(pwd)/$distarch/$img \ |
34 |
$(pwd)/$distarch/SME/base/$img.img |
35 |
elif [ -d "$(pwd)/$distarch/$img" ] |
36 |
then |
37 |
/sbin/mksquashfs \ |
38 |
$(pwd)/$distarch/$img \ |
39 |
$(pwd)/$distarch/images/$img.img \ |
40 |
-all-root -no-fragments -noappend |
41 |
sudo chmod 664 $(pwd)/$distarch/images/$img.img |
42 |
fi |
43 |
done |
44 |
|
45 |
if [ "$distrel" == "7" ] |
46 |
then |
47 |
PYTHONPATH=/usr/lib/anaconda/ /usr/lib/anaconda-runtime/genhdlist \ |
48 |
--productpath SME \ |
49 |
--withnumbers \ |
50 |
$(pwd)/$distarch/ |
51 |
|
52 |
PYTHONPATH=/usr/lib/anaconda/ /usr/lib/anaconda-runtime/pkgorder \ |
53 |
--product SME \ |
54 |
$(pwd)/$distarch \ |
55 |
$distarch > pkgorder.$distarch |
56 |
|
57 |
PYTHONPATH=/usr/lib/anaconda/ /usr/lib/anaconda-runtime/genhdlist \ |
58 |
--productpath SME \ |
59 |
--withnumbers \ |
60 |
--fileorder pkgorder.$distarch \ |
61 |
$(pwd)/$distarch/ |
62 |
fi |
63 |
|
64 |
rm -f ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso ../iso/$distrel/$distarch/$disttag.iso |
65 |
rm -f ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.jigdo ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.template |
66 |
|
67 |
if [ "$distrel" == "7" ] |
68 |
then |
69 |
createrepo --update --database $(pwd)/$distarch/ |
70 |
else |
71 |
createrepo --update --database --groupfile repodata/comps.xml -u "media://$(head -1 $distarch/.discinfo)" $(pwd)/$distarch/ |
72 |
fi |
73 |
sync; rm -rf $(pwd)/$distarch/.olddata $(pwd)/$distarch/repodata/repoview $(pwd)/$distarch/repoview |
74 |
repoview $(pwd)/$distarch/ |
75 |
sync; rm -rf $(pwd)/$distarch/.repodata |
76 |
|
77 |
bootimg='isolinux/isolinux.bin' |
78 |
bootcat='isolinux/boot.cat' |
79 |
mkisopts='-v -U -J -r -T' |
80 |
today="$(date '+%d %b %Y')" |
81 |
mkisofs $mkisopts \ |
82 |
-V "$distname $distvers" \ |
83 |
-A "$distname created on $today" \ |
84 |
-b "$bootimg" \ |
85 |
-c "$bootcat" \ |
86 |
-no-emul-boot -boot-load-size 4 -boot-info-table \ |
87 |
-x lost+found -x product -x updates -x 'buildinstall.tree.*' -x CVS -x product -x updates \ |
88 |
-o ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso \ |
89 |
$(pwd)/$distarch/ |
90 |
|
91 |
/usr/lib/anaconda-runtime/implantisomd5 ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso |
92 |
dd if=/dev/zero bs=2048 count=150 >> ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso |
93 |
md5sum ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso | sed 's,\.\..*/,,' > ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso.md5sum |
94 |
sha1sum ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso | sed 's,\.\..*/,,' > ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso.sha1sum |
95 |
zsyncmake -u $disttag-$distvers-$distarch.iso -o ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso.zsync ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso |
96 |
mv ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso ../iso/$distrel/$distarch/$disttag.iso |
97 |
ln -sf $disttag.iso ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso |
98 |
|
99 |
rsync -a --delete --delete-excluded \ |
100 |
--exclude 'repodata/' --exclude 'product/' --exclude 'updates/' --exclude 'repoview/' \ |
101 |
--exclude 'lost+found/' --exclude 'CVS/' --exclude 'buildinstall.tree.*/' \ |
102 |
--link-dest=../$distarch/ $distarch/ $distarch.jigdo/ |
103 |
jigdo-file make-template --force \ |
104 |
-i ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso \ |
105 |
-j ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.jigdo \ |
106 |
-t ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.template \ |
107 |
--label SMEmirror=$distarch.jigdo/ \ |
108 |
--uri SMEmirror=http://mirror.contribs.org/releases/testing/$distrel/smeos/$distarch/ \ |
109 |
$distarch.jigdo// |
110 |
rm -rf $distarch.jigdo/ |
111 |
|
112 |
if [ -d SRPMS -a "$distarch" == "i386" ] |
113 |
then |
114 |
rm -f ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso ../iso/$distrel/source/$disttag-SRPMS.iso |
115 |
|
116 |
mkisofs $mkisopts \ |
117 |
-V "$distname $distvers SRPMS" \ |
118 |
-A "$distname SRPMS created on $today" \ |
119 |
-x lost+found -x product -x updates -x 'buildinstall.tree.*' -x CVS \ |
120 |
-o ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso \ |
121 |
--graft-points \ |
122 |
./SRPMS=SRPMS \ |
123 |
GPL=$distarch/GPL \ |
124 |
RPM-GPG-KEY-SMEServer=$distarch/RPM-GPG-KEY-SMEServer |
125 |
|
126 |
md5sum ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso | sed 's,\.\..*/,,' > ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso.md5sum |
127 |
sha1sum ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso | sed 's,\.\..*/,,' > ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso.sha1sum |
128 |
zsyncmake -u $disttag-$distvers-SRPMS.iso -o ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso.zsync ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso |
129 |
mv ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso ../iso/$distrel/source/$disttag-SRPMS.iso |
130 |
ln -sf $disttag-SRPMS.iso ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso |
131 |
|
132 |
jigdo-file make-template --force \ |
133 |
-i ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso \ |
134 |
-j ../iso/$distrel/source/$disttag-$distvers-SRPMS.jigdo \ |
135 |
-t ../iso/$distrel/source/$disttag-$distvers-SRPMS.template \ |
136 |
--label SMEmirror=SRPMS/ \ |
137 |
--uri SMEmirror=http://mirror.contribs.org/releases/testing/$distrel/smeos/SRPMS/ \ |
138 |
SRPMS// |
139 |
fi |
140 |
|
141 |
# That's it. |