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/`
|
162 |
mv_fox |
15 |
REPOROOTSRC=`realpath ./cdroot/`
|
|
|
16 |
REPOROOTNOSRC=`realpath ./cdrootnosrc/`
|
148 |
mv_fox |
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..."
|
162 |
mv_fox |
114 |
rm -r $CDISODIR/*
|
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`
|
162 |
mv_fox |
118 |
YEAR=`date +%Y`
|
|
|
119 |
|
|
|
120 |
mkdir -p "$CDISODIR/$YEAR"
|
|
|
121 |
|
|
|
122 |
CDISO="$CDISODIR/$YEAR/svarog386-$DATESTAMP-full.iso"
|
|
|
123 |
CDISONOSRC="$CDISODIR/$YEAR/svarog386-$DATESTAMP-nosrc.iso"
|
|
|
124 |
CDISOMICRO="$CDISODIR/$YEAR/svarog386-$DATESTAMP-micro.iso"
|
148 |
mv_fox |
125 |
genisoimage -input-charset cp437 -b boot.img -iso-level 1 -f -V SVAROG386 -o "$CDISO" "$CDROOT"
|
11 |
mv_fox |
126 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
148 |
mv_fox |
127 |
genisoimage -input-charset cp437 -b boot.img -iso-level 1 -f -V SVAROG386 -o "$CDISONOSRC" "$CDROOTNOSRC"
|
16 |
mv_fox |
128 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
148 |
mv_fox |
129 |
genisoimage -input-charset cp437 -b boot.img -iso-level 1 -f -V SVAROG386 -o "$CDISOMICRO" "$CDROOTMICRO"
|
24 |
mv_fox |
130 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
2 |
mv_fox |
131 |
|
16 |
mv_fox |
132 |
# compute the MD5 of the ISO files, taking care to include only the filename in it
|
|
|
133 |
echo "computing md5 sums..."
|
148 |
mv_fox |
134 |
cd `dirname "$CDISO"`
|
|
|
135 |
md5sum `basename "$CDISO"` > "$CDISO.md5"
|
|
|
136 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
11 |
mv_fox |
137 |
|
148 |
mv_fox |
138 |
cd `dirname "$CDISONOSRC"`
|
|
|
139 |
md5sum `basename "$CDISONOSRC"` > "$CDISONOSRC.md5"
|
|
|
140 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
16 |
mv_fox |
141 |
|
148 |
mv_fox |
142 |
cd `dirname "$CDISOMICRO"`
|
|
|
143 |
md5sum `basename "$CDISOMICRO"` > "$CDISOMICRO.md5"
|
|
|
144 |
if [ $? -ne 0 ] ; then exit 1 ; fi
|
24 |
mv_fox |
145 |
|
148 |
mv_fox |
146 |
# compute the ini file with properties of each ISO
|
|
|
147 |
echo "[micro]" > "$PUBDIR/downloads.ini"
|
162 |
mv_fox |
148 |
echo "url=\"https://sourceforge.net/projects/svarog386/files/$YEAR/svarog386-$DATESTAMP-micro.iso/download\"" >> "$PUBDIR/downloads.ini"
|
|
|
149 |
echo "md5=\"https://sourceforge.net/projects/svarog386/files/$YEAR/svarog386-$DATESTAMP-micro.md5/download\"" >> "$PUBDIR/downloads.ini"
|
148 |
mv_fox |
150 |
echo "size=`stat --format='%s' $CDISOMICRO`" >> "$PUBDIR/downloads.ini"
|
|
|
151 |
echo "date=`stat --format='%Y' $CDISOMICRO`" >> "$PUBDIR/downloads.ini"
|
|
|
152 |
echo "" >> "$PUBDIR/downloads.ini"
|
|
|
153 |
echo "[full]" >> "$PUBDIR/downloads.ini"
|
162 |
mv_fox |
154 |
echo "url=\"https://sourceforge.net/projects/svarog386/files/$YEAR/svarog386-$DATESTAMP-full.iso/download\"" >> "$PUBDIR/downloads.ini"
|
|
|
155 |
echo "md5=\"https://sourceforge.net/projects/svarog386/files/$YEAR/svarog386-$DATESTAMP-full.md5/download\"" >> "$PUBDIR/downloads.ini"
|
148 |
mv_fox |
156 |
echo "size=`stat --format='%s' $CDISO`" >> "$PUBDIR/downloads.ini"
|
|
|
157 |
echo "date=`stat --format='%Y' $CDISO`" >> "$PUBDIR/downloads.ini"
|
|
|
158 |
echo "" >> "$PUBDIR/downloads.ini"
|
|
|
159 |
echo "[nosrc]" >> "$PUBDIR/downloads.ini"
|
162 |
mv_fox |
160 |
echo "url=\"https://sourceforge.net/projects/svarog386/files/$YEAR/svarog386-$DATESTAMP-nosrc.iso/download\"" >> "$PUBDIR/downloads.ini"
|
|
|
161 |
echo "md5=\"https://sourceforge.net/projects/svarog386/files/$YEAR/svarog386-$DATESTAMP-nosrc.md5/download\"" >> "$PUBDIR/downloads.ini"
|
148 |
mv_fox |
162 |
echo "size=`stat --format='%s' $CDISONOSRC`" >> "$PUBDIR/downloads.ini"
|
|
|
163 |
echo "date=`stat --format='%Y' $CDISONOSRC`" >> "$PUBDIR/downloads.ini"
|
26 |
mv_fox |
164 |
|
11 |
mv_fox |
165 |
cd "$origdir"
|
|
|
166 |
|
16 |
mv_fox |
167 |
echo "all done!"
|
|
|
168 |
|
2 |
mv_fox |
169 |
exit 0
|