Subversion Repositories SvarDOS

Rev

Rev 171 | Rev 185 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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