Subversion Repositories SvarDOS

Rev

Rev 1808 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1808 Rev 1809
1
#!/bin/bash
1
#!/bin/bash
2
#
2
#
3
# SvarDOS build script
3
# SvarDOS build script
4
# http://svardos.org
4
# http://svardos.org
5
#
5
#
6
# Copyright (C) 2016-2024 Mateusz Viste
6
# Copyright (C) 2016-2024 Mateusz Viste
7
#
7
#
8
# This script builds floppy and CD images. It should be executed each time that
8
# This script builds floppy and CD images. It should be executed each time that
9
# a CORE package has been modified or the build script changed. This is usually
9
# a CORE package has been modified or the build script changed. This is usually
10
# done by the cron.sh script, itself called by a cron job.
10
# done by the cron.sh script, itself called by a cron job.
11
#
11
#
12
# usage: ./build.sh outputdir buildver [noclean] > logfile
12
# usage: ./build.sh outputdir buildver [noclean] > logfile
13
#
13
#
14
 
14
 
15
### parameters block starts here ############################################
15
### parameters block starts here ############################################
16
 
16
 
17
REPOROOT=`realpath ./packages`
17
REPOROOT=`realpath ./packages`
18
REPOROOTCORE=`realpath ./packages-core`
18
REPOROOTCORE=`realpath ./packages-core`
19
CUSTFILES=`realpath ./files`
19
CUSTFILES=`realpath ./files`
20
 
20
 
21
GENISOIMAGE=''    # can be mkisofs, genisoimage or empty for autodetection
21
GENISOIMAGE=''    # can be mkisofs, genisoimage or empty for autodetection
22
 
22
 
23
### parameters block ends here ##############################################
23
### parameters block ends here ##############################################
24
 
24
 
25
# look for mandatory output dir and build id
25
# look for mandatory output dir and build id
26
if [ "x$2" == "x" ] ; then
26
if [ "x$2" == "x" ] ; then
27
  echo "usage: build.sh outputdir buildver [noclean]"
27
  echo "usage: build.sh outputdir buildver [noclean]"
28
  exit 1
28
  exit 1
29
fi
29
fi
30
CURDATE="$2"
30
CURDATE="$2"
31
PUBDIR=`realpath "$1"`
31
PUBDIR=`realpath "$1"`
32
 
32
 
33
CDROOT="$PUBDIR/tmp_cdroot.build"
33
CDROOT="$PUBDIR/tmp_cdroot.build"
34
FLOPROOT="$PUBDIR/tmp_floproot.build"
34
FLOPROOT="$PUBDIR/tmp_floproot.build"
35
 
35
 
36
 
36
 
37
# auto-detect whether to use mkisofs or genisoimage
37
# auto-detect whether to use mkisofs or genisoimage
38
 
38
 
39
if [ "x$GENISOIMAGE" == "x" ] ; then
39
if [ "x$GENISOIMAGE" == "x" ] ; then
40
mkisofs --help 2> /dev/null
40
mkisofs --help 2> /dev/null
41
if [ $? -eq 0 ] ; then
41
if [ $? -eq 0 ] ; then
42
  GENISOIMAGE='mkisofs'
42
  GENISOIMAGE='mkisofs'
43
fi
43
fi
44
fi
44
fi
45
 
45
 
46
if [ "x$GENISOIMAGE" == "x" ] ; then
46
if [ "x$GENISOIMAGE" == "x" ] ; then
47
genisoimage --help 2> /dev/null
47
genisoimage --help 2> /dev/null
48
if [ $? -eq 0 ] ; then
48
if [ $? -eq 0 ] ; then
49
  GENISOIMAGE='genisoimage'
49
  GENISOIMAGE='genisoimage'
50
fi
50
fi
51
fi
51
fi
52
 
52
 
53
if [ "x$GENISOIMAGE" == "x" ] ; then
53
if [ "x$GENISOIMAGE" == "x" ] ; then
54
  echo "ERROR: neither genisoimage nor mkisofs was found on this system"
54
  echo "ERROR: neither genisoimage nor mkisofs was found on this system"
55
  exit 1
55
  exit 1
56
fi
56
fi
57
 
57
 
-
 
58
SED='sed'
-
 
59
if [ `uname` == "Darwin" ] ; then
-
 
60
  SED='gsed'
-
 
61
fi
58
 
62
 
59
# abort if anything fails
63
# abort if anything fails
60
set -e
64
set -e
61
 
65
 
62
 
66
 
63
# list of packages to be part of CORE (always installed)
67
# list of packages to be part of CORE (always installed)
64
COREPKGS=`ls -1 'packages-core' | grep -o '^[a-z]*'`
68
COREPKGS=`ls -1 'packages-core' | grep -o '^[a-z]*'`
65
 
69
 
66
 
70
 
67
 
71
 
