Subversion Repositories SvarDOS

Rev

Rev 148 | Rev 165 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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