1 |
#!/bin/sh |
2 |
|
3 |
distname='SME Server' |
4 |
distvers=$(basename $(readlink -f $(pwd))) |
5 |
distrel=${distvers:0:1} |
6 |
distarch=$(uname -i) |
7 |
|
8 |
exec < /dev/null |
9 |
exec &> build_installer.$distarch |
10 |
|
11 |
if ! [ -d $distarch ] |
12 |
then |
13 |
echo "No $distarch directory?" |
14 |
exit 1 |
15 |
fi |
16 |
|
17 |
rm -rf $(pwd)/$distarch/{images,isolinux} $(pwd)/$distarch/SME/base/{hdlist*,*.img} |
18 |
|
19 |
if [ "$distrel" == "7" ] |
20 |
then |
21 |
PYTHONPATH=/usr/lib/anaconda/ /usr/lib/anaconda-runtime/genhdlist \ |
22 |
--productpath SME \ |
23 |
--withnumbers \ |
24 |
$(pwd)/$distarch/ |
25 |
|
26 |
PYTHONPATH=/usr/lib/anaconda/ /usr/lib/anaconda-runtime/pkgorder \ |
27 |
--product SME \ |
28 |
$(pwd)/$distarch \ |
29 |
$distarch > pkgorder.$distarch |
30 |
|
31 |
for PKG in /build/smeserver/repo/$distrel/smeextras/$distarch/RPMS/*.rpm |
32 |
do |
33 |
PKGFILE=$(basename $PKG) |
34 |
if [ ! -f $(pwd)/$distarch/SME/RPMS/$PKGFILE ] |
35 |
then |
36 |
ln -sf $PKG $(pwd)/$distarch/SME/RPMS/ |
37 |
fi |
38 |
done |
39 |
|
40 |
PYTHONPATH=/usr/lib/anaconda/ sudo /usr/lib/anaconda-runtime/buildinstall \ |
41 |
--product "$distname" \ |
42 |
--version "${distvers/[^0-9.]*/}" \ |
43 |
--release "$distname" \ |
44 |
--prodpath SME \ |
45 |
--pkgorder pkgorder.$distarch \ |
46 |
$(pwd)/$distarch/ |
47 |
|
48 |
sed -i 's@1,2,3@1@' $(pwd)/$distarch/.discinfo |
49 |
elif [ "$distrel" == "8" ] |
50 |
then |
51 |
for PKG in /build/smeserver/repo/$distrel/smeextras/$distarch/RPMS/*.rpm |
52 |
do |
53 |
PKGFILE=$(basename $PKG) |
54 |
if [ ! -f $(pwd)/$distarch/SME/$PKGFILE ] |
55 |
then |
56 |
ln -sf $PKG $(pwd)/$distarch/SME/ |
57 |
fi |
58 |
done |
59 |
|
60 |
cp /usr/lib/anaconda-runtime/mk-images* . |
61 |
sed -i -e 's/count=12/count=15/' mk-images.* |
62 |
sed -e "/installforallkernels/ised -i 's|\\\\(enabled\\\\) = 1|\\\\1 = 0|' \$DEST/etc/yum/pluginconf.d/kmod.conf" \ |
63 |
-e 's|^usr/\(.*/libz.*\)|&\n\1|' /usr/lib/anaconda-runtime/upd-instroot > upd-instroot |
64 |
chmod 644 mk-images.* |
65 |
chmod 755 mk-images upd-instroot |
66 |
sudo chown root:root mk-images* upd-instroot |
67 |
|
68 |
PYTHONPATH=/usr/lib/anaconda/ sudo /usr/lib/anaconda-runtime/buildinstall \ |
69 |
--product "$distname" \ |
70 |
--version "${distvers/[^0-9.]*/}" \ |
71 |
--release "$distname" \ |
72 |
--prodpath SME \ |
73 |
--bugurl http://bugs.contribs.org/ \ |
74 |
$(pwd)/$distarch/ |
75 |
sed -i 's/ALL/1/' $distarch/.discinfo |
76 |
|
77 |
sudo rm -rf $distarch/buildinstall.tree.*/ mk-images* upd-instroot |
78 |
elif [ "$distrel" == "9" ] |
79 |
then |
80 |
sed -e '/anaconda.repos.d/arm -f $DEST/etc/anaconda.repos.d/*' /usr/lib/anaconda-runtime/upd-instroot > upd-instroot |
81 |
chmod 755 upd-instroot |
82 |
sudo chown root:root upd-instroot |
83 |
|
84 |
rm -rf $(pwd)/$distarch/{repodata,repoview}/ |
85 |
mkdir -p $(pwd)/$distarch/repodata/ |
86 |
/bin/cp -af $(pwd)/$distarch/Packages/base/comps.xml $(pwd)/$distarch/repodata/ |
87 |
|
88 |
createrepo --quiet --database --skip-symlinks --simple-md-filenames --groupfile repodata/comps.xml $(pwd)/$distarch/ |
89 |
sync; rm -rf $(pwd)/$distarch/.olddata |
90 |
|
91 |
# add --final when we have final product |
92 |
PYTHONPATH=/usr/lib/anaconda/ sudo /usr/lib/anaconda-runtime/buildinstall \ |
93 |
--product "$distname" \ |
94 |
--version "${distvers/[^0-9.]*/}" \ |
95 |
--release "$distname" \ |
96 |
--brand "centos" \ |
97 |
--final \ |
98 |
--bugurl http://bugs.contribs.org/ \ |
99 |
--output $(pwd)/$distarch/ \ |
100 |
/build/smeserver/repo/testing/$distrel/smeextras/$distarch/ \ |
101 |
$(pwd)/$distarch/ |
102 |
/bin/sed -i -e "s|packagedir =.*|packagedir = Packages|" $(pwd)/$distarch/.treeinfo |
103 |
|
104 |
sudo rm -f awk ../pci.ids *-logos-*.rpm grub-*.rpm upd-instroot |
105 |
fi |
106 |
|
107 |
# Remove previous linked files |
108 |
find $(pwd)/$distarch/SME/ -type l | xargs rm -f |
109 |
|
110 |
# Copy updated isolinux files |
111 |
sudo cp -f /build/smeserver/stage/extra/isolinux/$distrel/* $(pwd)/$distarch/isolinux/ |
112 |
|
113 |
find $(pwd)/$distarch -\( -not -user 10020 -o -not -group 10020 -\) -print0 | sudo xargs -r0 chown 10020:10020 |
114 |
find $(pwd)/$distarch -\( -type f -not -perm -0664 -o -type d -not -perm -0775 -\) -print0 | sudo xargs -r0 chmod u+rwX,g+rwX,o+rX,o-w |
115 |
|
116 |
echo "You now need to run /build/smeserver/stage/bin/build_ISO as non-root" |
117 |
|
118 |
# That's it. |