Subversion Repositories SvarDOS

Rev

Rev 189 | Rev 194 | 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`
185 mateuszvis 16
BUILDIDX=`realpath ./buildidx/buildidx`
180 mateuszvis 17
PUBDIR=`realpath ./website/download`
148 mv_fox 18
CDROOT=`realpath ./cdroot`
192 mateuszvis 19
FLOPROOT=`realpath ./floproot`
148 mv_fox 20
CUSTFILES=`realpath ./files`
2 mv_fox 21
 
171 mv_fox 22
GENISOIMAGE=''    # can be mkisofs, genisoimage or empty for autodetection
23
 
11 mv_fox 24
### parameters block ends here ##############################################
25
 
171 mv_fox 26
# auto-detect whether to use mkisofs or genisoimage
27
 
28
if [ "x$GENISOIMAGE" == "x" ] ; then
180 mateuszvis 29
mkisofs --help 2> /dev/null
171 mv_fox 30
if [ $? -eq 0 ] ; then
31
  GENISOIMAGE='mkisofs'
32
fi
33
fi
34
 
35
if [ "x$GENISOIMAGE" == "x" ] ; then
180 mateuszvis 36
genisoimage --help 2> /dev/null
171 mv_fox 37
if [ $? -eq 0 ] ; then
38
  GENISOIMAGE='genisoimage'
39
fi
40
fi
41
 
42
if [ "x$GENISOIMAGE" == "x" ] ; then
43
  echo "ERROR: neither genisoimage nor mkisofs was found on this system"
44
  exit 1
45
fi
46
 
47
 
180 mateuszvis 48
# abort if anything fails
49
set -e
134 mv_fox 50
 
51
 
192 mateuszvis 52
# list of packages to be part of CORE
53
COREPKGS=( "attrib" "chkdsk" "choice" "command" "cpidos" "ctmouse" "deltree" "devload" "diskcopy" "display" "dosfsck" "edit" "fc" "fdapm" "fdisk" "fdnpkg" "format" "himemx" "kernel" "keyb" "keyb_lay" "label" "mem" "mode" "more" "move" "shsucdx" "sort" "tree" "undelete" "xcopy" "udvd2" )
54
 
55
 
56
 
180 mateuszvis 57
# function that builds the packages repository
58
function dorepo {
59
  # copy all zip files to the web repo
60
  cp "$PKGDIR"/* $REPOROOT/
61
  # now strip the sources from repo versions
62
  find "$REPOROOT/" -iname '*.zip' -exec zip "{}" -d "SOURCE/*" ';'
63
  find "$REPOROOT/" -iname '*.zip' -exec zip "{}" -d "source/*" ';'
64
  find "$REPOROOT/" -iname '*.zip' -exec zip "{}" -d "Source/*" ';'
134 mv_fox 65
 
180 mateuszvis 66
  # build repo idx
67
  $BUILDIDX "$REPOROOT/"
134 mv_fox 68
}
69
 
70
### actual code flow starts here ############################################
71
 
148 mv_fox 72
# check presence of the buildidx tool
73
if [ ! -f "$BUILDIDX" ] ; then
74
  echo "buildidx not found at $BUILDIDX"
112 mv_fox 75
  exit 1
76
fi
77
 
148 mv_fox 78
# remember where I am, so I can get back here once all is done
11 mv_fox 79
origdir=`pwd`
80
 
189 mateuszvis 81
mkdir "$CDROOT"
192 mateuszvis 82
mkdir "$FLOPROOT"
189 mateuszvis 83
 
180 mateuszvis 84
# build the repo (also builds the listing.txt file)
85
dorepo
16 mv_fox 86
 
192 mateuszvis 87
# add CORE packages to CDROOT + create the list of packages on floppy
88
for pkg in "${COREPKGS[@]}" ; do
89
  cp "$REPOROOT/$pkg.zip" "$CDROOT/"
90
  echo "$pkg" >> "$FLOPROOT/install.lst"
91
done
92
 
93
# prepare the content of the boot (install) floppy
94
cp "install/install.com" "$FLOPROOT/"
95
cp "install/nls/"install.?? "$FLOPROOT/"
96
cp -r "$CUSTFILES/floppy/"* "$FLOPROOT/"
97
 
98
# build the boot floppy image
99
export MTOOLS_NO_VFAT=1
100
truncate -s 1474560 "$CDROOT/boot.img"
101
mformat -f 1440 -v SVARDOS -B "$CUSTFILES/floppy.mbr" -i "$CDROOT/boot.img"
102
mcopy -sQm -i "$CDROOT/boot.img" "$FLOPROOT/"* ::/
103
 
180 mateuszvis 104
# delete previous (if any) *.iso and *.md5 files
148 mv_fox 105
echo "cleaning up old versions..."
180 mateuszvis 106
rm -f "$PUBDIR/svardos.iso" "$PUBDIR/svardos.iso.md5"
25 mv_fox 107
 
180 mateuszvis 108
CDISO="$PUBDIR/svardos.iso"
162 mv_fox 109
 
180 mateuszvis 110
$GENISOIMAGE -input-charset cp437 -b boot.img -iso-level 1 -f -V SVARDOS -o "$CDISO" "$CDROOT"
2 mv_fox 111
 
192 mateuszvis 112
# cleanup temporary things
113
rm -rf "$CDROOT" "$FLOPROOT"
189 mateuszvis 114
 
180 mateuszvis 115
# compute the MD5 of the ISO file, taking care to include only the filename in it
16 mv_fox 116
echo "computing md5 sums..."
148 mv_fox 117
cd `dirname "$CDISO"`
118
md5sum `basename "$CDISO"` > "$CDISO.md5"
11 mv_fox 119
 
120
cd "$origdir"
121
 
180 mateuszvis 122
#cd svnlschk
123
#./webgen.sh
124
#cd ..
165 mv_fox 125
 
180 mateuszvis 126
echo "ALL DONE!"
16 mv_fox 127
 
2 mv_fox 128
exit 0