Subversion Repositories SvarDOS

Rev

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

Rev 134 Rev 148
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
#
2
#
-
 
3
# Svarog386 build script
-
 
4
# http://svarog386.sourceforge.net
-
 
5
# Copyright (C) 2016-2018 Mateusz Viste
-
 
6
#
3
# This script generates indexes of Svarog386 repositories and builds the ISO
7
# This script generates indexes of Svarog386 repositories and builds the ISO
4
# 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
5
# modified, added or removed from any of the repositories.
9
# modified, added or removed from any of the repositories.
6
#
10
#
7
 
11
 
8
### parameters block starts here ############################################
12
### parameters block starts here ############################################
9
 
13
 
10
REPOROOT='/srv/www/svarog386.viste.fr/repos/'
14
REPOROOT=`realpath ./website/repos/`
11
REPOROOTSRC='/srv/www/svarog386.viste.fr/repos-src/'
15
REPOROOTSRC=`realpath ./website/repos-src/`
12
REPOROOTNOSRC='/srv/www/svarog386.viste.fr/repos-nosrc/'
16
REPOROOTNOSRC=`realpath ./website/repos-nosrc/`
13
BUILDIDX='/root/fdnpkg-buildidx/buildidx'
17
BUILDIDX=`realpath ../fdnpkg/trunk/buildidx/buildidx`
14
CDISODIR='/srv/www/svarog386.viste.fr/'
18
CDISODIR=`realpath ./iso/`
15
CDISODIRTEST='/srv/www/svarog386.viste.fr/test/'
19
PUBDIR=`realpath ./website/`
16
CDROOT='/root/svarog386/cdroot'
20
CDROOT=`realpath ./cdroot`
17
CDROOTNOSRC='/root/svarog386/cdrootnosrc'
21
CDROOTNOSRC=`realpath ./cdrootnosrc`
18
CDROOTMICRO='/root/svarog386/cdrootmicro'
22
CDROOTMICRO=`realpath ./cdrootmicro`
19
CUSTFILES='/root/svarog386/files'
23
CUSTFILES=`realpath ./files`
20
 
24
 
21
### parameters block ends here ##############################################
25
### parameters block ends here ##############################################
22
 
26
 
