Subversion Repositories SvarDOS

Rev

Rev 168 | Rev 180 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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