Subversion Repositories SvarDOS

Rev

Rev 205 | Rev 279 | 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
#
194 mateuszvis 11
# usage: ./build.sh [noclean]
12
#
2 mv_fox 13
 
11 mv_fox 14
### parameters block starts here ############################################
15
 
180 mateuszvis 16
PKGDIR=`realpath ./packages`
17
REPOROOT=`realpath ./website/repo`
185 mateuszvis 18
BUILDIDX=`realpath ./buildidx/buildidx`
180 mateuszvis 19
PUBDIR=`realpath ./website/download`
148 mv_fox 20
CDROOT=`realpath ./cdroot`
192 mateuszvis 21
FLOPROOT=`realpath ./floproot`
148 mv_fox 22
CUSTFILES=`realpath ./files`
2 mv_fox 23
 
171 mv_fox 24
GENISOIMAGE=''    # can be mkisofs, genisoimage or empty for autodetection
25
 
11 mv_fox 26
### parameters block ends here ##############################################
27
 
171 mv_fox 28
# auto-detect whether to use mkisofs or genisoimage
29
 
30
if [ "x$GENISOIMAGE" == "x" ] ; then
180 mateuszvis 31
mkisofs --help 2> /dev/null
171 mv_fox 32
if [ $? -eq 0 ] ; then
33
  GENISOIMAGE='mkisofs'
34
fi
35
fi
36
 
37
if [ "x$GENISOIMAGE" == "x" ] ; then
180 mateuszvis 38
genisoimage --help 2> /dev/null
171 mv_fox 39
if [ $? -eq 0 ] ; then
40
  GENISOIMAGE='genisoimage'
41
fi
42
fi
43
 
44
if [ "x$GENISOIMAGE" == "x" ] ; then
45
  echo "ERROR: neither genisoimage nor mkisofs was found on this system"
46
  exit 1
47
fi
48
 
49
 
180 mateuszvis 50
# abort if anything fails
51
set -e
134 mv_fox 52
 
53
 
192 mateuszvis 54
# list of packages to be part of CORE
195 mateuszvis 55
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"
192 mateuszvis 56
 
57
 
58
 