23
# function to be called with the repository (short) name as argument
27
# function to be called with the repository (short) name as argument
24
function dorepo {
28
function dorepo {
25
  repodir=$1
29
  repodir="$1"
26
  # switch to repo's dir
30
  # switch to repo's dir
27
  cd $REPOROOT/$repodir
31
  cd $REPOROOT/$repodir
28
  # duplicate all zip files as zib
32
  # duplicate all zip files as zib
29
  for f in *.zip
33
  for f in *.zip
30
  do
34
  do
Line 34... Line 38...
34
  find $REPOROOT/$repodir -iname '*.zib' -exec zip "{}" -d "SOURCE/*" ';'
38
  find $REPOROOT/$repodir -iname '*.zib' -exec zip "{}" -d "SOURCE/*" ';'
35
  find $REPOROOT/$repodir -iname '*.zib' -exec zip "{}" -d "source/*" ';'
39
  find $REPOROOT/$repodir -iname '*.zib' -exec zip "{}" -d "source/*" ';'
36
  find $REPOROOT/$repodir -iname '*.zib' -exec zip "{}" -d "Source/*" ';'
40
  find $REPOROOT/$repodir -iname '*.zib' -exec zip "{}" -d "Source/*" ';'
37
 
41
 
38
  # build idx for the full (net) repo
42
  # build idx for the full (net) repo
39
  $BUILDIDX $REPOROOT/$repodir
43
  $BUILDIDX "$REPOROOT/$repodir"
40
  # copy listing into the global listing
44
  # copy listing into the global listing
41
  cat $REPOROOT/$repodir/listing.txt >> $CDISODIR/listing.txt
45
  cat "$REPOROOT/$repodir/listing.txt" >> "$PUBDIR/listing.txt"
42
 
46
 
43
  # compute links for the 'no source' version
47
  # compute links for the 'no source' version
44
  mkdir -p $REPOROOTNOSRC/$repodir
48
  mkdir -p $REPOROOTNOSRC/$repodir
45
  cd $REPOROOTNOSRC/$repodir
49
  cd $REPOROOTNOSRC/$repodir
46
  if [ $? -ne 0 ] ; then exit 1 ; fi
50
  if [ $? -ne 0 ] ; then exit 1 ; fi
47
  rm *.zip *.zib
51
  rm *.zip
48
  for f in $REPOROOT/$repodir/*.zib
52
  for f in $REPOROOT/$repodir/*.zib
49
  do
53
  do
50
  ln -s "$f" `basename -s .zib $f`.zip
54
  ln -s "$f" `basename -s .zib $f`.zip
51
  done
55
  done
52
  # build idx for the 'no source' version
56
  # build idx for the 'no source' version
Line 54... Line 58...
54
 
58
 
55
  # compute links for the 'with source' (but no zib) version
59
  # compute links for the 'with source' (but no zib) version
56
  mkdir -p $REPOROOTSRC/$repodir
60
  mkdir -p $REPOROOTSRC/$repodir
57
  cd $REPOROOTSRC/$repodir
61
  cd $REPOROOTSRC/$repodir
58
  if [ $? -ne 0 ] ; then exit 1 ; fi
62
  if [ $? -ne 0 ] ; then exit 1 ; fi
59
  rm *.zip *.zib
63
  rm *.zip
60
  for f in $REPOROOT/$repodir/*.zip
64
  for f in $REPOROOT/$repodir/*.zip
61
  do
65
  do
62
  ln -s "$f" `basename $f`
66
  ln -s "$f" `basename $f`
63
  done
67
  done
64
  # build idx for the 'no source' version
68
  # build idx for the 'no source' version
65
  $BUILDIDX $REPOROOTSRC/$repodir
69
  $BUILDIDX $REPOROOTSRC/$repodir
66
}
70
}
67
 
71
 
68
### actual code flow starts here ############################################
72
### actual code flow starts here ############################################
69
 
73
 
70
 
-
 
71
TESTMODE=0
-
 
72
if [ "x$1" = "xprod" ]; then
74
# check presence of the buildidx tool
73
  TESTMODE=0
-
 
74
elif [ "x$1" = "xtest" ]; then
75
if [ ! -f "$BUILDIDX" ] ; then
75
  TESTMODE=1
-
 
76
  CDISODIR="$CDISODIRTEST"
-
 
77
  mkdir -p "$CDISODIR"
-
 
78
else
-
 
79
  echo "usage: build.sh prod|test"
76
  echo "buildidx not found at $BUILDIDX"
80
  exit 1
77
  exit 1
81
fi
78
fi
82
 
79
 
83
# remember where we are, so we can return there once all is done
80
# remember where I am, so I can get back here once all is done
84
origdir=`pwd`
81
origdir=`pwd`
85
 
82
 
86
# build the boot floppy image first
83
# build the boot floppy image first
87
cp $CUSTFILES/bootmini.img $CDROOT/boot.img
84
cp $CUSTFILES/bootmini.img $CDROOT/boot.img
88
export MTOOLS_NO_VFAT=1
85
export MTOOLS_NO_VFAT=1
89
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
90
 
88
 
91
# 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
92
cp $CDROOT/boot.img $CDROOTNOSRC/
90
cp "$CDROOT/boot.img" "$CDROOTNOSRC/"
93
if [ $? -ne 0 ] ; then exit 1 ; fi
91
if [ $? -ne 0 ] ; then exit 1 ; fi
94
cp $CDROOT/boot.img $CDROOTMICRO/
92
cp "$CDROOT/boot.img" "$CDROOTMICRO/"
95
if [ $? -ne 0 ] ; then exit 1 ; fi
93
if [ $? -ne 0 ] ; then exit 1 ; fi
96
cp $CDROOT/boot.img $CDISODIR/
94
cp "$CDROOT/boot.img" "$PUBDIR/"
97
if [ $? -ne 0 ] ; then exit 1 ; fi
95
if [ $? -ne 0 ] ; then exit 1 ; fi
98
 
96
 
99
# remove the 'human' listing (will be regenerated in a short moment)
97
# remove the 'human' listing (will be regenerated in a short moment)
100
rm $CDISODIR/listing.txt
98
rm "$PUBDIR/listing.txt"
101
 
99
 
102
# process all repos (also builds the listing.txt file)
100
# process all repos (also builds the listing.txt file)
103
dorepo core
101
dorepo core
104
dorepo devel
102
dorepo devel
105
dorepo drivers
103
dorepo drivers
Line 109... Line 107...
109
dorepo net
107
dorepo net
110
dorepo packers
108
dorepo packers
111
dorepo sound
109
dorepo sound
112
dorepo util
110
dorepo util
113
 
111
 
-
 
112
# delete all (previous) *.iso and *.md5 files
-
 
113
echo "cleaning up old versions..."
-
 
114
rm $CDISODIR/svarog386-*-*.iso*
114
 
115
 
115
# compute a filename for the ISO files and build it
116
# compute a filename for the ISO files and build it
116
DATESTAMP=`date +%Y%m%d-%H%M`
117
DATESTAMP=`date +%Y%m%d-%H%M`
117
CDISO="$CDISODIR/svarog386-full-$DATESTAMP.iso"
118
CDISO="$CDISODIR/svarog386-$DATESTAMP-full.iso"
118
CDISONOSRC="$CDISODIR/svarog386-nosrc-$DATESTAMP.iso"
119
CDISONOSRC="$CDISODIR/svarog386-$DATESTAMP-nosrc.iso"
119
CDISOMICRO="$CDISODIR/svarog386-micro-$DATESTAMP.iso"
120
CDISOMICRO="$CDISODIR/svarog386-$DATESTAMP-micro.iso"
120
genisoimage -input-charset cp437 -b boot.img -iso-level 1 -f -V SVAROG386 -o $CDISO.tmp $CDROOT
121
genisoimage -input-charset cp437 -b boot.img -iso-level 1 -f -V SVAROG386 -o "$CDISO" "$CDROOT"
121
if [ $? -ne 0 ] ; then exit 1 ; fi
122
if [ $? -ne 0 ] ; then exit 1 ; fi
122
genisoimage -input-charset cp437 -b boot.img -iso-level 1 -f -V SVAROG386 -o $CDISONOSRC.tmp $CDROOTNOSRC
123
genisoimage -input-charset cp437 -b boot.img -iso-level 1 -f -V SVAROG386 -o "$CDISONOSRC" "$CDROOTNOSRC"
123
if [ $? -ne 0 ] ; then exit 1 ; fi
124
if [ $? -ne 0 ] ; then exit 1 ; fi
124
genisoimage -input-charset cp437 -b boot.img -iso-level 1 -f -V SVAROG386 -o $CDISOMICRO.tmp $CDROOTMICRO
125
genisoimage -input-charset cp437 -b boot.img -iso-level 1 -f -V SVAROG386 -o "$CDISOMICRO" "$CDROOTMICRO"
125
if [ $? -ne 0 ] ; then exit 1 ; fi
126
if [ $? -ne 0 ] ; then exit 1 ; fi
126
mv $CDISO.tmp $CDISO
-
 
127
mv $CDISONOSRC.tmp $CDISONOSRC
-
 
128
mv $CDISOMICRO.tmp $CDISOMICRO
-
 
129
 
127
 
130
# compute the MD5 of the ISO files, taking care to include only the filename in it
128
# compute the MD5 of the ISO files, taking care to include only the filename in it
131
echo "computing md5 sums..."
129
echo "computing md5 sums..."
132
cd `dirname $CDISO`
130
cd `dirname "$CDISO"`
133
md5sum `basename $CDISO` > $CDISO.md5
131
md5sum `basename "$CDISO"` > "$CDISO.md5"
134
 
-
 
135
cd `dirname $CDISONOSRC`
-
 
136
md5sum `basename $CDISONOSRC` > $CDISONOSRC.md5
132
if [ $? -ne 0 ] ; then exit 1 ; fi
137
 
133
 
138
cd `dirname $CDISOMICRO`
134
cd `dirname "$CDISONOSRC"`
139
md5sum `basename $CDISOMICRO` > $CDISOMICRO.md5
135
md5sum `basename "$CDISONOSRC"` > "$CDISONOSRC.md5"
-
 
136
if [ $? -ne 0 ] ; then exit 1 ; fi
140
 
137
 
-
 
138
cd `dirname "$CDISOMICRO"`
-
 
139
md5sum `basename "$CDISOMICRO"` > "$CDISOMICRO.md5"
-
 
140
if [ $? -ne 0 ] ; then exit 1 ; fi
-
 
141
 
141
# delete all *.iso and *.md5 files, leaving only the 16 most recent
142
# compute the ini file with properties of each ISO
-
 
143
echo "[micro]" > "$PUBDIR/downloads.ini"
-
 
144
echo "url=\"https://sourceforge.net/projects/svarog386/files/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"
-
 
146
echo "size=`stat --format='%s' $CDISOMICRO`" >> "$PUBDIR/downloads.ini"
-
 
147
echo "date=`stat --format='%Y' $CDISOMICRO`" >> "$PUBDIR/downloads.ini"
142
echo "cleaning up old versions..."
148
echo "" >> "$PUBDIR/downloads.ini"
-
 
149
echo "[full]" >> "$PUBDIR/downloads.ini"
-
 
150
echo "url=\"https://sourceforge.net/projects/svarog386/files/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"
-
 
152
echo "size=`stat --format='%s' $CDISO`" >> "$PUBDIR/downloads.ini"
143
ls -tp $CDISODIR/svarog386-*-*.iso* | tail -n +17 | xargs -I {} rm -- {}
153
echo "date=`stat --format='%Y' $CDISO`" >> "$PUBDIR/downloads.ini"
-
 
154
echo "" >> "$PUBDIR/downloads.ini"
-
 
155
echo "[nosrc]" >> "$PUBDIR/downloads.ini"
-
 
156
echo "url=\"https://sourceforge.net/projects/svarog386/files/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"
-
 
158
echo "size=`stat --format='%s' $CDISONOSRC`" >> "$PUBDIR/downloads.ini"
-
 
159
echo "date=`stat --format='%Y' $CDISONOSRC`" >> "$PUBDIR/downloads.ini"
144
 
160
 
145
cd "$origdir"
161
cd "$origdir"
146
 
162
 
147
echo "all done!"
163
echo "all done!"
148
 
164