Subversion Repositories SvarDOS

Rev

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

Rev 180 Rev 185
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
 
11
 
12
### parameters block starts here ############################################
12
### parameters block starts here ############################################
13
 
13
 
14
PKGDIR=`realpath ./packages`
14
PKGDIR=`realpath ./packages`
15
REPOROOT=`realpath ./website/repo`
15
REPOROOT=`realpath ./website/repo`
16
BUILDIDX=`realpath ../fdnpkg/trunk/buildidx/buildidx`
16
BUILDIDX=`realpath ./buildidx/buildidx`
17
PUBDIR=`realpath ./website/download`
17
PUBDIR=`realpath ./website/download`
18
CDROOT=`realpath ./cdroot`
18
CDROOT=`realpath ./cdroot`
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
# auto-detect whether to use mkisofs or genisoimage
25
# auto-detect whether to use mkisofs or genisoimage
26
 
26
 
27
if [ "x$GENISOIMAGE" == "x" ] ; then
27
if [ "x$GENISOIMAGE" == "x" ] ; then
28
mkisofs --help 2> /dev/null
28
mkisofs --help 2> /dev/null
29
if [ $? -eq 0 ] ; then
29
if [ $? -eq 0 ] ; then
30
  GENISOIMAGE='mkisofs'
30
  GENISOIMAGE='mkisofs'
31
fi
31
fi
32
fi
32
fi
33
 
33
 
34
if [ "x$GENISOIMAGE" == "x" ] ; then
34
if [ "x$GENISOIMAGE" == "x" ] ; then
35
genisoimage --help 2> /dev/null
35
genisoimage --help 2> /dev/null
36
if [ $? -eq 0 ] ; then
36
if [ $? -eq 0 ] ; then
37
  GENISOIMAGE='genisoimage'
37
  GENISOIMAGE='genisoimage'
38
fi
38
fi
39
fi
39
fi
40
 
40
 
41
if [ "x$GENISOIMAGE" == "x" ] ; then
41
if [ "x$GENISOIMAGE" == "x" ] ; then
42
  echo "ERROR: neither genisoimage nor mkisofs was found on this system"
42
  echo "ERROR: neither genisoimage nor mkisofs was found on this system"
43
  exit 1
43
  exit 1
44
fi
44
fi
45
 
45
 
46
 
46
 
47
# abort if anything fails
47
# abort if anything fails
48
set -e
48
set -e
49
 
49
 
50
 
50
 
51
# function that builds the packages repository
51
# function that builds the packages repository
52
function dorepo {
52
function dorepo {
53
  # copy all zip files to the web repo
53
  # copy all zip files to the web repo
54
  cp "$PKGDIR"/* $REPOROOT/
54
  cp "$PKGDIR"/* $REPOROOT/
55
  # now strip the sources from repo versions
55
  # now strip the sources from repo versions
56
  find "$REPOROOT/" -iname '*.zip' -exec zip "{}" -d "SOURCE/*" ';'
56
  find "$REPOROOT/" -iname '*.zip' -exec zip "{}" -d "SOURCE/*" ';'
57
  find "$REPOROOT/" -iname '*.zip' -exec zip "{}" -d "source/*" ';'
57
  find "$REPOROOT/" -iname '*.zip' -exec zip "{}" -d "source/*" ';'
58
  find "$REPOROOT/" -iname '*.zip' -exec zip "{}" -d "Source/*" ';'
58
  find "$REPOROOT/" -iname '*.zip' -exec zip "{}" -d "Source/*" ';'
59
 
59
 
60
  # build repo idx
60
  # build repo idx
61
  $BUILDIDX "$REPOROOT/"
61
  $BUILDIDX "$REPOROOT/"
62
}
62
}
63
 
63
 
64
### actual code flow starts here ############################################
64
### actual code flow starts here ############################################
65
 
65
 
66
# check presence of the buildidx tool
66
# check presence of the buildidx tool
67
if [ ! -f "$BUILDIDX" ] ; then
67
if [ ! -f "$BUILDIDX" ] ; then
68
  echo "buildidx not found at $BUILDIDX"
68
  echo "buildidx not found at $BUILDIDX"
69
  exit 1
69
  exit 1
70
fi
70
fi
71
 
71
 
72
# remember where I am, so I can get back here once all is done
72
# remember where I am, so I can get back here once all is done
73
origdir=`pwd`
73
origdir=`pwd`
74
 
74
 
75
# build the boot (install) floppy image first
75
# build the boot (install) floppy image first
76
cp $CUSTFILES/bootmini.img $CDROOT/boot.img
76
cp $CUSTFILES/bootmini.img $CDROOT/boot.img
77
export MTOOLS_NO_VFAT=1
77
export MTOOLS_NO_VFAT=1
78
mcopy -sQm -i "$CDROOT/boot.img" $CUSTFILES/floppy/* ::/
78
mcopy -sQm -i "$CDROOT/boot.img" $CUSTFILES/floppy/* ::/
79
if [ $? -ne 0 ] ; then exit 1 ; fi
79
if [ $? -ne 0 ] ; then exit 1 ; fi
80
 
80
 
81
# build the repo (also builds the listing.txt file)
81
# build the repo (also builds the listing.txt file)
82
dorepo
82
dorepo
83
 
83
 
84
# delete previous (if any) *.iso and *.md5 files
84
# delete previous (if any) *.iso and *.md5 files
85
echo "cleaning up old versions..."
85
echo "cleaning up old versions..."
86
rm -f "$PUBDIR/svardos.iso" "$PUBDIR/svardos.iso.md5"
86
rm -f "$PUBDIR/svardos.iso" "$PUBDIR/svardos.iso.md5"
87
 
87
 
88
CDISO="$PUBDIR/svardos.iso"
88
CDISO="$PUBDIR/svardos.iso"
89
 
89
 
90
$GENISOIMAGE -input-charset cp437 -b boot.img -iso-level 1 -f -V SVARDOS -o "$CDISO" "$CDROOT"
90
$GENISOIMAGE -input-charset cp437 -b boot.img -iso-level 1 -f -V SVARDOS -o "$CDISO" "$CDROOT"
91
if [ $? -ne 0 ] ; then exit 1 ; fi
91
if [ $? -ne 0 ] ; then exit 1 ; fi
92
 
92
 
93
# compute the MD5 of the ISO file, taking care to include only the filename in it
93
# compute the MD5 of the ISO file, taking care to include only the filename in it
94
echo "computing md5 sums..."
94
echo "computing md5 sums..."
95
cd `dirname "$CDISO"`
95
cd `dirname "$CDISO"`
96
md5sum `basename "$CDISO"` > "$CDISO.md5"
96
md5sum `basename "$CDISO"` > "$CDISO.md5"
97
if [ $? -ne 0 ] ; then exit 1 ; fi
97
if [ $? -ne 0 ] ; then exit 1 ; fi
98
 
98
 
99
cd "$origdir"
99
cd "$origdir"
100
 
100
 
101
#cd svnlschk
101
#cd svnlschk
102
#./webgen.sh
102
#./webgen.sh
103
#cd ..
103
#cd ..
104
 
104
 
105
echo "ALL DONE!"
105
echo "ALL DONE!"
106
 
106
 
107
exit 0
107
exit 0
108
 
108