Subversion Repositories SvarDOS

Rev

Rev 781 | Rev 836 | 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
791 mateusz.vi 4
# http://svardos.org
557 mateuszvis 5
# Copyright (C) 2016-2022 Mateusz Viste
148 mv_fox 6
#
791 mateusz.vi 7
# This script generates the SvarDOS repository index and builds floppy and CD
8
# images. It should be executed each time that a CORE package has been
9
# modified, added or 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
 
643 mateusz.vi 16
CURDATE=`date +%Y%m%d`
632 mateusz.vi 17
REPOROOT=`realpath ./packages`
643 mateusz.vi 18
PUBDIR=`realpath ./website/download`/$CURDATE
791 mateusz.vi 19
CDROOT=`realpath ./tmp_cdroot.build`
20
FLOPROOT=`realpath ./tmp_floproot.build`
148 mv_fox 21
CUSTFILES=`realpath ./files`
2 mv_fox 22
 
171 mv_fox 23
GENISOIMAGE=''    # can be mkisofs, genisoimage or empty for autodetection
24
 
11 mv_fox 25
### parameters block ends here ##############################################
26
 
171 mv_fox 27
# auto-detect whether to use mkisofs or genisoimage
28
 
29
if [ "x$GENISOIMAGE" == "x" ] ; then
180 mateuszvis 30
mkisofs --help 2> /dev/null
171 mv_fox 31
if [ $? -eq 0 ] ; then
32
  GENISOIMAGE='mkisofs'
33
fi
34
fi
35
 
36
if [ "x$GENISOIMAGE" == "x" ] ; then
180 mateuszvis 37
genisoimage --help 2> /dev/null
171 mv_fox 38
if [ $? -eq 0 ] ; then
39
  GENISOIMAGE='genisoimage'
40
fi
41
fi
42
 
43
if [ "x$GENISOIMAGE" == "x" ] ; then
44
  echo "ERROR: neither genisoimage nor mkisofs was found on this system"
45
  exit 1
46
fi
47
 
48
 
180 mateuszvis 49
# abort if anything fails
50
set -e
134 mv_fox 51
 
52
 
300 mateuszvis 53
# list of packages to be part of CORE (always installed)
791 mateusz.vi 54
COREPKGS=`ls -1 'packages/core' | grep -o '^[a-z]*'`
192 mateuszvis 55
 
300 mateuszvis 56
# list of packages to be part of EXTRA (only sometimes installed, typically drivers)
57
EXTRAPKGS="pcntpk udvd2"
192 mateuszvis 58
 
300 mateuszvis 59
# all packages
60
ALLPKGS="$COREPKGS $EXTRAPKGS"
192 mateuszvis 61
 
300 mateuszvis 62
 
