1 |
#!/bin/sh
|
1 |
#!/bin/sh
|
2 |
#
|
2 |
#
|
3 |
# This script generates indexes of Svarog386 repositories and builds the ISO
|
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
|
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.
|
5 |
# modified, added or removed from any of the repositories.
|
6 |
#
|
6 |
#
|
7 |
|
7 |
|
8 |
### parameters block starts here ############################################
|
8 |
### parameters block starts here ############################################
|
9 |
|
9 |
|
10 |
REPOROOT=/srv/www/svarog386.viste.fr/repos/
|
10 |
REPOROOT=/srv/www/svarog386.viste.fr/repos/
|
11 |
REPOROOTNOSRC=/srv/www/svarog386.viste.fr/repos-nosrc/
|
11 |
REPOROOTNOSRC=/srv/www/svarog386.viste.fr/repos-nosrc/
|
12 |
BUILDIDX=/root/fdnpkg-buildidx/buildidx
|
12 |
BUILDIDX=/root/fdnpkg-buildidx/buildidx
|
13 |
CDISODIR='/srv/www/svarog386.viste.fr/'
|
13 |
CDISODIR='/srv/www/svarog386.viste.fr/'
|
14 |
CDROOT='/root/svarog386/cdroot'
|
14 |
CDROOT='/root/svarog386/cdroot'
|
15 |
CDROOTNOSRC='/root/svarog386/cdrootnosrc'
|
15 |
CDROOTNOSRC='/root/svarog386/cdrootnosrc'
|
16 |
CDROOTMICRO='/root/svarog386/cdrootmicro'
|
16 |
CDROOTMICRO='/root/svarog386/cdrootmicro'
|
17 |
|
17 |
|
18 |
### parameters block ends here ##############################################
|
18 |
### parameters block ends here ##############################################
|
19 |
|
19 |
|
20 |
# remember where we are, so we can return there once all is done
|
20 |
# remember where we are, so we can return there once all is done
|
21 |
origdir=`pwd`
|
21 |
origdir=`pwd`
|
22 |
|
22 |
|
23 |
# clone the repositories into future 'no source' versions
|
23 |
# clone the repositories into future 'no source' versions
|
24 |
echo "cloning $REPOROOT to $REPOROOTNOSRC..."
|
24 |
echo "cloning $REPOROOT to $REPOROOTNOSRC..."
|
25 |
rsync -a --delete $REPOROOT $REPOROOTNOSRC
|
25 |
rsync -a --delete $REPOROOT $REPOROOTNOSRC
|
26 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
26 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
27 |
|
27 |
|
28 |
# sync the boot.img file from full version to nosrc and micro
|
28 |
# sync the boot.img file from full version to nosrc and micro
|
29 |
cp $CDROOT/boot.img $CDROOTNOSRC/
|
29 |
cp $CDROOT/boot.img $CDROOTNOSRC/
|
30 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
30 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
31 |
cp $CDROOT/boot.img $CDROOTMICRO/
|
31 |
cp $CDROOT/boot.img $CDROOTMICRO/
|
32 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
32 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
33 |
|
33 |
|
34 |
# now strip the sources from the 'no source' clone
|
34 |
# now strip the sources from the 'no source' clone
|
35 |
find $REPOROOTNOSRC/ -iname '*.zip' -exec zip "{}" -d "SOURCE/*" ';'
|
35 |
find $REPOROOTNOSRC/ -iname '*.zip' -exec zip "{}" -d "SOURCE/*" ';'
|
36 |
find $REPOROOTNOSRC/ -iname '*.zip' -exec zip "{}" -d "source/*" ';'
|
36 |
find $REPOROOTNOSRC/ -iname '*.zip' -exec zip "{}" -d "source/*" ';'
|
37 |
find $REPOROOTNOSRC/ -iname '*.zip' -exec zip "{}" -d "Source/*" ';'
|
37 |
find $REPOROOTNOSRC/ -iname '*.zip' -exec zip "{}" -d "Source/*" ';'
|
38 |
|
38 |
|
39 |
# refresh all repositories
|
39 |
# refresh all repositories
|
40 |
$BUILDIDX $REPOROOT/base && $BUILDIDX $REPOROOTNOSRC/base
|
40 |
$BUILDIDX $REPOROOT/base && $BUILDIDX $REPOROOTNOSRC/base
|
41 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
41 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
42 |
$BUILDIDX $REPOROOT/devel && $BUILDIDX $REPOROOTNOSRC/devel
|
42 |
$BUILDIDX $REPOROOT/devel && $BUILDIDX $REPOROOTNOSRC/devel
|
43 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
43 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
44 |
$BUILDIDX $REPOROOT/drivers && $BUILDIDX $REPOROOTNOSRC/drivers
|
44 |
$BUILDIDX $REPOROOT/drivers && $BUILDIDX $REPOROOTNOSRC/drivers
|
45 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
45 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
46 |
$BUILDIDX $REPOROOT/edit && $BUILDIDX $REPOROOTNOSRC/edit
|
46 |
$BUILDIDX $REPOROOT/edit && $BUILDIDX $REPOROOTNOSRC/edit
|
47 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
47 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
48 |
$BUILDIDX $REPOROOT/emulatrs && $BUILDIDX $REPOROOTNOSRC/emulatrs
|
48 |
$BUILDIDX $REPOROOT/emulatrs && $BUILDIDX $REPOROOTNOSRC/emulatrs
|
49 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
49 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
50 |
$BUILDIDX $REPOROOT/games && $BUILDIDX $REPOROOTNOSRC/games
|
50 |
$BUILDIDX $REPOROOT/games && $BUILDIDX $REPOROOTNOSRC/games
|
51 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
51 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
52 |
$BUILDIDX $REPOROOT/net && $BUILDIDX $REPOROOTNOSRC/net
|
52 |
$BUILDIDX $REPOROOT/net && $BUILDIDX $REPOROOTNOSRC/net
|
53 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
53 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
54 |
$BUILDIDX $REPOROOT/packers && $BUILDIDX $REPOROOTNOSRC/packers
|
54 |
$BUILDIDX $REPOROOT/packers && $BUILDIDX $REPOROOTNOSRC/packers
|
55 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
55 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
56 |
$BUILDIDX $REPOROOT/sound && $BUILDIDX $REPOROOTNOSRC/sound
|
56 |
$BUILDIDX $REPOROOT/sound && $BUILDIDX $REPOROOTNOSRC/sound
|
57 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
57 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
58 |
$BUILDIDX $REPOROOT/util && $BUILDIDX $REPOROOTNOSRC/util
|
58 |
$BUILDIDX $REPOROOT/util && $BUILDIDX $REPOROOTNOSRC/util
|
59 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
59 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
60 |
|
60 |
|
61 |
# recompute the listing.txt file
|
61 |
# recompute the listing.txt file
|
62 |
rm $CDISODIR/listing.txt
|
62 |
rm $CDISODIR/listing.txt
|
63 |
cat $REPOROOT/base/listing.txt >> $CDISODIR/listing.txt
|
63 |
cat $REPOROOT/base/listing.txt >> $CDISODIR/listing.txt
|
64 |
cat $REPOROOT/devel/listing.txt >> $CDISODIR/listing.txt
|
64 |
cat $REPOROOT/devel/listing.txt >> $CDISODIR/listing.txt
|
65 |
cat $REPOROOT/drivers/listing.txt >> $CDISODIR/listing.txt
|
65 |
cat $REPOROOT/drivers/listing.txt >> $CDISODIR/listing.txt
|
66 |
cat $REPOROOT/edit/listing.txt >> $CDISODIR/listing.txt
|
66 |
cat $REPOROOT/edit/listing.txt >> $CDISODIR/listing.txt
|
67 |
cat $REPOROOT/emulatrs/listing.txt >> $CDISODIR/listing.txt
|
67 |
cat $REPOROOT/emulatrs/listing.txt >> $CDISODIR/listing.txt
|
68 |
cat $REPOROOT/games/listing.txt >> $CDISODIR/listing.txt
|
68 |
cat $REPOROOT/games/listing.txt >> $CDISODIR/listing.txt
|
69 |
cat $REPOROOT/net/listing.txt >> $CDISODIR/listing.txt
|
69 |
cat $REPOROOT/net/listing.txt >> $CDISODIR/listing.txt
|
70 |
cat $REPOROOT/packers/listing.txt >> $CDISODIR/listing.txt
|
70 |
cat $REPOROOT/packers/listing.txt >> $CDISODIR/listing.txt
|
71 |
cat $REPOROOT/sound/listing.txt >> $CDISODIR/listing.txt
|
71 |
cat $REPOROOT/sound/listing.txt >> $CDISODIR/listing.txt
|
72 |
cat $REPOROOT/util/listing.txt >> $CDISODIR/listing.txt
|
72 |
cat $REPOROOT/util/listing.txt >> $CDISODIR/listing.txt
|
73 |
|
73 |
|
74 |
# compute a filename for the ISO files and build it
|
74 |
# compute a filename for the ISO files and build it
|
75 |
DATESTAMP=`date +%Y%m%d-%H%M`
|
75 |
DATESTAMP=`date +%Y%m%d-%H%M`
|
76 |
CDISO="$CDISODIR/svarog386-full-$DATESTAMP.iso"
|
76 |
CDISO="$CDISODIR/svarog386-full-$DATESTAMP.iso"
|
77 |
CDISONOSRC="$CDISODIR/svarog386-nosrc-$DATESTAMP.iso"
|
77 |
CDISONOSRC="$CDISODIR/svarog386-nosrc-$DATESTAMP.iso"
|
78 |
CDISOMICRO="$CDISODIR/svarog386-micro-$DATESTAMP.iso"
|
78 |
CDISOMICRO="$CDISODIR/svarog386-micro-$DATESTAMP.iso"
|
79 |
genisoimage -input-charset cp437 -b boot.img -iso-level 1 -f -o $CDISO.tmp $CDROOT
|
79 |
genisoimage -input-charset cp437 -b boot.img -iso-level 1 -f -o $CDISO.tmp $CDROOT
|
80 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
80 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
81 |
genisoimage -input-charset cp437 -b boot.img -iso-level 1 -f -o $CDISONOSRC.tmp $CDROOTNOSRC
|
81 |
genisoimage -input-charset cp437 -b boot.img -iso-level 1 -f -o $CDISONOSRC.tmp $CDROOTNOSRC
|
82 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
82 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
83 |
genisoimage -input-charset cp437 -b boot.img -iso-level 1 -f -o $CDISOMICRO.tmp $CDROOTMICRO
|
83 |
genisoimage -input-charset cp437 -b boot.img -iso-level 1 -f -o $CDISOMICRO.tmp $CDROOTMICRO
|
84 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
84 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
85 |
mv $CDISO.tmp $CDISO
|
85 |
mv $CDISO.tmp $CDISO
|
86 |
mv $CDISONOSRC.tmp $CDISONOSRC
|
86 |
mv $CDISONOSRC.tmp $CDISONOSRC
|
87 |
mv $CDISOMICRO.tmp $CDISOMICRO
|
87 |
mv $CDISOMICRO.tmp $CDISOMICRO
|
88 |
|
88 |
|
89 |
# compute the MD5 of the ISO files, taking care to include only the filename in it
|
89 |
# compute the MD5 of the ISO files, taking care to include only the filename in it
|
90 |
echo "computing md5 sums..."
|
90 |
echo "computing md5 sums..."
|
91 |
cd `dirname $CDISO`
|
91 |
cd `dirname $CDISO`
|
92 |
md5sum `basename $CDISO` > $CDISO.md5
|
92 |
md5sum `basename $CDISO` > $CDISO.md5
|
93 |
|
93 |
|
94 |
cd `dirname $CDISONOSRC`
|
94 |
cd `dirname $CDISONOSRC`
|
95 |
md5sum `basename $CDISONOSRC` > $CDISONOSRC.md5
|
95 |
md5sum `basename $CDISONOSRC` > $CDISONOSRC.md5
|
96 |
|
96 |
|
97 |
cd `dirname $CDISOMICRO`
|
97 |
cd `dirname $CDISOMICRO`
|
98 |
md5sum `basename $CDISOMICRO` > $CDISOMICRO.md5
|
98 |
md5sum `basename $CDISOMICRO` > $CDISOMICRO.md5
|
99 |
|
99 |
|
- |
|
100 |
# delete all *.iso and *.md5 files, leaving only the 16 most recent
|
- |
|
101 |
echo "cleaning up old versions..."
|
- |
|
102 |
ls -tp $CDISODIR/svarog386-*-*.iso* | tail -n +17 | xargs -I {} rm -- {}
|
- |
|
103 |
|
100 |
cd "$origdir"
|
104 |
cd "$origdir"
|
101 |
|
105 |
|
102 |
echo "all done!"
|
106 |
echo "all done!"
|
103 |
|
107 |
|
104 |
exit 0
|
108 |
exit 0
|
105 |
|
109 |
|