2 |
mv_fox |
1 |
#!/bin/sh
|
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/'
|
|
|
11 |
REPOROOTNOSRC='/srv/www/svarog386.viste.fr/repos-nosrc/'
|
|
|
12 |
BUILDIDX='/root/fdnpkg-buildidx/buildidx'
|
11 |
mv_fox |
13 |
CDISODIR='/srv/www/svarog386.viste.fr/'
|
112 |
mv_fox |
14 |
CDISODIRTEST='/srv/www/svarog386.viste.fr/test/'
|
11 |
mv_fox |
15 |
CDROOT='/root/svarog386/cdroot'
|
16 |
mv_fox |
16 |
CDROOTNOSRC='/root/svarog386/cdrootnosrc'
|
24 |
mv_fox |
17 |
CDROOTMICRO='/root/svarog386/cdrootmicro'
|
44 |
mv_fox |
18 |
CUSTFILES='/root/svarog386/files'
|
2 |
mv_fox |
19 |
|
11 |
mv_fox |
20 |
### parameters block ends here ##############################################
|
|
|
21 |
|
112 |
mv_fox |
22 |
TESTMODE=0
|
|
|
23 |
if [ "x$1" = "xprod" ]; then
|
|
|
24 |
TESTMODE=0
|
|
|
25 |
elif [ "x$1" = "xtest" ]; then
|
|
|
26 |
TESTMODE=1
|
|
|
27 |
CDISODIR="$CDISODIRTEST"
|
|
|
28 |
mkdir -p "$CDISODIR"
|
|
|
29 |
else
|
|
|
30 |
echo "usage: build.sh prod|test"
|
|
|
31 |
exit 1
|
|
|
32 |
fi
|
|
|
33 |
|
11 |
mv_fox |
34 |
# remember where we are, so we can return there once all is done
|
|
|
35 |
origdir=`pwd`
|
|
|
36 |
|
16 |
mv_fox |
37 |
# clone the repositories into future 'no source' versions
|
|
|
38 |
echo "cloning $REPOROOT to $REPOROOTNOSRC..."
|
|
|
39 |
rsync -a --delete $REPOROOT $REPOROOTNOSRC
|
2 |
mv_fox |
40 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
16 |
mv_fox |
41 |
|
44 |
mv_fox |
42 |
# build the boot floppy image first
|
|
|
43 |
cp $CUSTFILES/bootmini.img $CDROOT/boot.img
|
52 |
mv_fox |
44 |
export MTOOLS_NO_VFAT=1
|
|
|
45 |
mcopy -sQm -i $CDROOT/boot.img $CUSTFILES/floppy/* ::/
|
44 |
mv_fox |
46 |
|
66 |
mv_fox |
47 |
# sync the boot.img file from full version to nosrc and micro, and publish it also stand-alone
|
16 |
mv_fox |
48 |
cp $CDROOT/boot.img $CDROOTNOSRC/
|
2 |
mv_fox |
49 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
24 |
mv_fox |
50 |
cp $CDROOT/boot.img $CDROOTMICRO/
|
|
|
51 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
66 |
mv_fox |
52 |
cp $CDROOT/boot.img $CDISODIR/
|
|
|
53 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
16 |
mv_fox |
54 |
|
|
|
55 |
# now strip the sources from the 'no source' clone
|
|
|
56 |
find $REPOROOTNOSRC/ -iname '*.zip' -exec zip "{}" -d "SOURCE/*" ';'
|
|
|
57 |
find $REPOROOTNOSRC/ -iname '*.zip' -exec zip "{}" -d "source/*" ';'
|
|
|
58 |
find $REPOROOTNOSRC/ -iname '*.zip' -exec zip "{}" -d "Source/*" ';'
|
|
|
59 |
|
|
|
60 |
# refresh all repositories
|
52 |
mv_fox |
61 |
$BUILDIDX $REPOROOT/core && $BUILDIDX $REPOROOTNOSRC/core
|
2 |
mv_fox |
62 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
16 |
mv_fox |
63 |
$BUILDIDX $REPOROOT/devel && $BUILDIDX $REPOROOTNOSRC/devel
|
2 |
mv_fox |
64 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
16 |
mv_fox |
65 |
$BUILDIDX $REPOROOT/drivers && $BUILDIDX $REPOROOTNOSRC/drivers
|
2 |
mv_fox |
66 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
16 |
mv_fox |
67 |
$BUILDIDX $REPOROOT/edit && $BUILDIDX $REPOROOTNOSRC/edit
|
2 |
mv_fox |
68 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
16 |
mv_fox |
69 |
$BUILDIDX $REPOROOT/emulatrs && $BUILDIDX $REPOROOTNOSRC/emulatrs
|
2 |
mv_fox |
70 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
16 |
mv_fox |
71 |
$BUILDIDX $REPOROOT/games && $BUILDIDX $REPOROOTNOSRC/games
|
2 |
mv_fox |
72 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
16 |
mv_fox |
73 |
$BUILDIDX $REPOROOT/net && $BUILDIDX $REPOROOTNOSRC/net
|
2 |
mv_fox |
74 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
16 |
mv_fox |
75 |
$BUILDIDX $REPOROOT/packers && $BUILDIDX $REPOROOTNOSRC/packers
|
|
|
76 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
|
|
77 |
$BUILDIDX $REPOROOT/sound && $BUILDIDX $REPOROOTNOSRC/sound
|
|
|
78 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
|
|
79 |
$BUILDIDX $REPOROOT/util && $BUILDIDX $REPOROOTNOSRC/util
|
|
|
80 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
2 |
mv_fox |
81 |
|
25 |
mv_fox |
82 |
# recompute the listing.txt file
|
|
|
83 |
rm $CDISODIR/listing.txt
|
52 |
mv_fox |
84 |
cat $REPOROOT/core/listing.txt >> $CDISODIR/listing.txt
|
25 |
mv_fox |
85 |
cat $REPOROOT/devel/listing.txt >> $CDISODIR/listing.txt
|
|
|
86 |
cat $REPOROOT/drivers/listing.txt >> $CDISODIR/listing.txt
|
|
|
87 |
cat $REPOROOT/edit/listing.txt >> $CDISODIR/listing.txt
|
|
|
88 |
cat $REPOROOT/emulatrs/listing.txt >> $CDISODIR/listing.txt
|
|
|
89 |
cat $REPOROOT/games/listing.txt >> $CDISODIR/listing.txt
|
|
|
90 |
cat $REPOROOT/net/listing.txt >> $CDISODIR/listing.txt
|
|
|
91 |
cat $REPOROOT/packers/listing.txt >> $CDISODIR/listing.txt
|
|
|
92 |
cat $REPOROOT/sound/listing.txt >> $CDISODIR/listing.txt
|
|
|
93 |
cat $REPOROOT/util/listing.txt >> $CDISODIR/listing.txt
|
|
|
94 |
|
16 |
mv_fox |
95 |
# compute a filename for the ISO files and build it
|
|
|
96 |
DATESTAMP=`date +%Y%m%d-%H%M`
|
|
|
97 |
CDISO="$CDISODIR/svarog386-full-$DATESTAMP.iso"
|
|
|
98 |
CDISONOSRC="$CDISODIR/svarog386-nosrc-$DATESTAMP.iso"
|
24 |
mv_fox |
99 |
CDISOMICRO="$CDISODIR/svarog386-micro-$DATESTAMP.iso"
|
63 |
mv_fox |
100 |
genisoimage -input-charset cp437 -b boot.img -iso-level 1 -f -V SVAROG386 -o $CDISO.tmp $CDROOT
|
11 |
mv_fox |
101 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
63 |
mv_fox |
102 |
genisoimage -input-charset cp437 -b boot.img -iso-level 1 -f -V SVAROG386 -o $CDISONOSRC.tmp $CDROOTNOSRC
|
16 |
mv_fox |
103 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
63 |
mv_fox |
104 |
genisoimage -input-charset cp437 -b boot.img -iso-level 1 -f -V SVAROG386 -o $CDISOMICRO.tmp $CDROOTMICRO
|
24 |
mv_fox |
105 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
11 |
mv_fox |
106 |
mv $CDISO.tmp $CDISO
|
16 |
mv_fox |
107 |
mv $CDISONOSRC.tmp $CDISONOSRC
|
24 |
mv_fox |
108 |
mv $CDISOMICRO.tmp $CDISOMICRO
|
2 |
mv_fox |
109 |
|
16 |
mv_fox |
110 |
# compute the MD5 of the ISO files, taking care to include only the filename in it
|
|
|
111 |
echo "computing md5 sums..."
|
11 |
mv_fox |
112 |
cd `dirname $CDISO`
|
|
|
113 |
md5sum `basename $CDISO` > $CDISO.md5
|
|
|
114 |
|
16 |
mv_fox |
115 |
cd `dirname $CDISONOSRC`
|
|
|
116 |
md5sum `basename $CDISONOSRC` > $CDISONOSRC.md5
|
|
|
117 |
|
24 |
mv_fox |
118 |
cd `dirname $CDISOMICRO`
|
|
|
119 |
md5sum `basename $CDISOMICRO` > $CDISOMICRO.md5
|
|
|
120 |
|
26 |
mv_fox |
121 |
# delete all *.iso and *.md5 files, leaving only the 16 most recent
|
|
|
122 |
echo "cleaning up old versions..."
|
|
|
123 |
ls -tp $CDISODIR/svarog386-*-*.iso* | tail -n +17 | xargs -I {} rm -- {}
|
|
|
124 |
|
11 |
mv_fox |
125 |
cd "$origdir"
|
|
|
126 |
|
16 |
mv_fox |
127 |
echo "all done!"
|
|
|
128 |
|
2 |
mv_fox |
129 |
exit 0
|