180 mateuszvis 59
# function that builds the packages repository
60
function dorepo {
61
  # copy all zip files to the web repo
62
  cp "$PKGDIR"/* $REPOROOT/
63
  # now strip the sources from repo versions
64
  find "$REPOROOT/" -iname '*.zip' -exec zip "{}" -d "SOURCE/*" ';'
65
  find "$REPOROOT/" -iname '*.zip' -exec zip "{}" -d "source/*" ';'
66
  find "$REPOROOT/" -iname '*.zip' -exec zip "{}" -d "Source/*" ';'
134 mv_fox 67
 
180 mateuszvis 68
  # build repo idx
69
  $BUILDIDX "$REPOROOT/"
134 mv_fox 70
}
71
 
194 mateuszvis 72
 
246 mateuszvis 73
# prepares image for floppy sets of:
74
# $1 cylinders
75
# $2 heads (sides)
76
# $3 sectors per track
77
# $4 size
194 mateuszvis 78
function prep_flop {
246 mateuszvis 79
  mkdir $4
80
  mformat -C -t $1 -h $2 -s $3 -v SVARDOS -B "$CUSTFILES/floppy.mbr" -i "$4/disk1.img"
81
  mcopy -sQm -i "$4/disk1.img" "$FLOPROOT/"* ::/
196 mateuszvis 82
 
83
  # now populate the floppies
84
  curdisk=1
198 mateuszvis 85
  for p in $COREPKGS ; do
196 mateuszvis 86
    # if copy fails, then probably the floppy is full - try again after
87
    # creating an additional floppy image
246 mateuszvis 88
    if ! mcopy -mi "$4/disk$curdisk.img" "$CDROOT/$p.zip" ::/ ; then
196 mateuszvis 89
      curdisk=$((curdisk+1))
246 mateuszvis 90
      mformat -C -t $1 -h $2 -s $3 -v SVARDOS -i "$4/disk$curdisk.img"
91
      mcopy -mi "$4/disk$curdisk.img" "$CDROOT/$p.zip" ::/
196 mateuszvis 92
    fi
194 mateuszvis 93
  done
196 mateuszvis 94
 
205 mateuszvis 95
  # add a short readme
246 mateuszvis 96
  echo "This directory contains a set of $curdisk floppy images of the SvarDOS distribution in the $4 KB floppy format." > "$4/readme.txt"
97
  echo "" >> "$4/readme.txt"
98
  echo "These images are raw floppy disk dumps. To write them on an actual floppy disk, you have to use a low-level sector copying tool, like dd." >> "$4/readme.txt"
99
  echo "" >> "$4/readme.txt"
100
  echo "Latest SvarDOS version is available on the project's homepage: http://svardos.osdn.io" >> "$4/readme.txt"
205 mateuszvis 101
 
246 mateuszvis 102
  unix2dos "$4/readme.txt"
205 mateuszvis 103
 
196 mateuszvis 104
  # zip the images (and remove them at the same time)
246 mateuszvis 105
  rm -f "$PUBDIR/svardos-floppy-$4k.zip"
106
  zip -9 -rmj "$PUBDIR/svardos-floppy-$4k.zip" $4/*
196 mateuszvis 107
 
108
  # clean up
246 mateuszvis 109
  rmdir $4
194 mateuszvis 110
}
111
 
112
 
134 mv_fox 113
### actual code flow starts here ############################################
114
 
148 mv_fox 115
# check presence of the buildidx tool
116
if [ ! -f "$BUILDIDX" ] ; then
117
  echo "buildidx not found at $BUILDIDX"
112 mv_fox 118
  exit 1
119
fi
120
 
148 mv_fox 121
# remember where I am, so I can get back here once all is done
11 mv_fox 122
origdir=`pwd`
123
 
189 mateuszvis 124
mkdir "$CDROOT"
192 mateuszvis 125
mkdir "$FLOPROOT"
189 mateuszvis 126
 
180 mateuszvis 127
# build the repo (also builds the listing.txt file)
128
dorepo
16 mv_fox 129
 
192 mateuszvis 130
# add CORE packages to CDROOT + create the list of packages on floppy
195 mateuszvis 131
for pkg in $COREPKGS ; do
192 mateuszvis 132
  cp "$REPOROOT/$pkg.zip" "$CDROOT/"
133
  echo "$pkg" >> "$FLOPROOT/install.lst"
134
done
135
 
136
# prepare the content of the boot (install) floppy
137
cp "install/install.com" "$FLOPROOT/"
138
cp "install/nls/"install.?? "$FLOPROOT/"
139
cp -r "$CUSTFILES/floppy/"* "$FLOPROOT/"
140
 
194 mateuszvis 141
# build the boot (CD) floppy image
192 mateuszvis 142
export MTOOLS_NO_VFAT=1
194 mateuszvis 143
mformat -C -f 1440 -v SVARDOS -B "$CUSTFILES/floppy.mbr" -i "$CDROOT/boot.img"
192 mateuszvis 144
mcopy -sQm -i "$CDROOT/boot.img" "$FLOPROOT/"* ::/
145
 
246 mateuszvis 146
# prepare images for floppies in different sizes (args are C H S SIZE)
147
prep_flop 80 2 36 2880
148
prep_flop 80 2 18 1440
149
prep_flop 80 2 15 1200
150
prep_flop 80 2  9  720
194 mateuszvis 151
 
204 mateuszvis 152
CDISO="$PUBDIR/svardos-cd.iso"
153
CDZIP="$PUBDIR/svardos-cd.zip"
194 mateuszvis 154
 
204 mateuszvis 155
# delete previous (if any) iso
148 mv_fox 156
echo "cleaning up old versions..."
204 mateuszvis 157
rm -f "$CDISO" "$CDZIP"
25 mv_fox 158
 
180 mateuszvis 159
$GENISOIMAGE -input-charset cp437 -b boot.img -iso-level 1 -f -V SVARDOS -o "$CDISO" "$CDROOT"
2 mv_fox 160
 
204 mateuszvis 161
# compress the ISO
162
zip -mj9 "$CDZIP" "$CDISO"
163
 
192 mateuszvis 164
# cleanup temporary things
194 mateuszvis 165
if [ "x$1" != "xnoclean" ] ; then
166
  rm -rf "$CDROOT" "$FLOPROOT"
167
fi
189 mateuszvis 168
 
11 mv_fox 169
cd "$origdir"
170
 
180 mateuszvis 171
#cd svnlschk
172
#./webgen.sh
173
#cd ..
165 mv_fox 174
 
180 mateuszvis 175
echo "ALL DONE!"
16 mv_fox 176
 
2 mv_fox 177
exit 0