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