68
# prepares image for floppy sets of:
72
# prepares image for floppy sets of:
69
# $1 cylinders
73
# $1 cylinders
70
# $2 heads (sides)
74
# $2 heads (sides)
71
# $3 sectors per track
75
# $3 sectors per track
72
# $4 size
76
# $4 size
73
# $5 working directory (for temporary files etc)
77
# $5 working directory (for temporary files etc)
74
# $6 name of the set (eg. "1440k" or "1440k-EN")
78
# $6 name of the set (eg. "1440k" or "1440k-EN")
75
# $7 list of packages
79
# $7 list of packages
76
# $8 where to put a copy of the image (optional)
80
# $8 where to put a copy of the image (optional)
77
function prep_flop {
81
function prep_flop {
78
  WORKDIR="$5/$6"
82
  WORKDIR="$5/$6"
79
  LIST=$7
83
  LIST=$7
80
  mkdir "$WORKDIR"
84
  mkdir "$WORKDIR"
81
  mformat -C -t $1 -h $2 -s $3 -v $CURDATE -B "$CUSTFILES/floppy.mbr" -i "$WORKDIR/disk1.img"
85
  mformat -C -t $1 -h $2 -s $3 -v $CURDATE -B "$CUSTFILES/floppy.mbr" -i "$WORKDIR/disk1.img"
82
  mcopy -sQm -i "$WORKDIR/disk1.img" "$FLOPROOT/"* ::/
86
  mcopy -sQm -i "$WORKDIR/disk1.img" "$FLOPROOT/"* ::/
83
 
87
 
84
  # now populate the floppies
88
  # now populate the floppies
85
  curdisk=1
89
  curdisk=1
86
 
90
 
87
  while [ ! -z "$LIST" ] ; do
91
  while [ ! -z "$LIST" ] ; do
88
 
92
 
89
    unset PENDING
93
    unset PENDING
90
    for p in $LIST ; do
94
    for p in $LIST ; do
91
      # if copy fails, then probably the floppy is full - try other packages
95
      # if copy fails, then probably the floppy is full - try other packages
92
      # but remember all that fails so they will be retried on a new floppy
96
      # but remember all that fails so they will be retried on a new floppy
93
      if ! mcopy -mi "$WORKDIR/disk$curdisk.img" "$CDROOT/$p.svp" ::/ ; then
97
      if ! mcopy -mi "$WORKDIR/disk$curdisk.img" "$CDROOT/$p.svp" ::/ ; then
94
        PENDING="$PENDING $p"
98
        PENDING="$PENDING $p"
95
      fi
99
      fi
96
    done
100
    done
97
 
101
 
98
    LIST="$PENDING"
102
    LIST="$PENDING"
99
    # if there are any pending items, then create a new floppy and try pushing pending packages to it
103
    # if there are any pending items, then create a new floppy and try pushing pending packages to it
100
    if [ ! -z "$PENDING" ] ; then
104
    if [ ! -z "$PENDING" ] ; then
101
      curdisk=$((curdisk+1))
105
      curdisk=$((curdisk+1))
102
      mformat -C -t $1 -h $2 -s $3 -v SVARDOS -i "$WORKDIR/disk$curdisk.img"
106
      mformat -C -t $1 -h $2 -s $3 -v SVARDOS -i "$WORKDIR/disk$curdisk.img"
103
    fi
107
    fi
104
 
108
 
105
  done
109
  done
106
 
110
 
107
  # add a short readme
111
  # add a short readme
108
  echo "This directory contains a set of $curdisk floppy images of the SvarDOS distribution in the $4 KB floppy format." > "$WORKDIR/readme.txt"
112
  echo "This directory contains a set of $curdisk floppy images of the SvarDOS distribution in the $4 KB floppy format." > "$WORKDIR/readme.txt"
109
  echo "" >> "$WORKDIR/readme.txt"
113
  echo "" >> "$WORKDIR/readme.txt"
110
  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." >> "$WORKDIR/readme.txt"
114
  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." >> "$WORKDIR/readme.txt"
111
  echo "" >> "$WORKDIR/readme.txt"
115
  echo "" >> "$WORKDIR/readme.txt"
112
  echo "Latest SvarDOS version is available on the project's homepage: http://svardos.org" >> "$WORKDIR/readme.txt"
116
  echo "Latest SvarDOS version is available on the project's homepage: http://svardos.org" >> "$WORKDIR/readme.txt"
113
 
117
 
114
  unix2dos "$WORKDIR/readme.txt"
118
  unix2dos "$WORKDIR/readme.txt"
115
 
119
 
116
  # make a copy of the image, if requested
120
  # make a copy of the image, if requested
117
  if [ "x$8" != "x" ] ; then
121
  if [ "x$8" != "x" ] ; then
118
    cp "$WORKDIR/disk1.img" $8
122
    cp "$WORKDIR/disk1.img" $8
119
  fi
123
  fi
120
 
124
 
121
  # zip the images (and remove them at the same time)
125
  # zip the images (and remove them at the same time)
122
  zip -9 -rmj "$PUBDIR/svardos-$CURDATE-floppy-$6.zip" "$WORKDIR"/*
126
  zip -9 -rmj "$PUBDIR/svardos-$CURDATE-floppy-$6.zip" "$WORKDIR"/*
123
 
127
 
124
  # clean up
128
  # clean up
125
  rmdir "$WORKDIR"
129
  rmdir "$WORKDIR"
126
}
130
}
127
 
131
 
128
 
132
 
129
### actual code flow starts here ############################################
133
### actual code flow starts here ############################################
130
 
134
 
131
# remember where I am, so I can get back here once all is done
135
# remember where I am, so I can get back here once all is done
132
origdir=`pwd`
136
origdir=`pwd`
133
 
137
 
134
echo "###############################################################################"
138
echo "###############################################################################"
135
echo " STARTING BUILD $CURDATE"
139
echo " STARTING BUILD $CURDATE"
136
echo "###############################################################################"
140
echo "###############################################################################"
137
echo "dest dir: $PUBDIR"
141
echo "dest dir: $PUBDIR"
138
echo "current time is `date` and it's a beautiful day somewhere in the world"
142
echo "current time is `date` and it's a beautiful day somewhere in the world"
139
echo
143
echo
140
 
144
 
141
mkdir "$CDROOT"
145
mkdir "$CDROOT"
142
mkdir "$FLOPROOT"
146
mkdir "$FLOPROOT"
143
 
147
 
144
# add CORE packages to CDROOT + create the list of packages on floppy
148
# add CORE packages to CDROOT + create the list of packages on floppy
145
for pkg in $COREPKGS ; do
149
for pkg in $COREPKGS ; do
146
  cp "$REPOROOTCORE/$pkg.svp" "$CDROOT/"
150
  cp "$REPOROOTCORE/$pkg.svp" "$CDROOT/"
147
  echo "$pkg" >> "$FLOPROOT/install.lst"
151
  echo "$pkg" >> "$FLOPROOT/install.lst"
148
done
152
done
149
 
153
 
150
# add some extra packages to CDROOT but not in the list of packages to install
154
# add some extra packages to CDROOT but not in the list of packages to install
151
cp "$REPOROOT/pcntpk.svp" "$CDROOT/"
155
cp "$REPOROOT/pcntpk.svp" "$CDROOT/"
152
cp "$REPOROOT/videcdd-2.14.svp" "$CDROOT/videcdd.svp"
156
cp "$REPOROOT/videcdd-2.14.svp" "$CDROOT/videcdd.svp"
153
 
157
 
154
#
158
#
155
 
159
 
156
 
160
 
157
echo
161
echo
158
echo "### Populating the floppy root at $FLOPROOT"
162
echo "### Populating the floppy root at $FLOPROOT"
159
echo
163
echo
160
 
164
 
161
# prepare the content of the boot (install) floppy, unzipping everything
165
# prepare the content of the boot (install) floppy, unzipping everything
162
# in lowercase (-L) to avoid any case mismatching later in the build process
166
# in lowercase (-L) to avoid any case mismatching later in the build process
163
cp -r "$CUSTFILES/floppy/"* "$FLOPROOT/"
167
cp -r "$CUSTFILES/floppy/"* "$FLOPROOT/"
164
unzip -CLj "$REPOROOTCORE/cpidos.svp" 'cpi/ega*.cpx' -d "$FLOPROOT/"
168
unzip -CLj "$REPOROOTCORE/cpidos.svp" 'cpi/ega*.cpx' -d "$FLOPROOT/"
165
unzip -CLj "$REPOROOTCORE/svarcom.svp" command.com -d "$FLOPROOT/"
169
unzip -CLj "$REPOROOTCORE/svarcom.svp" command.com -d "$FLOPROOT/"
166
unzip -CLj "$REPOROOTCORE/display.svp" bin/display.exe -d "$FLOPROOT/"
170
unzip -CLj "$REPOROOTCORE/display.svp" bin/display.exe -d "$FLOPROOT/"
167
unzip -CLj "$REPOROOTCORE/fdapm.svp" bin/fdapm.com -d "$FLOPROOT/"
171
unzip -CLj "$REPOROOTCORE/fdapm.svp" bin/fdapm.com -d "$FLOPROOT/"
168
unzip -CLj "$REPOROOTCORE/fdisk.svp" bin/fdisk.exe -d "$FLOPROOT/"
172
unzip -CLj "$REPOROOTCORE/fdisk.svp" bin/fdisk.exe -d "$FLOPROOT/"
169
unzip -CLj "$REPOROOTCORE/format.svp" bin/format.exe -d "$FLOPROOT/"
173
unzip -CLj "$REPOROOTCORE/format.svp" bin/format.exe -d "$FLOPROOT/"
170
unzip -CLj "$REPOROOTCORE/kernel.svp" bin/kernel.sys bin/sys.com -d "$FLOPROOT/"
174
unzip -CLj "$REPOROOTCORE/kernel.svp" bin/kernel.sys -d "$FLOPROOT/"
171
unzip -CLj "$REPOROOTCORE/mem.svp" bin/mem.exe -d "$FLOPROOT/"
175
unzip -CLj "$REPOROOTCORE/mem.svp" bin/mem.exe -d "$FLOPROOT/"
172
unzip -CLj "$REPOROOTCORE/mode.svp" bin/mode.com -d "$FLOPROOT/"
176
unzip -CLj "$REPOROOTCORE/mode.svp" bin/mode.com -d "$FLOPROOT/"
173
unzip -CLj "$REPOROOTCORE/more.svp" bin/more.com -d "$FLOPROOT/"
177
unzip -CLj "$REPOROOTCORE/more.svp" bin/more.com -d "$FLOPROOT/"
174
unzip -CLj "$REPOROOTCORE/pkg.svp" bin/pkg.exe -d "$FLOPROOT/"
178
unzip -CLj "$REPOROOTCORE/pkg.svp" bin/pkg.exe -d "$FLOPROOT/"
175
unzip -CLj "$REPOROOTCORE/sved.svp" bin/sved.com -d "$FLOPROOT/"
179
unzip -CLj "$REPOROOTCORE/sved.svp" bin/sved.com -d "$FLOPROOT/"
-
 
180
unzip -CLj "$REPOROOTCORE/sys.svp" bin/sys.com -d "$FLOPROOT/"
176
 
181
 
177
# generate a simple autoexec.bat file
182
# generate a simple autoexec.bat file
178
echo '@ECHO OFF' > "$FLOPROOT/autoexec.bat"
183
echo '@ECHO OFF' > "$FLOPROOT/autoexec.bat"
179
echo '' >> "$FLOPROOT/autoexec.bat"
184
echo '' >> "$FLOPROOT/autoexec.bat"
180
echo 'REM Load DISPLAY driver if present' >> "$FLOPROOT/autoexec.bat"
185
echo 'REM Load DISPLAY driver if present' >> "$FLOPROOT/autoexec.bat"
181
echo 'IF EXIST DISPLAY.EXE DISPLAY CON=(EGA,,1)' >> "$FLOPROOT/autoexec.bat"
186
echo 'IF EXIST DISPLAY.EXE DISPLAY CON=(EGA,,1)' >> "$FLOPROOT/autoexec.bat"
182
echo '' >> "$FLOPROOT/autoexec.bat"
187
echo '' >> "$FLOPROOT/autoexec.bat"
183
echo 'FDAPM APMDOS' >> "$FLOPROOT/autoexec.bat"
188
echo 'FDAPM APMDOS' >> "$FLOPROOT/autoexec.bat"
184
echo '' >> "$FLOPROOT/autoexec.bat"
189
echo '' >> "$FLOPROOT/autoexec.bat"
185
echo 'ECHO.' >> "$FLOPROOT/autoexec.bat"
190
echo 'ECHO.' >> "$FLOPROOT/autoexec.bat"
186
echo 'ECHO  ********************' >> "$FLOPROOT/autoexec.bat"
191
echo 'ECHO  ********************' >> "$FLOPROOT/autoexec.bat"
187
echo 'ECHO   WELCOME TO SVARDOS' >> "$FLOPROOT/autoexec.bat"
192
echo 'ECHO   WELCOME TO SVARDOS' >> "$FLOPROOT/autoexec.bat"
188
echo 'ECHO  ********************' >> "$FLOPROOT/autoexec.bat"
193
echo 'ECHO  ********************' >> "$FLOPROOT/autoexec.bat"
189
echo "ECHO  build: $CURDATE" >> "$FLOPROOT/autoexec.bat"
194
echo "ECHO  build: $CURDATE" >> "$FLOPROOT/autoexec.bat"
190
echo 'ECHO.' >> "$FLOPROOT/autoexec.bat"
195
echo 'ECHO.' >> "$FLOPROOT/autoexec.bat"
191
echo '' >> "$FLOPROOT/autoexec.bat"
196
echo '' >> "$FLOPROOT/autoexec.bat"
192
echo "INSTALL" >> "$FLOPROOT/autoexec.bat"
197
echo "INSTALL" >> "$FLOPROOT/autoexec.bat"
193
unix2dos "$FLOPROOT/autoexec.bat"
198
unix2dos "$FLOPROOT/autoexec.bat"
194
 
199
 
195
 
200
 
196
echo
201
echo
197
echo "### Computing the USB image"
202
echo "### Computing the USB image"
198
echo
203
echo
199
 
204
 
200
# prepare the USB bootable image
205
# prepare the USB bootable image
201
USBIMG=$PUBDIR/svardos-usb.img
206
USBIMG=$PUBDIR/svardos-usb.img
202
cp files/boot-svardos.img $USBIMG
207
cp files/boot-svardos.img $USBIMG
203
mlabel -i "$USBIMG@@32256" ::$CURDATE
208
mlabel -i "$USBIMG@@32256" ::$CURDATE
204
mcopy -sQm -i "$USBIMG@@32256" "$FLOPROOT/"* ::/
209
mcopy -sQm -i "$USBIMG@@32256" "$FLOPROOT/"* ::/
205
for p in $COREPKGS ; do
210
for p in $COREPKGS ; do
206
  mcopy -mi "$USBIMG@@32256" "$CDROOT/$p.svp" ::/
211
  mcopy -mi "$USBIMG@@32256" "$CDROOT/$p.svp" ::/
207
done
212
done
208
 
213
 
209
# compress the USB image
214
# compress the USB image
210
zip -mj9 "$PUBDIR/svardos-$CURDATE-usb.zip" "$USBIMG"
215
zip -mj9 "$PUBDIR/svardos-$CURDATE-usb.zip" "$USBIMG"
211
 
216
 
212
 
217
 
213
echo
218
echo
214
echo "### Creating floppy images"
219
echo "### Creating floppy images"
215
echo
220
echo
216
echo "You might notice a lot of DISK FULL warnings below. Do not worry, these"
221
echo "You might notice a lot of DISK FULL warnings below. Do not worry, these"
217
echo "are expected and are perfectly normal. It is a side effect of trying to"
222
echo "are expected and are perfectly normal. It is a side effect of trying to"
218
echo "fit as many packages as possible on the floppy sets."
223
echo "fit as many packages as possible on the floppy sets."
219
echo
224
echo
220
 
225
 
221
# build the boot (CD) floppy image
226
# build the boot (CD) floppy image
222
export MTOOLS_NO_VFAT=1
227
export MTOOLS_NO_VFAT=1
223
 
228
 
224
# prepare images for floppies in different sizes (args are C H S SIZE)
229
# prepare images for floppies in different sizes (args are C H S SIZE)
225
echo "videcdd" >> "$FLOPROOT/install.lst"
230
echo "videcdd" >> "$FLOPROOT/install.lst"
226
prep_flop 80 2 36 2880 "$PUBDIR" "2.88M" "$COREPKGS pcntpk videcdd" "$CDROOT/boot.img"
231
prep_flop 80 2 36 2880 "$PUBDIR" "2.88M" "$COREPKGS pcntpk videcdd" "$CDROOT/boot.img"
227
# no videcdd for non-2.88M images
232
# no videcdd for non-2.88M images
228
sed -i '/^videcdd$/d' "$FLOPROOT/install.lst"
233
$SED -i '/^videcdd$/d' "$FLOPROOT/install.lst"
229
prep_flop 80 2 18 1440 "$PUBDIR" "1.44M" "$COREPKGS pcntpk"
234
prep_flop 80 2 18 1440 "$PUBDIR" "1.44M" "$COREPKGS pcntpk"
230
prep_flop 80 2 15 1200 "$PUBDIR" "1.2M" "$COREPKGS"
235
prep_flop 80 2 15 1200 "$PUBDIR" "1.2M" "$COREPKGS"
231
prep_flop 80 2  9  720 "$PUBDIR" "720K" "$COREPKGS"
236
prep_flop 80 2  9  720 "$PUBDIR" "720K" "$COREPKGS"
232
 
237
 
233
 
238
 
234
echo
239
echo
235
echo "### Computing DOSEMU.zip"
240
echo "### Computing DOSEMU.zip"
236
echo
241
echo
237
 
242
 
238
# prepare the DOSEMU boot zip
243
# prepare the DOSEMU boot zip
239
DOSEMUDIR="$PUBDIR/tmp_dosemu-prep-files.build"
244
DOSEMUDIR="$PUBDIR/tmp_dosemu-prep-files.build"
240
mkdir "$DOSEMUDIR"
245
mkdir "$DOSEMUDIR"
241
# INSTALL.BAT
246
# INSTALL.BAT
242
echo 'IF NOT EXIST C:\TEMP\NUL MKDIR C:\TEMP' >> "$DOSEMUDIR/install.bat"
247
echo 'IF NOT EXIST C:\TEMP\NUL MKDIR C:\TEMP' >> "$DOSEMUDIR/install.bat"
243
echo 'mkdir %DOSDIR%' >> "$DOSEMUDIR/install.bat"
248
echo 'mkdir %DOSDIR%' >> "$DOSEMUDIR/install.bat"
244
echo 'mkdir %DOSDIR%\cfg' >> "$DOSEMUDIR/install.bat"
249
echo 'mkdir %DOSDIR%\cfg' >> "$DOSEMUDIR/install.bat"
245
echo 'ECHO # pkg config file - specifies locations where packages should be installed >> %DOSDIR%\cfg\pkg.cfg' >> "$DOSEMUDIR/install.bat"
250
echo 'ECHO # pkg config file - specifies locations where packages should be installed >> %DOSDIR%\cfg\pkg.cfg' >> "$DOSEMUDIR/install.bat"
246
echo 'ECHO DIR BIN %DOSDIR% >> %DOSDIR%\cfg\pkg.cfg' >> "$DOSEMUDIR/install.bat"
251
echo 'ECHO DIR BIN %DOSDIR% >> %DOSDIR%\cfg\pkg.cfg' >> "$DOSEMUDIR/install.bat"
247
echo 'ECHO DIR PROGS C:\ >> %DOSDIR%\cfg\pkg.cfg' >> "$DOSEMUDIR/install.bat"
252
echo 'ECHO DIR PROGS C:\ >> %DOSDIR%\cfg\pkg.cfg' >> "$DOSEMUDIR/install.bat"
248
echo 'ECHO DIR GAMES C:\ >> %DOSDIR%\cfg\pkg.cfg' >> "$DOSEMUDIR/install.bat"
253
echo 'ECHO DIR GAMES C:\ >> %DOSDIR%\cfg\pkg.cfg' >> "$DOSEMUDIR/install.bat"
249
echo 'ECHO DIR DRIVERS C:\DRIVERS\ >> %DOSDIR%\cfg\pkg.cfg' >> "$DOSEMUDIR/install.bat"
254
echo 'ECHO DIR DRIVERS C:\DRIVERS\ >> %DOSDIR%\cfg\pkg.cfg' >> "$DOSEMUDIR/install.bat"
250
echo 'ECHO DIR DEVEL C:\DEVEL\ >> %DOSDIR%\cfg\pkg.cfg' >> "$DOSEMUDIR/install.bat"
255
echo 'ECHO DIR DEVEL C:\DEVEL\ >> %DOSDIR%\cfg\pkg.cfg' >> "$DOSEMUDIR/install.bat"
251
for p in $COREPKGS ; do
256
for p in $COREPKGS ; do
252
  cp "$CDROOT/$p.svp" "$DOSEMUDIR/"
257
  cp "$CDROOT/$p.svp" "$DOSEMUDIR/"
253
  echo "pkg install $p.svp" >> "$DOSEMUDIR/install.bat"
258
  echo "pkg install $p.svp" >> "$DOSEMUDIR/install.bat"
254
  echo "del $p.svp" >> "$DOSEMUDIR/install.bat"
259
  echo "del $p.svp" >> "$DOSEMUDIR/install.bat"
255
done
260
done
256
echo 'ECHO my_ip = dhcp >> %DOSDIR%\CFG\WATTCP.CFG' >> "$DOSEMUDIR/install.bat"
261
echo 'ECHO my_ip = dhcp >> %DOSDIR%\CFG\WATTCP.CFG' >> "$DOSEMUDIR/install.bat"
257
echo 'del pkg.exe' >> "$DOSEMUDIR/install.bat"
262
echo 'del pkg.exe' >> "$DOSEMUDIR/install.bat"
258
echo 'DEL C:\CONFIG.SYS' >> "$DOSEMUDIR/install.bat"
263
echo 'DEL C:\CONFIG.SYS' >> "$DOSEMUDIR/install.bat"
259
echo 'COPY C:\CONFIG.NEW C:\CONFIG.SYS' >> "$DOSEMUDIR/install.bat"
264
echo 'COPY C:\CONFIG.NEW C:\CONFIG.SYS' >> "$DOSEMUDIR/install.bat"
260
echo 'DEL C:\CONFIG.NEW' >> "$DOSEMUDIR/install.bat"
265
echo 'DEL C:\CONFIG.NEW' >> "$DOSEMUDIR/install.bat"
261
echo 'SET COMSPEC=C:\COMMAND.COM' >> "$DOSEMUDIR/install.bat"
266
echo 'SET COMSPEC=C:\COMMAND.COM' >> "$DOSEMUDIR/install.bat"
262
echo 'DEL C:\CMD.COM' >> "$DOSEMUDIR/install.bat"
267
echo 'DEL C:\CMD.COM' >> "$DOSEMUDIR/install.bat"
263
echo 'ECHO.' >> "$DOSEMUDIR/install.bat"
268
echo 'ECHO.' >> "$DOSEMUDIR/install.bat"
264
echo 'ECHO -------------------------' >> "$DOSEMUDIR/install.bat"
269
echo 'ECHO -------------------------' >> "$DOSEMUDIR/install.bat"
265
echo 'ECHO  SVARDOS SETUP COMPLETED' >> "$DOSEMUDIR/install.bat"
270
echo 'ECHO  SVARDOS SETUP COMPLETED' >> "$DOSEMUDIR/install.bat"
266
echo 'ECHO   PLEASE RESTART DOSEMU' >> "$DOSEMUDIR/install.bat"
271
echo 'ECHO   PLEASE RESTART DOSEMU' >> "$DOSEMUDIR/install.bat"
267
echo 'ECHO -------------------------' >> "$DOSEMUDIR/install.bat"
272
echo 'ECHO -------------------------' >> "$DOSEMUDIR/install.bat"
268
echo 'ECHO.' >> "$DOSEMUDIR/install.bat"
273
echo 'ECHO.' >> "$DOSEMUDIR/install.bat"
269
unzip -Cj "$REPOROOTCORE/kernel.svp" bin/kernel.sys -d "$DOSEMUDIR/"
274
unzip -Cj "$REPOROOTCORE/kernel.svp" bin/kernel.sys -d "$DOSEMUDIR/"
270
unzip -CLj "$REPOROOTCORE/svarcom.svp" command.com -d "$DOSEMUDIR/"
275
unzip -CLj "$REPOROOTCORE/svarcom.svp" command.com -d "$DOSEMUDIR/"
271
mv "$DOSEMUDIR/command.com" "$DOSEMUDIR/cmd.com"
276
mv "$DOSEMUDIR/command.com" "$DOSEMUDIR/cmd.com"
272
unzip -Cj "$REPOROOTCORE/pkg.svp" bin/pkg.exe -d "$DOSEMUDIR/"
277
unzip -Cj "$REPOROOTCORE/pkg.svp" bin/pkg.exe -d "$DOSEMUDIR/"
273
# CONFIG.SYS
278
# CONFIG.SYS
274
echo 'FILES=25' >> "$DOSEMUDIR/config.sys"
279
echo 'FILES=25' >> "$DOSEMUDIR/config.sys"
275
echo 'DOS=HIGH,UMB' >> "$DOSEMUDIR/config.sys"
280
echo 'DOS=HIGH,UMB' >> "$DOSEMUDIR/config.sys"
276
echo 'DOSDATA=UMB' >> "$DOSEMUDIR/config.sys"
281
echo 'DOSDATA=UMB' >> "$DOSEMUDIR/config.sys"
277
echo 'DEVICE=D:\dosemu\emufs.sys' >> "$DOSEMUDIR/config.sys"
282
echo 'DEVICE=D:\dosemu\emufs.sys' >> "$DOSEMUDIR/config.sys"
278
echo 'DEVICE=D:\dosemu\umb.sys' >> "$DOSEMUDIR/config.sys"
283
echo 'DEVICE=D:\dosemu\umb.sys' >> "$DOSEMUDIR/config.sys"
279
echo 'DEVICEHIGH=D:\dosemu\ems.sys' >> "$DOSEMUDIR/config.sys"
284
echo 'DEVICEHIGH=D:\dosemu\ems.sys' >> "$DOSEMUDIR/config.sys"
280
echo 'INSTALL=D:\dosemu\emufs.com' >> "$DOSEMUDIR/config.sys"
285
echo 'INSTALL=D:\dosemu\emufs.com' >> "$DOSEMUDIR/config.sys"
281
cp "$DOSEMUDIR/config.sys" "$DOSEMUDIR/config.new"
286
cp "$DOSEMUDIR/config.sys" "$DOSEMUDIR/config.new"
282
echo 'SHELL=C:\CMD.COM /P' >> "$DOSEMUDIR/config.sys"
287
echo 'SHELL=C:\CMD.COM /P' >> "$DOSEMUDIR/config.sys"
283
echo 'SHELL=C:\COMMAND.COM /P' >> "$DOSEMUDIR/config.new"
288
echo 'SHELL=C:\COMMAND.COM /P' >> "$DOSEMUDIR/config.new"
284
# AUTOEXEC.BAT
289
# AUTOEXEC.BAT
285
echo "@ECHO OFF" >> "$DOSEMUDIR/autoexec.bat"
290
echo "@ECHO OFF" >> "$DOSEMUDIR/autoexec.bat"
286
echo 'SET DOSDIR=C:\SVARDOS' >> "$DOSEMUDIR/autoexec.bat"
291
echo 'SET DOSDIR=C:\SVARDOS' >> "$DOSEMUDIR/autoexec.bat"
287
echo 'SET WATTCP.CFG=%DOSDIR%\CFG' >> "$DOSEMUDIR/autoexec.bat"
292
echo 'SET WATTCP.CFG=%DOSDIR%\CFG' >> "$DOSEMUDIR/autoexec.bat"
288
echo 'SET DIRCMD=/p/ogne' >> "$DOSEMUDIR/autoexec.bat"
293
echo 'SET DIRCMD=/p/ogne' >> "$DOSEMUDIR/autoexec.bat"
289
echo 'SET TEMP=C:\TEMP' >> "$DOSEMUDIR/autoexec.bat"
294
echo 'SET TEMP=C:\TEMP' >> "$DOSEMUDIR/autoexec.bat"
290
echo 'PATH %DOSDIR%' >> "$DOSEMUDIR/autoexec.bat"
295
echo 'PATH %DOSDIR%' >> "$DOSEMUDIR/autoexec.bat"
291
echo "" >> "$DOSEMUDIR/autoexec.bat"
296
echo "" >> "$DOSEMUDIR/autoexec.bat"
292
echo 'IF NOT EXIST INSTALL.BAT GOTO NORMBOOT' >> "$DOSEMUDIR/autoexec.bat"
297
echo 'IF NOT EXIST INSTALL.BAT GOTO NORMBOOT' >> "$DOSEMUDIR/autoexec.bat"
293
echo "REM *** this is a one-time setup script used only during first initialization ***" >> "$DOSEMUDIR/autoexec.bat"
298
echo "REM *** this is a one-time setup script used only during first initialization ***" >> "$DOSEMUDIR/autoexec.bat"
294
echo 'CALL INSTALL.BAT' >> "$DOSEMUDIR/autoexec.bat"
299
echo 'CALL INSTALL.BAT' >> "$DOSEMUDIR/autoexec.bat"
295
echo 'DEL INSTALL.BAT' >> "$DOSEMUDIR/autoexec.bat"
300
echo 'DEL INSTALL.BAT' >> "$DOSEMUDIR/autoexec.bat"
296
echo 'GOTO ENDOFFILE' >> "$DOSEMUDIR/autoexec.bat"
301
echo 'GOTO ENDOFFILE' >> "$DOSEMUDIR/autoexec.bat"
297
echo "" >> "$DOSEMUDIR/autoexec.bat"
302
echo "" >> "$DOSEMUDIR/autoexec.bat"
298
echo ":NORMBOOT" >> "$DOSEMUDIR/autoexec.bat"
303
echo ":NORMBOOT" >> "$DOSEMUDIR/autoexec.bat"
299
echo "ECHO." >> "$DOSEMUDIR/autoexec.bat"
304
echo "ECHO." >> "$DOSEMUDIR/autoexec.bat"
300
echo "ECHO Welcome to SvarDOS (powered by DOSEMU)! Type HELP if you are lost." >> "$DOSEMUDIR/autoexec.bat"
305
echo "ECHO Welcome to SvarDOS (powered by DOSEMU)! Type HELP if you are lost." >> "$DOSEMUDIR/autoexec.bat"
301
echo "ECHO." >> "$DOSEMUDIR/autoexec.bat"
306
echo "ECHO." >> "$DOSEMUDIR/autoexec.bat"
302
echo ":ENDOFFILE" >> "$DOSEMUDIR/autoexec.bat"
307
echo ":ENDOFFILE" >> "$DOSEMUDIR/autoexec.bat"
303
rm -f "$PUBDIR/svardos-dosemu.zip"
308
rm -f "$PUBDIR/svardos-dosemu.zip"
304
zip -rm9jk "$PUBDIR/svardos-$CURDATE-dosemu.zip" "$DOSEMUDIR"
309
zip -rm9jk "$PUBDIR/svardos-$CURDATE-dosemu.zip" "$DOSEMUDIR"
305
rmdir "$DOSEMUDIR"
310
rmdir "$DOSEMUDIR"
306
 
311
 
307
echo
312
echo
308
echo "### Generating ISO CD image"
313
echo "### Generating ISO CD image"
309
echo
314
echo
310
 
315
 
311
CDISO="$PUBDIR/svardos-$CURDATE-cd.iso"
316
CDISO="$PUBDIR/svardos-$CURDATE-cd.iso"
312
CDZIP="$PUBDIR/svardos-$CURDATE-cd.zip"
317
CDZIP="$PUBDIR/svardos-$CURDATE-cd.zip"
313
 
318
 
314
$GENISOIMAGE -input-charset cp437 -b boot.img -iso-level 1 -f -V SVARDOS -o "$CDISO" "$CDROOT/boot.img"
319
$GENISOIMAGE -input-charset cp437 -b boot.img -iso-level 1 -f -V SVARDOS -o "$CDISO" "$CDROOT/boot.img"
315
 
320
 
316
# compress the ISO
321
# compress the ISO
317
zip -mj9 "$CDZIP" "$CDISO"
322
zip -mj9 "$CDZIP" "$CDISO"
318
 
323
 
319
 
324
 
320
###############################################################################
325
###############################################################################
321
# remove internationalization files for EN-ONLY releases. This is the only    #
326
# remove internationalization files for EN-ONLY releases. This is the only    #
322
# way to build the 360K variant                                               #
327
# way to build the 360K variant                                               #
323
###############################################################################
328
###############################################################################
324
 
329
 
325
rm "$FLOPROOT"/*.cpx
330
rm "$FLOPROOT"/*.cpx
326
rm "$FLOPROOT"/install.lng
331
rm "$FLOPROOT"/install.lng
327
rm "$FLOPROOT"/display.exe
332
rm "$FLOPROOT"/display.exe
328
rm "$FLOPROOT"/mode.com
333
rm "$FLOPROOT"/mode.com
329
 
334
 
330
###############################################################################
335
###############################################################################
331
# remove NLS and LNG files from packages to build EN-ONLY builds              #
336
# remove NLS and LNG files from packages to build EN-ONLY builds              #
332
###############################################################################
337
###############################################################################
333
 
338
 
334
echo "### remove NLS and LNG files from packages to build EN-ONLY builds"
339
echo "### remove NLS and LNG files from packages to build EN-ONLY builds"
335
for p in $COREPKGS ; do
340
for p in $COREPKGS ; do
336
  # the || true bit is because zip returns a non-zero exit code on no file match
341
  # the || true bit is because zip returns a non-zero exit code on no file match
337
  zip -dq "$CDROOT/$p.svp" 'bin/*.lng' 'BIN/*.LNG' 'nls/*' 'NLS/*' || true
342
  zip -dq "$CDROOT/$p.svp" 'bin/*.lng' 'BIN/*.LNG' 'nls/*' 'NLS/*' || true
338
done
343
done
339
 
344
 
340
prep_flop 80 2 18 1440 "$PUBDIR" "1.44M-EN_ONLY" "$COREPKGS"
345
prep_flop 80 2 18 1440 "$PUBDIR" "1.44M-EN_ONLY" "$COREPKGS"
341
#prep_flop 80 2 21 1680 "$PUBDIR" "1.44M-DMF-EN_ONLY"
346
#prep_flop 80 2 21 1680 "$PUBDIR" "1.44M-DMF-EN_ONLY"
342
prep_flop 80 2 15 1200 "$PUBDIR" "1.2M-EN_ONLY" "$COREPKGS"
347
prep_flop 80 2 15 1200 "$PUBDIR" "1.2M-EN_ONLY" "$COREPKGS"
343
prep_flop 80 2  9  720 "$PUBDIR" "720K-EN_ONLY" "$COREPKGS"
348
prep_flop 80 2  9  720 "$PUBDIR" "720K-EN_ONLY" "$COREPKGS"
344
prep_flop 40 2  9  360 "$PUBDIR" "360K-EN_ONLY" "$COREPKGS"
349
prep_flop 40 2  9  360 "$PUBDIR" "360K-EN_ONLY" "$COREPKGS"
345
 
350
 
346
 
351
 
347
###############################################################################
352
###############################################################################
348
# compute the svardos stub, useful for migrating alien DOS systems to SvarDOS #
353
# compute the svardos stub, useful for migrating alien DOS systems to SvarDOS #
349
###############################################################################
354
###############################################################################
350
 
355
 
351
echo
356
echo
352
echo "### generating the pkgstub zip archive"
357
echo "### generating the pkgstub zip archive"
353
 
358
 
354
mkdir "$PUBDIR"/pkgstub
359
mkdir "$PUBDIR"/pkgstub
355
unzip -jC "$REPOROOTCORE"/pkgnet.svp bin/pkgnet.exe -d "$PUBDIR"/pkgstub
360
unzip -jC "$REPOROOTCORE"/pkgnet.svp bin/pkgnet.exe -d "$PUBDIR"/pkgstub
356
unzip -jC "$REPOROOTCORE"/pkg.svp bin/pkg.exe -d "$PUBDIR"/pkgstub
361
unzip -jC "$REPOROOTCORE"/pkg.svp bin/pkg.exe -d "$PUBDIR"/pkgstub
357
 
362
 
358
cat <<EOF > "$PUBDIR"/pkgstub/readme.txt
363
cat <<EOF > "$PUBDIR"/pkgstub/readme.txt
359
 
364
 
360
        SvarDOS stub, or how to plant a SvarDOS seed in a foreign land
365
        SvarDOS stub, or how to plant a SvarDOS seed in a foreign land
361
        --------------------------------------------------------------
366
        --------------------------------------------------------------
362
 
367
 
363
This archive contains files that allow to install a SvarDOS stub within
368
This archive contains files that allow to install a SvarDOS stub within
364
another DOS system. This makes it possible to use the SvarDOS online repository
369
another DOS system. This makes it possible to use the SvarDOS online repository
365
of packages on non-SvarDOS systems, assuming you have a network card connected
370
of packages on non-SvarDOS systems, assuming you have a network card connected
366
to the internet and a suitable packet driver.
371
to the internet and a suitable packet driver.
367
 
372
 
368
If you do not have internet connectivity, then you will still be able to
373
If you do not have internet connectivity, then you will still be able to
369
install SvarDOS packages (*.SVP) once you copy them to your PC. You can fetch
374
install SvarDOS packages (*.SVP) once you copy them to your PC. You can fetch
370
SvarDOS packages at <http://svardos.org>.
375
SvarDOS packages at <http://svardos.org>.
371
 
376
 
372
Follow the guide now:
377
Follow the guide now:
373
 
378
 
374
=======================================
379
=======================================
375
MKDIR C:\\SVARDOS
380
MKDIR C:\\SVARDOS
376
MKDIR C:\\SVARDOS\\CFG
381
MKDIR C:\\SVARDOS\\CFG
377
 
382
 
378
SET WATTCP.CFG=C:\\SVARDOS\\CFG
383
SET WATTCP.CFG=C:\\SVARDOS\\CFG
379
SET DOSDIR=C:\\SVARDOS
384
SET DOSDIR=C:\\SVARDOS
380
SET LANG=EN
385
SET LANG=EN
381
SET PATH=%PATH%;C:\SVARDOS
386
SET PATH=%PATH%;C:\SVARDOS
382
 
387
 
383
COPY *.EXE C:\\SVARDOS\\
388
COPY *.EXE C:\\SVARDOS\\
384
COPY *.CFG C:\\SVARDOS\CFG\\
389
COPY *.CFG C:\\SVARDOS\CFG\\
385
=======================================
390
=======================================
386
 
391
 
387
If in doubt, reach out to us at <http://svardos.org>.
392
If in doubt, reach out to us at <http://svardos.org>.
388
EOF
393
EOF
389
 
394
 
390
cat <<EOF > "$PUBDIR"/pkgstub/wattcp.cfg
395
cat <<EOF > "$PUBDIR"/pkgstub/wattcp.cfg
391
# Rely on DHCP by default
396
# Rely on DHCP by default
392
my_ip = dhcp
397
my_ip = dhcp
393
 
398
 
394
# modify (and uncomment) these if you have a fix IP setup:
399
# modify (and uncomment) these if you have a fix IP setup:
395
#
400
#
396
#my_ip = 0.0.0.0  ; IP address
401
#my_ip = 0.0.0.0  ; IP address
397
#netmask = 255.255.255.0  ; netmask
402
#netmask = 255.255.255.0  ; netmask
398
#nameserver = 0.0.0.0  ; primary DNS, mandatory if not using DHCP
403
#nameserver = 0.0.0.0  ; primary DNS, mandatory if not using DHCP
399
#nameserver = 0.0.0.0  ; secondary DNS, optional
404
#nameserver = 0.0.0.0  ; secondary DNS, optional
400
#gateway = 0.0.0.0  ; default gateway
405
#gateway = 0.0.0.0  ; default gateway
401
EOF
406
EOF
402
 
407
 
403
cat <<EOF > "$PUBDIR"/pkgstub/pkg.cfg
408
cat <<EOF > "$PUBDIR"/pkgstub/pkg.cfg
404
# pkg config file - specifies locations where SvarDOS packages will be installed
409
# pkg config file - specifies locations where SvarDOS packages will be installed
405
 
410
 
406
# SvarDOS core files
411
# SvarDOS core files
407
DIR BIN C:\\SVARDOS\\
412
DIR BIN C:\\SVARDOS\\
408
 
413
 
409
# General location for programs
414
# General location for programs
410
DIR PROGS C:\\
415
DIR PROGS C:\\
411
 
416
 
412
# Games
417
# Games
413
DIR GAMES C:\\
418
DIR GAMES C:\\
414
 
419
 
415
# Drivers
420
# Drivers
416
DIR DRIVERS C:\\DRIVERS\\
421
DIR DRIVERS C:\\DRIVERS\\
417
 
422
 
418
# Development tools
423
# Development tools
419
DIR DEVEL C:\\DEVEL\\
424
DIR DEVEL C:\\DEVEL\\
420
EOF
425
EOF
421
 
426
 
422
zip -m -k9jr "$PUBDIR"/svarstub.zip "$PUBDIR"/pkgstub
427
zip -m -k9jr "$PUBDIR"/svarstub.zip "$PUBDIR"/pkgstub
423
rmdir "$PUBDIR"/pkgstub
428
rmdir "$PUBDIR"/pkgstub
424
 
429
 
425
 
430
 
426
 
431
 
427
###############################################################################
432
###############################################################################
428
# cleanup all temporary things                                                #
433
# cleanup all temporary things                                                #
429
###############################################################################
434
###############################################################################
430
 
435
 
431
if [ "x$2" != "xnoclean" ] ; then
436
if [ "x$2" != "xnoclean" ] ; then
432
  echo
437
  echo
433
  echo "### Cleanup of temporary directories:"
438
  echo "### Cleanup of temporary directories:"
434
  echo "# $CDROOT"
439
  echo "# $CDROOT"
435
  echo "# $FLOPROOT"
440
  echo "# $FLOPROOT"
436
  echo
441
  echo
437
  rm -rf "$CDROOT" "$FLOPROOT"
442
  rm -rf "$CDROOT" "$FLOPROOT"
438
fi
443
fi
439
 
444
 
440
cd "$origdir"
445
cd "$origdir"
441
 
446
 
442
echo
447
echo
443
echo "### ALL DONE! ###"
448
echo "### ALL DONE! ###"
444
 
449
 
445
exit 0
450
exit 0
446
 
451