246 mateuszvis 63
# prepares image for floppy sets of:
64
# $1 cylinders
65
# $2 heads (sides)
66
# $3 sectors per track
67
# $4 size
279 mateuszvis 68
# $5 where to put a copy of the image (optional)
194 mateuszvis 69
function prep_flop {
246 mateuszvis 70
  mkdir $4
71
  mformat -C -t $1 -h $2 -s $3 -v SVARDOS -B "$CUSTFILES/floppy.mbr" -i "$4/disk1.img"
72
  mcopy -sQm -i "$4/disk1.img" "$FLOPROOT/"* ::/
196 mateuszvis 73
 
74
  # now populate the floppies
75
  curdisk=1
300 mateuszvis 76
  for p in $ALLPKGS ; do
196 mateuszvis 77
    # if copy fails, then probably the floppy is full - try again after
78
    # creating an additional floppy image
700 mateusz.vi 79
    if ! mcopy -mi "$4/disk$curdisk.img" "$CDROOT/$p.svp" ::/ ; then
196 mateuszvis 80
      curdisk=$((curdisk+1))
246 mateuszvis 81
      mformat -C -t $1 -h $2 -s $3 -v SVARDOS -i "$4/disk$curdisk.img"
700 mateusz.vi 82
      mcopy -mi "$4/disk$curdisk.img" "$CDROOT/$p.svp" ::/
196 mateuszvis 83
    fi
194 mateuszvis 84
  done
196 mateuszvis 85
 
205 mateuszvis 86
  # add a short readme
246 mateuszvis 87
  echo "This directory contains a set of $curdisk floppy images of the SvarDOS distribution in the $4 KB floppy format." > "$4/readme.txt"
88
  echo "" >> "$4/readme.txt"
89
  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"
90
  echo "" >> "$4/readme.txt"
91
  echo "Latest SvarDOS version is available on the project's homepage: http://svardos.osdn.io" >> "$4/readme.txt"
205 mateuszvis 92
 
246 mateuszvis 93
  unix2dos "$4/readme.txt"
205 mateuszvis 94
 
279 mateuszvis 95
  # make a copy of the image, if requested
96
  if [ "x$5" != "x" ] ; then
97
    cp "$4/disk1.img" $5
98
  fi
99
 
196 mateuszvis 100
  # zip the images (and remove them at the same time)
246 mateuszvis 101
  rm -f "$PUBDIR/svardos-floppy-$4k.zip"
643 mateusz.vi 102
  zip -9 -rmj "$PUBDIR/svardos-$CURDATE-floppy-$4k.zip" $4/*
196 mateuszvis 103
 
104
  # clean up
246 mateuszvis 105
  rmdir $4
194 mateuszvis 106
}
107
 
108
 
134 mv_fox 109
### actual code flow starts here ############################################
110
 
148 mv_fox 111
# remember where I am, so I can get back here once all is done
11 mv_fox 112
origdir=`pwd`
113
 
189 mateuszvis 114
mkdir "$CDROOT"
192 mateuszvis 115
mkdir "$FLOPROOT"
643 mateusz.vi 116
mkdir "$PUBDIR"
189 mateuszvis 117
 
192 mateuszvis 118
# add CORE packages to CDROOT + create the list of packages on floppy
195 mateuszvis 119
for pkg in $COREPKGS ; do
791 mateusz.vi 120
  cp "$REPOROOT/core/$pkg.svp" "$CDROOT/"
192 mateuszvis 121
  echo "$pkg" >> "$FLOPROOT/install.lst"
122
done
123
 
791 mateusz.vi 124
# add EXTRA packages to CDROOT (but not in the list of packages to install)
300 mateuszvis 125
for pkg in $EXTRAPKGS ; do
700 mateusz.vi 126
  cp "$REPOROOT/$pkg.svp" "$CDROOT/"
300 mateuszvis 127
done
128
 
129
 
192 mateuszvis 130
# prepare the content of the boot (install) floppy
131
cp -r "$CUSTFILES/floppy/"* "$FLOPROOT/"
791 mateusz.vi 132
unzip -Cj "$REPOROOT/core/cpidos.svp" 'cpi/ega*.cpx' -d "$FLOPROOT/"
133
unzip -Cj "$REPOROOT/core/command.svp" bin/command.com -d "$FLOPROOT/"
134
unzip -Cj "$REPOROOT/core/display.svp" bin/display.exe -d "$FLOPROOT/"
135
unzip -Cj "$REPOROOT/core/edit.svp" bin/edit.exe -d "$FLOPROOT/"
136
unzip -Cj "$REPOROOT/core/fdapm.svp" bin/fdapm.com -d "$FLOPROOT/"
137
unzip -Cj "$REPOROOT/core/fdisk.svp" bin/fdisk.exe bin/fdiskpt.ini -d "$FLOPROOT/"
138
unzip -Cj "$REPOROOT/core/format.svp" bin/format.exe -d "$FLOPROOT/"
139
unzip -Cj "$REPOROOT/core/kernel.svp" bin/kernel.sys bin/sys.com -d "$FLOPROOT/"
140
unzip -Cj "$REPOROOT/core/mem.svp" bin/mem.exe -d "$FLOPROOT/"
141
unzip -Cj "$REPOROOT/core/mode.svp" bin/mode.com -d "$FLOPROOT/"
142
unzip -Cj "$REPOROOT/core/more.svp" bin/more.exe -d "$FLOPROOT/"
143
unzip -Cj "$REPOROOT/core/pkg.svp" bin/pkg.exe -d "$FLOPROOT/"
192 mateuszvis 144
 
194 mateuszvis 145
# build the boot (CD) floppy image
192 mateuszvis 146
export MTOOLS_NO_VFAT=1
279 mateuszvis 147
#mformat -C -f 2880 -v SVARDOS -B "$CUSTFILES/floppy.mbr" -i "$CDROOT/boot.img"
148
#mcopy -sQm -i "$CDROOT/boot.img" "$FLOPROOT/"* ::/
192 mateuszvis 149
 
246 mateuszvis 150
# prepare images for floppies in different sizes (args are C H S SIZE)
279 mateuszvis 151
prep_flop 80 2 36 2880 "$CDROOT/boot.img"
246 mateuszvis 152
prep_flop 80 2 18 1440
153
prep_flop 80 2 15 1200
154
prep_flop 80 2  9  720
316 mateuszvis 155
#prep_flop 96 64 32 98304 "$PUBDIR/svardos-zip100.img" # ZIP 100M (for USB boot in "USB-ZIP mode")
194 mateuszvis 156
 
321 mateuszvis 157
# prepare the DOSEMU boot zip
791 mateusz.vi 158
DOSEMUDIR='tmp_dosemu-prep-files.build'
321 mateuszvis 159
mkdir "$DOSEMUDIR"
322 mateuszvis 160
# INSTALL.BAT
624 mateuszvis 161
echo 'IF NOT EXIST C:\TEMP\NUL MKDIR C:\TEMP' >> "$DOSEMUDIR/install.bat"
322 mateuszvis 162
echo 'mkdir %DOSDIR%' >> "$DOSEMUDIR/install.bat"
163
echo 'mkdir %DOSDIR%\cfg' >> "$DOSEMUDIR/install.bat"
164
echo 'ECHO # pkg config file - specifies locations where packages should be installed >> %DOSDIR%\cfg\pkg.cfg' >> "$DOSEMUDIR/install.bat"
165
echo 'ECHO DIR PROGS C:\ >> %DOSDIR%\cfg\pkg.cfg' >> "$DOSEMUDIR/install.bat"
166
echo 'ECHO DIR GAMES C:\ >> %DOSDIR%\cfg\pkg.cfg' >> "$DOSEMUDIR/install.bat"
167
echo 'ECHO DIR DRIVERS C:\DRIVERS\ >> %DOSDIR%\cfg\pkg.cfg' >> "$DOSEMUDIR/install.bat"
168
echo 'ECHO DIR DEVEL C:\DEVEL\ >> %DOSDIR%\cfg\pkg.cfg' >> "$DOSEMUDIR/install.bat"
321 mateuszvis 169
for p in $COREPKGS ; do
700 mateusz.vi 170
  cp "$CDROOT/$p.svp" "$DOSEMUDIR/"
171
  echo "pkg install $p.svp" >> "$DOSEMUDIR/install.bat"
172
  echo "del $p.svp" >> "$DOSEMUDIR/install.bat"
321 mateuszvis 173
done
322 mateuszvis 174
echo 'ECHO my_ip = dhcp >> %DOSDIR%\CFG\WATTCP.CFG' >> "$DOSEMUDIR/install.bat"
175
echo 'del pkg.exe' >> "$DOSEMUDIR/install.bat"
326 mateuszvis 176
echo 'ECHO SHELLHIGH=C:\SVARDOS\BIN\COMMAND.COM /P >> C:\CONFIG.SYS' >> "$DOSEMUDIR/install.bat"
322 mateuszvis 177
echo 'ECHO.' >> "$DOSEMUDIR/install.bat"
178
echo 'ECHO -------------------------' >> "$DOSEMUDIR/install.bat"
179
echo 'ECHO  SVARDOS SETUP COMPLETED ' >> "$DOSEMUDIR/install.bat"
180
echo 'ECHO -------------------------' >> "$DOSEMUDIR/install.bat"
181
echo 'ECHO.' >> "$DOSEMUDIR/install.bat"
791 mateusz.vi 182
unzip -Cj "$REPOROOT/core/kernel.svp" bin/kernel.sys -d "$DOSEMUDIR/"
183
unzip -Cj "$REPOROOT/core/command.svp" bin/command.com -d "$DOSEMUDIR/"
184
unzip -Cj "$REPOROOT/core/pkg.svp" bin/pkg.exe -d "$DOSEMUDIR/"
322 mateuszvis 185
# CONFIG.SYS
186
echo 'FILES=50' >> "$DOSEMUDIR/config.sys"
187
echo 'DOS=HIGH,UMB' >> "$DOSEMUDIR/config.sys"
326 mateuszvis 188
echo 'DOSDATA=UMB' >> "$DOSEMUDIR/config.sys"
325 mateuszvis 189
echo 'DEVICE=D:\dosemu\emufs.sys' >> "$DOSEMUDIR/config.sys"
322 mateuszvis 190
echo 'DEVICE=D:\dosemu\umb.sys' >> "$DOSEMUDIR/config.sys"
325 mateuszvis 191
echo 'DEVICEHIGH=D:\dosemu\ems.sys' >> "$DOSEMUDIR/config.sys"
322 mateuszvis 192
echo 'INSTALL=D:\dosemu\emufs.com' >> "$DOSEMUDIR/config.sys"
193
# AUTOEXEC.BAT
321 mateuszvis 194
echo "@ECHO OFF" >> "$DOSEMUDIR/autoexec.bat"
322 mateuszvis 195
echo 'SET DOSDIR=C:\SVARDOS' >> "$DOSEMUDIR/autoexec.bat"
196
echo 'SET WATTCP.CFG=%DOSDIR%\CFG' >> "$DOSEMUDIR/autoexec.bat"
197
echo 'SET DIRCMD=/p/ogne' >> "$DOSEMUDIR/autoexec.bat"
624 mateuszvis 198
echo 'SET TEMP=C:\TEMP' >> "$DOSEMUDIR/autoexec.bat"
322 mateuszvis 199
echo 'PATH %DOSDIR%\BIN' >> "$DOSEMUDIR/autoexec.bat"
200
echo "" >> "$DOSEMUDIR/autoexec.bat"
201
echo "REM *** this is a one-time setup script used only during first initialization ***" >> "$DOSEMUDIR/autoexec.bat"
202
echo 'IF EXIST INSTALL.BAT CALL INSTALL.BAT' >> "$DOSEMUDIR/autoexec.bat"
203
echo 'IF EXIST INSTALL.BAT DEL INSTALL.BAT' >> "$DOSEMUDIR/autoexec.bat"
204
echo "" >> "$DOSEMUDIR/autoexec.bat"
321 mateuszvis 205
echo "ECHO." >> "$DOSEMUDIR/autoexec.bat"
206
echo "ECHO Welcome to SvarDOS (powered by DOSEMU)! Type HELP if you are lost." >> "$DOSEMUDIR/autoexec.bat"
207
echo "ECHO." >> "$DOSEMUDIR/autoexec.bat"
208
rm -f "$PUBDIR/svardos-dosemu.zip"
643 mateusz.vi 209
zip -rm9jk "$PUBDIR/svardos-$CURDATE-dosemu.zip" "$DOSEMUDIR"
321 mateuszvis 210
rmdir "$DOSEMUDIR"
211
 
316 mateuszvis 212
# prepare the USB bootable image
213
USBIMG=$PUBDIR/svardos-usb.img
214
cp files/boot-svardos.img $USBIMG
215
mcopy -sQm -i "$USBIMG@@32256" "$FLOPROOT/"* ::/
216
for p in $ALLPKGS ; do
700 mateusz.vi 217
  mcopy -mi "$USBIMG@@32256" "$CDROOT/$p.svp" ::/
316 mateuszvis 218
done
219
 
220
# compress the USB image
321 mateuszvis 221
rm -f "$PUBDIR/svardos-usb.zip"
643 mateusz.vi 222
zip -mj9 "$PUBDIR/svardos-$CURDATE-usb.zip" "$USBIMG"
316 mateuszvis 223
 
224
# prepare the USB-ZIP bootable image
225
#USBZIPIMG=$PUBDIR/svardos-usbzip.img
226
#cat files/usb-zip.mbr "$PUBDIR/svardos-zip100.img" > $USBZIPIMG
227
 
643 mateusz.vi 228
CDISO="$PUBDIR/svardos-$CURDATE-cd.iso"
229
CDZIP="$PUBDIR/svardos-$CURDATE-cd.zip"
194 mateuszvis 230
 
204 mateuszvis 231
# delete previous (if any) iso
148 mv_fox 232
echo "cleaning up old versions..."
204 mateuszvis 233
rm -f "$CDISO" "$CDZIP"
25 mv_fox 234
 
279 mateuszvis 235
$GENISOIMAGE -input-charset cp437 -b boot.img -iso-level 1 -f -V SVARDOS -o "$CDISO" "$CDROOT/boot.img"
2 mv_fox 236
 
204 mateuszvis 237
# compress the ISO
238
zip -mj9 "$CDZIP" "$CDISO"
239
 
192 mateuszvis 240
# cleanup temporary things
194 mateuszvis 241
if [ "x$1" != "xnoclean" ] ; then
242
  rm -rf "$CDROOT" "$FLOPROOT"
243
fi
189 mateuszvis 244
 
11 mv_fox 245
cd "$origdir"
246
 
180 mateuszvis 247
#cd svnlschk
248
#./webgen.sh
249
#cd ..
165 mv_fox 250
 
180 mateuszvis 251
echo "ALL DONE!"
16 mv_fox 252
 
2 mv_fox 253
exit 0