Subversion Repositories SvarDOS

Rev

Rev 246 | Rev 281 | 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
279 mateuszvis 55
COREPKGS="attrib chkdsk choice command cpidos ctmouse deltree devload diskcopy display dosfsck edit fc fdapm fdisk format himemx kernel keyb keyb_lay label mem mode more move pkg pkgnet 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
279 mateuszvis 78
# $5 where to put a copy of the image (optional)
194 mateuszvis 79
function prep_flop {
246 mateuszvis 80
  mkdir $4
81
  mformat -C -t $1 -h $2 -s $3 -v SVARDOS -B "$CUSTFILES/floppy.mbr" -i "$4/disk1.img"
82
  mcopy -sQm -i "$4/disk1.img" "$FLOPROOT/"* ::/
196 mateuszvis 83
 
84
  # now populate the floppies
85
  curdisk=1
198 mateuszvis 86
  for p in $COREPKGS ; do
196 mateuszvis 87
    # if copy fails, then probably the floppy is full - try again after
88
    # creating an additional floppy image
246 mateuszvis 89
    if ! mcopy -mi "$4/disk$curdisk.img" "$CDROOT/$p.zip" ::/ ; then
196 mateuszvis 90
      curdisk=$((curdisk+1))
246 mateuszvis 91
      mformat -C -t $1 -h $2 -s $3 -v SVARDOS -i "$4/disk$curdisk.img"
92
      mcopy -mi "$4/disk$curdisk.img" "$CDROOT/$p.zip" ::/
196 mateuszvis 93
    fi
194 mateuszvis 94
  done
196 mateuszvis 95
 
205 mateuszvis 96
  # add a short readme
246 mateuszvis 97
  echo "This directory contains a set of $curdisk floppy images of the SvarDOS distribution in the $4 KB floppy format." > "$4/readme.txt"
98
  echo "" >> "$4/readme.txt"
99
  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"
100
  echo "" >> "$4/readme.txt"
101
  echo "Latest SvarDOS version is available on the project's homepage: http://svardos.osdn.io" >> "$4/readme.txt"
205 mateuszvis 102
 
246 mateuszvis 103
  unix2dos "$4/readme.txt"
205 mateuszvis 104
 
279 mateuszvis 105
  # make a copy of the image, if requested
106
  if [ "x$5" != "x" ] ; then
107
    cp "$4/disk1.img" $5
108
  fi
109
 
196 mateuszvis 110
  # zip the images (and remove them at the same time)
246 mateuszvis 111
  rm -f "$PUBDIR/svardos-floppy-$4k.zip"
112
  zip -9 -rmj "$PUBDIR/svardos-floppy-$4k.zip" $4/*
196 mateuszvis 113
 
114
  # clean up
246 mateuszvis 115
  rmdir $4
194 mateuszvis 116
}
117
 
118
 
134 mv_fox 119
### actual code flow starts here ############################################
120
 
148 mv_fox 121
# check presence of the buildidx tool
122
if [ ! -f "$BUILDIDX" ] ; then
123
  echo "buildidx not found at $BUILDIDX"
112 mv_fox 124
  exit 1
125
fi
126
 
148 mv_fox 127
# remember where I am, so I can get back here once all is done
11 mv_fox 128
origdir=`pwd`
129
 
189 mateuszvis 130
mkdir "$CDROOT"
192 mateuszvis 131
mkdir "$FLOPROOT"
189 mateuszvis 132
 
180 mateuszvis 133
# build the repo (also builds the listing.txt file)
134
dorepo
16 mv_fox 135
 
192 mateuszvis 136
# add CORE packages to CDROOT + create the list of packages on floppy
195 mateuszvis 137
for pkg in $COREPKGS ; do
192 mateuszvis 138
  cp "$REPOROOT/$pkg.zip" "$CDROOT/"
139
  echo "$pkg" >> "$FLOPROOT/install.lst"
140
done
141
 
142
# prepare the content of the boot (install) floppy
143
cp "install/install.com" "$FLOPROOT/"
144
cp "install/nls/"install.?? "$FLOPROOT/"
145
cp -r "$CUSTFILES/floppy/"* "$FLOPROOT/"
279 mateuszvis 146
unzip -j packages/pkg.zip bin/pkg.exe -d "$FLOPROOT/"
192 mateuszvis 147
 
194 mateuszvis 148
# build the boot (CD) floppy image
192 mateuszvis 149
export MTOOLS_NO_VFAT=1
279 mateuszvis 150
#mformat -C -f 2880 -v SVARDOS -B "$CUSTFILES/floppy.mbr" -i "$CDROOT/boot.img"
151
#mcopy -sQm -i "$CDROOT/boot.img" "$FLOPROOT/"* ::/
192 mateuszvis 152
 
246 mateuszvis 153
# prepare images for floppies in different sizes (args are C H S SIZE)
279 mateuszvis 154
prep_flop 80 2 36 2880 "$CDROOT/boot.img"
246 mateuszvis 155
prep_flop 80 2 18 1440
156
prep_flop 80 2 15 1200
157
prep_flop 80 2  9  720
194 mateuszvis 158
 
204 mateuszvis 159
CDISO="$PUBDIR/svardos-cd.iso"
160
CDZIP="$PUBDIR/svardos-cd.zip"
194 mateuszvis 161
 
204 mateuszvis 162
# delete previous (if any) iso
148 mv_fox 163
echo "cleaning up old versions..."
204 mateuszvis 164
rm -f "$CDISO" "$CDZIP"
25 mv_fox 165
 
279 mateuszvis 166
$GENISOIMAGE -input-charset cp437 -b boot.img -iso-level 1 -f -V SVARDOS -o "$CDISO" "$CDROOT/boot.img"
2 mv_fox 167
 
204 mateuszvis 168
# compress the ISO
169
zip -mj9 "$CDZIP" "$CDISO"
170
 
192 mateuszvis 171
# cleanup temporary things
194 mateuszvis 172
if [ "x$1" != "xnoclean" ] ; then
173
  rm -rf "$CDROOT" "$FLOPROOT"
174
fi
189 mateuszvis 175
 
11 mv_fox 176
cd "$origdir"
177
 
180 mateuszvis 178
#cd svnlschk
179
#./webgen.sh
180
#cd ..
165 mv_fox 181
 
180 mateuszvis 182
echo "ALL DONE!"
16 mv_fox 183
 
2 mv_fox 184
exit 0