Subversion Repositories SvarDOS

Rev

Rev 192 | Rev 195 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 192 Rev 194
1
#!/bin/bash
1
#!/bin/bash
2
#
2
#
3
# SvarDOS build script
3
# SvarDOS build script
4
# http://svardos.osdn.io
4
# http://svardos.osdn.io
5
# Copyright (C) 2016-2021 Mateusz Viste
5
# Copyright (C) 2016-2021 Mateusz Viste
6
#
6
#
7
# This script generates the SvarDOS repository index and builds ISO CD images.
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
8
# It should be executed each time that a package has been modified, added or
9
# removed.
9
# removed.
10
#
10
#
-
 
11
# usage: ./build.sh [noclean]
-
 
12
#
11
 
13
 
12
### parameters block starts here ############################################
14
### parameters block starts here ############################################
13
 
15
 
14
PKGDIR=`realpath ./packages`
16
PKGDIR=`realpath ./packages`
15
REPOROOT=`realpath ./website/repo`
17
REPOROOT=`realpath ./website/repo`
16
BUILDIDX=`realpath ./buildidx/buildidx`
18
BUILDIDX=`realpath ./buildidx/buildidx`
17
PUBDIR=`realpath ./website/download`
19
PUBDIR=`realpath ./website/download`
18
CDROOT=`realpath ./cdroot`
20
CDROOT=`realpath ./cdroot`
19
FLOPROOT=`realpath ./floproot`
21
FLOPROOT=`realpath ./floproot`
20
CUSTFILES=`realpath ./files`
22
CUSTFILES=`realpath ./files`
21
 
23
 
22
GENISOIMAGE=''    # can be mkisofs, genisoimage or empty for autodetection
24
GENISOIMAGE=''    # can be mkisofs, genisoimage or empty for autodetection
23
 
25
 
24
### parameters block ends here ##############################################
26
### parameters block ends here ##############################################
25
 
27
 
26
# auto-detect whether to use mkisofs or genisoimage
28
# auto-detect whether to use mkisofs or genisoimage
27
 
29
 
28
if [ "x$GENISOIMAGE" == "x" ] ; then
30
if [ "x$GENISOIMAGE" == "x" ] ; then
29
mkisofs --help 2> /dev/null
31
mkisofs --help 2> /dev/null
30
if [ $? -eq 0 ] ; then
32
if [ $? -eq 0 ] ; then
31
  GENISOIMAGE='mkisofs'
33
  GENISOIMAGE='mkisofs'
32
fi
34
fi
33
fi
35
fi
34
 
36
 
35
if [ "x$GENISOIMAGE" == "x" ] ; then
37
if [ "x$GENISOIMAGE" == "x" ] ; then
36
genisoimage --help 2> /dev/null
38
genisoimage --help 2> /dev/null
37
if [ $? -eq 0 ] ; then
39
if [ $? -eq 0 ] ; then
38
  GENISOIMAGE='genisoimage'
40
  GENISOIMAGE='genisoimage'
39
fi
41
fi
40
fi
42
fi
41
 
43
 
42
if [ "x$GENISOIMAGE" == "x" ] ; then
44
if [ "x$GENISOIMAGE" == "x" ] ; then
43
  echo "ERROR: neither genisoimage nor mkisofs was found on this system"
45
  echo "ERROR: neither genisoimage nor mkisofs was found on this system"
44
  exit 1
46
  exit 1
45
fi
47
fi
46
 
48
 
47
 
49
 
48
# abort if anything fails
50
# abort if anything fails
49
set -e
51
set -e
50
 
52
 
51
 
53
 
52
# list of packages to be part of CORE
54
# list of packages to be part of CORE
53
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" )
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" )
54
 
56
 
55
 
57
 
56
 
58
 
