Subversion Repositories SvarDOS

Rev

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