Subversion Repositories SvarDOS

Rev

Rev 171 | Rev 185 | 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
#
180 mateuszvis 3
# SvarDOS build script
4
# http://svardos.osdn.io
5
# Copyright (C) 2016-2021 Mateusz Viste
148 mv_fox 6
#
180 mateuszvis 7
# This script generates the SvarDOS repository index and builds ISO CD images.
8
# It should be executed each time that a package has been modified, added or
9
# removed.
11 mv_fox 10
#
2 mv_fox 11
 
11 mv_fox 12
### parameters block starts here ############################################
13
 
180 mateuszvis 14
PKGDIR=`realpath ./packages`
15
REPOROOT=`realpath ./website/repo`
148 mv_fox 16
BUILDIDX=`realpath ../fdnpkg/trunk/buildidx/buildidx`
180 mateuszvis 17
PUBDIR=`realpath ./website/download`
148 mv_fox 18
CDROOT=`realpath ./cdroot`
19
CUSTFILES=`realpath ./files`
2 mv_fox 20
 
171 mv_fox 21
GENISOIMAGE=''    # can be mkisofs, genisoimage or empty for autodetection
22
 
11 mv_fox 23
### parameters block ends here ##############################################
24
 
171 mv_fox 25
# auto-detect whether to use mkisofs or genisoimage
26
 
27
if [ "x$GENISOIMAGE" == "x" ] ; then
180 mateuszvis 28
mkisofs --help 2> /dev/null
171 mv_fox 29
if [ $? -eq 0 ] ; then
30
  GENISOIMAGE='mkisofs'
31
fi
32
fi
33
 
34
if [ "x$GENISOIMAGE" == "x" ] ; then
180 mateuszvis 35
genisoimage --help 2> /dev/null
171 mv_fox 36
if [ $? -eq 0 ] ; then
37
  GENISOIMAGE='genisoimage'
38
fi
39
fi
40
 
41
if [ "x$GENISOIMAGE" == "x" ] ; then
42
  echo "ERROR: neither genisoimage nor mkisofs was found on this system"
43
  exit 1
44
fi
45
 
46
 
180 mateuszvis 47
# abort if anything fails
48
set -e
134 mv_fox 49
 
50
 
180 mateuszvis 51
# function that builds the packages repository
52
function dorepo {
53
  # copy all zip files to the web repo
54
  cp "$PKGDIR"/* $REPOROOT/
55
  # now strip the sources from repo versions
56
  find "$REPOROOT/" -iname '*.zip' -exec zip "{}" -d "SOURCE/*" ';'
57
  find "$REPOROOT/" -iname '*.zip' -exec zip "{}" -d "source/*" ';'
58
  find "$REPOROOT/" -iname '*.zip' -exec zip "{}" -d "Source/*" ';'
134 mv_fox 59
 
180 mateuszvis 60
  # build repo idx
61
  $BUILDIDX "$REPOROOT/"
134 mv_fox 62
}
63
 
64
### actual code flow starts here ############################################
65
 
148 mv_fox 66
# check presence of the buildidx tool
67
if [ ! -f "$BUILDIDX" ] ; then
68
  echo "buildidx not found at $BUILDIDX"
112 mv_fox 69
  exit 1
70
fi
71
 
148 mv_fox 72
# remember where I am, so I can get back here once all is done
11 mv_fox 73
origdir=`pwd`
74
 
180 mateuszvis 75
# build the boot (install) floppy image first
44 mv_fox 76
cp $CUSTFILES/bootmini.img $CDROOT/boot.img
52 mv_fox 77
export MTOOLS_NO_VFAT=1
148 mv_fox 78
mcopy -sQm -i "$CDROOT/boot.img" $CUSTFILES/floppy/* ::/
79
if [ $? -ne 0 ] ; then exit 1 ; fi
44 mv_fox 80
 
180 mateuszvis 81
# build the repo (also builds the listing.txt file)
82
dorepo
16 mv_fox 83
 
180 mateuszvis 84
# delete previous (if any) *.iso and *.md5 files
148 mv_fox 85
echo "cleaning up old versions..."
180 mateuszvis 86
rm -f "$PUBDIR/svardos.iso" "$PUBDIR/svardos.iso.md5"
25 mv_fox 87
 
180 mateuszvis 88
CDISO="$PUBDIR/svardos.iso"
162 mv_fox 89
 
180 mateuszvis 90
$GENISOIMAGE -input-charset cp437 -b boot.img -iso-level 1 -f -V SVARDOS -o "$CDISO" "$CDROOT"
11 mv_fox 91
if [ $? -ne 0 ] ; then exit 1 ; fi
2 mv_fox 92
 
180 mateuszvis 93
# compute the MD5 of the ISO file, taking care to include only the filename in it
16 mv_fox 94
echo "computing md5 sums..."
148 mv_fox 95
cd `dirname "$CDISO"`
96
md5sum `basename "$CDISO"` > "$CDISO.md5"
97
if [ $? -ne 0 ] ; then exit 1 ; fi
11 mv_fox 98
 
99
cd "$origdir"
100
 
180 mateuszvis 101
#cd svnlschk
102
#./webgen.sh
103
#cd ..
165 mv_fox 104
 
180 mateuszvis 105
echo "ALL DONE!"
16 mv_fox 106
 
2 mv_fox 107
exit 0