57
# function that builds the packages repository
59
# function that builds the packages repository
58
function dorepo {
60
function dorepo {
59
  # copy all zip files to the web repo
61
  # copy all zip files to the web repo
60
  cp "$PKGDIR"/* $REPOROOT/
62
  cp "$PKGDIR"/* $REPOROOT/
61
  # now strip the sources from repo versions
63
  # now strip the sources from repo versions
62
  find "$REPOROOT/" -iname '*.zip' -exec zip "{}" -d "SOURCE/*" ';'
64
  find "$REPOROOT/" -iname '*.zip' -exec zip "{}" -d "SOURCE/*" ';'
63
  find "$REPOROOT/" -iname '*.zip' -exec zip "{}" -d "source/*" ';'
65
  find "$REPOROOT/" -iname '*.zip' -exec zip "{}" -d "source/*" ';'
64
  find "$REPOROOT/" -iname '*.zip' -exec zip "{}" -d "Source/*" ';'
66
  find "$REPOROOT/" -iname '*.zip' -exec zip "{}" -d "Source/*" ';'
65
 
67
 
66
  # build repo idx
68
  # build repo idx
67
  $BUILDIDX "$REPOROOT/"
69
  $BUILDIDX "$REPOROOT/"
68
}
70
}
69
 
71
 
-
 
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
 
70
### actual code flow starts here ############################################
84
### actual code flow starts here ############################################
71
 
85
 
72
# check presence of the buildidx tool
86
# check presence of the buildidx tool
73
if [ ! -f "$BUILDIDX" ] ; then
87
if [ ! -f "$BUILDIDX" ] ; then
74
  echo "buildidx not found at $BUILDIDX"
88
  echo "buildidx not found at $BUILDIDX"
75
  exit 1
89
  exit 1
76
fi
90
fi
77
 
91
 
78
# remember where I am, so I can get back here once all is done
92
# remember where I am, so I can get back here once all is done
79
origdir=`pwd`
93
origdir=`pwd`
80
 
94
 
81
mkdir "$CDROOT"
95
mkdir "$CDROOT"
82
mkdir "$FLOPROOT"
96
mkdir "$FLOPROOT"
83
 
97
 
84
# build the repo (also builds the listing.txt file)
98
# build the repo (also builds the listing.txt file)
85
dorepo
99
dorepo
86
 
100
 
87
# add CORE packages to CDROOT + create the list of packages on floppy
101
# add CORE packages to CDROOT + create the list of packages on floppy
88
for pkg in "${COREPKGS[@]}" ; do
102
for pkg in "${COREPKGS[@]}" ; do
89
  cp "$REPOROOT/$pkg.zip" "$CDROOT/"
103
  cp "$REPOROOT/$pkg.zip" "$CDROOT/"
90
  echo "$pkg" >> "$FLOPROOT/install.lst"
104
  echo "$pkg" >> "$FLOPROOT/install.lst"
91
done
105
done
92
 
106
 
93
# prepare the content of the boot (install) floppy
107
# prepare the content of the boot (install) floppy
94
cp "install/install.com" "$FLOPROOT/"
108
cp "install/install.com" "$FLOPROOT/"
95
cp "install/nls/"install.?? "$FLOPROOT/"
109
cp "install/nls/"install.?? "$FLOPROOT/"
96
cp -r "$CUSTFILES/floppy/"* "$FLOPROOT/"
110
cp -r "$CUSTFILES/floppy/"* "$FLOPROOT/"
97
 
111
 
98
# build the boot floppy image
112
# build the boot (CD) floppy image
99
export MTOOLS_NO_VFAT=1
113
export MTOOLS_NO_VFAT=1
100
truncate -s 1474560 "$CDROOT/boot.img"
-
 
101
mformat -f 1440 -v SVARDOS -B "$CUSTFILES/floppy.mbr" -i "$CDROOT/boot.img"
114
mformat -C -f 1440 -v SVARDOS -B "$CUSTFILES/floppy.mbr" -i "$CDROOT/boot.img"
102
mcopy -sQm -i "$CDROOT/boot.img" "$FLOPROOT/"* ::/
115
mcopy -sQm -i "$CDROOT/boot.img" "$FLOPROOT/"* ::/
103
 
116
 
-
 
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
 
104
# delete previous (if any) *.iso and *.md5 files
125
# delete previous (if any) *.iso and *.md5 files
105
echo "cleaning up old versions..."
126
echo "cleaning up old versions..."
106
rm -f "$PUBDIR/svardos.iso" "$PUBDIR/svardos.iso.md5"
127
rm -f "$PUBDIR/svardos.iso" "$PUBDIR/svardos.iso.md5"
107
 
128
 
108
CDISO="$PUBDIR/svardos.iso"
129
CDISO="$PUBDIR/svardos.iso"
109
 
130
 
110
$GENISOIMAGE -input-charset cp437 -b boot.img -iso-level 1 -f -V SVARDOS -o "$CDISO" "$CDROOT"
131
$GENISOIMAGE -input-charset cp437 -b boot.img -iso-level 1 -f -V SVARDOS -o "$CDISO" "$CDROOT"
111
 
132
 
112
# cleanup temporary things
133
# cleanup temporary things
-
 
134
if [ "x$1" != "xnoclean" ] ; then
113
rm -rf "$CDROOT" "$FLOPROOT"
135
  rm -rf "$CDROOT" "$FLOPROOT"
-
 
136
fi
114
 
137
 
115
# compute the MD5 of the ISO file, taking care to include only the filename in it
138
# compute the MD5 of the ISO file, taking care to include only the filename in it
116
echo "computing md5 sums..."
139
echo "computing md5 sums..."
117
cd `dirname "$CDISO"`
140
cd `dirname "$CDISO"`
118
md5sum `basename "$CDISO"` > "$CDISO.md5"
141
md5sum `basename "$CDISO"` > "$CDISO.md5"
119
 
142
 
120
cd "$origdir"
143
cd "$origdir"
121
 
144
 
122
#cd svnlschk
145
#cd svnlschk
123
#./webgen.sh
146
#./webgen.sh
124
#cd ..
147
#cd ..
125
 
148
 
126
echo "ALL DONE!"
149
echo "ALL DONE!"
127
 
150
 
128
exit 0
151
exit 0
129
 
152