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