134 |
mv_fox |
1 |
#!/bin/bash
|
11 |
mv_fox |
2 |
#
|
|
|
3 |
# This script generates indexes of Svarog386 repositories and builds the ISO
|
|
|
4 |
# CD images. It should be executed each time that a package file have been
|
|
|
5 |
# modified, added or removed from any of the repositories.
|
|
|
6 |
#
|
2 |
mv_fox |
7 |
|
11 |
mv_fox |
8 |
### parameters block starts here ############################################
|
|
|
9 |
|
112 |
mv_fox |
10 |
REPOROOT='/srv/www/svarog386.viste.fr/repos/'
|
134 |
mv_fox |
11 |
REPOROOTSRC='/srv/www/svarog386.viste.fr/repos-src/'
|
112 |
mv_fox |
12 |
REPOROOTNOSRC='/srv/www/svarog386.viste.fr/repos-nosrc/'
|
|
|
13 |
BUILDIDX='/root/fdnpkg-buildidx/buildidx'
|
11 |
mv_fox |
14 |
CDISODIR='/srv/www/svarog386.viste.fr/'
|
112 |
mv_fox |
15 |
CDISODIRTEST='/srv/www/svarog386.viste.fr/test/'
|
11 |
mv_fox |
16 |
CDROOT='/root/svarog386/cdroot'
|
16 |
mv_fox |
17 |
CDROOTNOSRC='/root/svarog386/cdrootnosrc'
|
24 |
mv_fox |
18 |
CDROOTMICRO='/root/svarog386/cdrootmicro'
|
44 |
mv_fox |
19 |
CUSTFILES='/root/svarog386/files'
|
2 |
mv_fox |
20 |
|
11 |
mv_fox |
21 |
### parameters block ends here ##############################################
|
|
|
22 |
|
134 |
mv_fox |
23 |
# function to be called with the repository (short) name as argument
|
|
|
24 |
function dorepo {
|
|
|
25 |
repodir=$1
|
|
|
26 |
# switch to repo's dir
|
|
|
27 |
cd $REPOROOT/$repodir
|
|
|
28 |
# duplicate all zip files as zib
|
|
|
29 |
for f in *.zip
|
|
|
30 |
do
|
|
|
31 |
cp -p $f `basename -s .zip $f`.zib
|
|
|
32 |
done
|
|
|
33 |
# now strip the sources from the 'zib' versions
|
|
|
34 |
find $REPOROOT/$repodir -iname '*.zib' -exec zip "{}" -d "SOURCE/*" ';'
|
|
|
35 |
find $REPOROOT/$repodir -iname '*.zib' -exec zip "{}" -d "source/*" ';'
|
|
|
36 |
find $REPOROOT/$repodir -iname '*.zib' -exec zip "{}" -d "Source/*" ';'
|
|
|
37 |
|
|
|
38 |
# build idx for the full (net) repo
|
|
|
39 |
$BUILDIDX $REPOROOT/$repodir
|
|
|
40 |
# copy listing into the global listing
|
|
|
41 |
cat $REPOROOT/$repodir/listing.txt >> $CDISODIR/listing.txt
|
|
|
42 |
|
|
|
43 |
# compute links for the 'no source' version
|
|
|
44 |
mkdir -p $REPOROOTNOSRC/$repodir
|
|
|
45 |
cd $REPOROOTNOSRC/$repodir
|
|
|
46 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
|
|
47 |
rm *.zip *.zib
|
|
|
48 |
for f in $REPOROOT/$repodir/*.zib
|
|
|
49 |
do
|
|
|
50 |
ln -s "$f" `basename -s .zib $f`.zip
|
|
|
51 |
done
|
|
|
52 |
# build idx for the 'no source' version
|
|
|
53 |
$BUILDIDX $REPOROOTNOSRC/$repodir
|
|
|
54 |
|
|
|
55 |
# compute links for the 'with source' (but no zib) version
|
|
|
56 |
mkdir -p $REPOROOTSRC/$repodir
|
|
|
57 |
cd $REPOROOTSRC/$repodir
|
|
|
58 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
|
|
59 |
rm *.zip *.zib
|
|
|
60 |
for f in $REPOROOT/$repodir/*.zip
|
|
|
61 |
do
|
|
|
62 |
ln -s "$f" `basename $f`
|
|
|
63 |
done
|
|
|
64 |
# build idx for the 'no source' version
|
|
|
65 |
$BUILDIDX $REPOROOTSRC/$repodir
|
|
|
66 |
}
|
|
|
67 |
|
|
|
68 |
### actual code flow starts here ############################################
|
|
|
69 |
|
|
|
70 |
|
112 |
mv_fox |
71 |
TESTMODE=0
|
|
|
72 |
if [ "x$1" = "xprod" ]; then
|
|
|
73 |
TESTMODE=0
|
|
|
74 |
elif [ "x$1" = "xtest" ]; then
|
|
|
75 |
TESTMODE=1
|
|
|
76 |
CDISODIR="$CDISODIRTEST"
|
|
|
77 |
mkdir -p "$CDISODIR"
|
|
|
78 |
else
|
|
|
79 |
echo "usage: build.sh prod|test"
|
|
|
80 |
exit 1
|
|
|
81 |
fi
|
|
|
82 |
|
11 |
mv_fox |
83 |
# remember where we are, so we can return there once all is done
|
|
|
84 |
origdir=`pwd`
|
|
|
85 |
|
44 |
mv_fox |
86 |
# build the boot floppy image first
|
|
|
87 |
cp $CUSTFILES/bootmini.img $CDROOT/boot.img
|
52 |
mv_fox |
88 |
export MTOOLS_NO_VFAT=1
|
|
|
89 |
mcopy -sQm -i $CDROOT/boot.img $CUSTFILES/floppy/* ::/
|
44 |
mv_fox |
90 |
|
66 |
mv_fox |
91 |
# sync the boot.img file from full version to nosrc and micro, and publish it also stand-alone
|
16 |
mv_fox |
92 |
cp $CDROOT/boot.img $CDROOTNOSRC/
|
2 |
mv_fox |
93 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
24 |
mv_fox |
94 |
cp $CDROOT/boot.img $CDROOTMICRO/
|
|
|
95 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
66 |
mv_fox |
96 |
cp $CDROOT/boot.img $CDISODIR/
|
|
|
97 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
16 |
mv_fox |
98 |
|
134 |
mv_fox |
99 |
# remove the 'human' listing (will be regenerated in a short moment)
|
|
|
100 |
rm $CDISODIR/listing.txt
|
16 |
mv_fox |
101 |
|
134 |
mv_fox |
102 |
# process all repos (also builds the listing.txt file)
|
|
|
103 |
dorepo core
|
|
|
104 |
dorepo devel
|
|
|
105 |
dorepo drivers
|
|
|
106 |
dorepo edit
|
|
|
107 |
dorepo emulatrs
|
|
|
108 |
dorepo games
|
|
|
109 |
dorepo net
|
|
|
110 |
dorepo packers
|
|
|
111 |
dorepo sound
|
|
|
112 |
dorepo util
|
2 |
mv_fox |
113 |
|
25 |
mv_fox |
114 |
|
16 |
mv_fox |
115 |
# compute a filename for the ISO files and build it
|
|
|
116 |
DATESTAMP=`date +%Y%m%d-%H%M`
|
|
|
117 |
CDISO="$CDISODIR/svarog386-full-$DATESTAMP.iso"
|
|
|
118 |
CDISONOSRC="$CDISODIR/svarog386-nosrc-$DATESTAMP.iso"
|
24 |
mv_fox |
119 |
CDISOMICRO="$CDISODIR/svarog386-micro-$DATESTAMP.iso"
|
63 |
mv_fox |
120 |
genisoimage -input-charset cp437 -b boot.img -iso-level 1 -f -V SVAROG386 -o $CDISO.tmp $CDROOT
|
11 |
mv_fox |
121 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
63 |
mv_fox |
122 |
genisoimage -input-charset cp437 -b boot.img -iso-level 1 -f -V SVAROG386 -o $CDISONOSRC.tmp $CDROOTNOSRC
|
16 |
mv_fox |
123 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
63 |
mv_fox |
124 |
genisoimage -input-charset cp437 -b boot.img -iso-level 1 -f -V SVAROG386 -o $CDISOMICRO.tmp $CDROOTMICRO
|
24 |
mv_fox |
125 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
11 |
mv_fox |
126 |
mv $CDISO.tmp $CDISO
|
16 |
mv_fox |
127 |
mv $CDISONOSRC.tmp $CDISONOSRC
|
24 |
mv_fox |
128 |
mv $CDISOMICRO.tmp $CDISOMICRO
|
2 |
mv_fox |
129 |
|
16 |
mv_fox |
130 |
# compute the MD5 of the ISO files, taking care to include only the filename in it
|
|
|
131 |
echo "computing md5 sums..."
|
11 |
mv_fox |
132 |
cd `dirname $CDISO`
|
|
|
133 |
md5sum `basename $CDISO` > $CDISO.md5
|
|
|
134 |
|
16 |
mv_fox |
135 |
cd `dirname $CDISONOSRC`
|
|
|
136 |
md5sum `basename $CDISONOSRC` > $CDISONOSRC.md5
|
|
|
137 |
|
24 |
mv_fox |
138 |
cd `dirname $CDISOMICRO`
|
|
|
139 |
md5sum `basename $CDISOMICRO` > $CDISOMICRO.md5
|
|
|
140 |
|
26 |
mv_fox |
141 |
# delete all *.iso and *.md5 files, leaving only the 16 most recent
|
|
|
142 |
echo "cleaning up old versions..."
|
|
|
143 |
ls -tp $CDISODIR/svarog386-*-*.iso* | tail -n +17 | xargs -I {} rm -- {}
|
|
|
144 |
|
11 |
mv_fox |
145 |
cd "$origdir"
|
|
|
146 |
|
16 |
mv_fox |
147 |
echo "all done!"
|
|
|
148 |
|
2 |
mv_fox |
149 |
exit 0
|