Subversion Repositories SvarDOS

Rev

Rev 192 | Rev 195 | 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
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" )
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
 
73
# prepares image for floppy sets of size $1 and in number of $2 floppies
74
function prep_flop {
75
  mkdir $1
76
  mformat -C -f $1 -v SVARDOS -B "$CUSTFILES/floppy.mbr" -i "$1/1.img"
77
  mcopy -sQm -i "$1/1.img" "$FLOPROOT/"* ::/
78
  for i in $(seq 2 $2) ; do
79
    mformat -C -f $1 -v SVARDOS -i "$1/$i.img"
80
  done
81
}
82
 
83
 
134 mv_fox 84
### actual code flow starts here ############################################
85
 
148 mv_fox 86
# check presence of the buildidx tool
87
if [ ! -f "$BUILDIDX" ] ; then
88
  echo "buildidx not found at $BUILDIDX"
112 mv_fox 89
  exit 1
90
fi
91
 
148 mv_fox 92
# remember where I am, so I can get back here once all is done
11 mv_fox 93
origdir=`pwd`
94
 
189 mateuszvis 95
mkdir "$CDROOT"
192 mateuszvis 96
mkdir "$FLOPROOT"
189 mateuszvis 97
 
180 mateuszvis 98
# build the repo (also builds the listing.txt file)
99
dorepo
16 mv_fox 100
 
192 mateuszvis 101
# add CORE packages to CDROOT + create the list of packages on floppy
102
for pkg in "${COREPKGS[@]}" ; do
103
  cp "$REPOROOT/$pkg.zip" "$CDROOT/"
104
  echo "$pkg" >> "$FLOPROOT/install.lst"
105
done
106
 
107
# prepare the content of the boot (install) floppy
108
cp "install/install.com" "$FLOPROOT/"
109
cp "install/nls/"install.?? "$FLOPROOT/"
110
cp -r "$CUSTFILES/floppy/"* "$FLOPROOT/"
111
 
194 mateuszvis 112
# build the boot (CD) floppy image
192 mateuszvis 113
export MTOOLS_NO_VFAT=1
194 mateuszvis 114
mformat -C -f 1440 -v SVARDOS -B "$CUSTFILES/floppy.mbr" -i "$CDROOT/boot.img"
192 mateuszvis 115
mcopy -sQm -i "$CDROOT/boot.img" "$FLOPROOT/"* ::/
116
 
194 mateuszvis 117
# prepare images for floppies in different sizes and numbers
118
prep_flop 1440 3
119
prep_flop 1200 3
120
prep_flop 720 4
121
 
122
# now populate the floppies sets
123
#xxxxxxx
124
 
180 mateuszvis 125
# delete previous (if any) *.iso and *.md5 files
148 mv_fox 126
echo "cleaning up old versions..."
180 mateuszvis 127
rm -f "$PUBDIR/svardos.iso" "$PUBDIR/svardos.iso.md5"
25 mv_fox 128
 
180 mateuszvis 129
CDISO="$PUBDIR/svardos.iso"
162 mv_fox 130
 
180 mateuszvis 131
$GENISOIMAGE -input-charset cp437 -b boot.img -iso-level 1 -f -V SVARDOS -o "$CDISO" "$CDROOT"
2 mv_fox 132
 
192 mateuszvis 133
# cleanup temporary things
194 mateuszvis 134
if [ "x$1" != "xnoclean" ] ; then
135
  rm -rf "$CDROOT" "$FLOPROOT"
136
fi
189 mateuszvis 137
 
180 mateuszvis 138
# compute the MD5 of the ISO file, taking care to include only the filename in it
16 mv_fox 139
echo "computing md5 sums..."
148 mv_fox 140
cd `dirname "$CDISO"`
141
md5sum `basename "$CDISO"` > "$CDISO.md5"
11 mv_fox 142
 
143
cd "$origdir"
144
 
180 mateuszvis 145
#cd svnlschk
146
#./webgen.sh
147
#cd ..
165 mv_fox 148
 
180 mateuszvis 149
echo "ALL DONE!"
16 mv_fox 150
 
2 mv_fox 151
exit 0