-
Notifications
You must be signed in to change notification settings - Fork 88
/
tei-install.sh
executable file
·127 lines (117 loc) · 4.16 KB
/
tei-install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/bin/bash
#
# Install TEI packages on web site
#
# Sebastian Rahtz, May 2014
# copyright: TEI Consortium
# license: GPL
#
# changed 2018-09-28 by Syd & Raff while working on Stylesheets
# release 7.46.0:
# New feature (already falsely documented in TCW 22 :-) --
# Add commandline switch --Jenkins so the server URL can be specified
# at run time. E.g., --Jenkins==http://jenkins17.tei-c.org/
# changed 2014-09-16 by Syd in the middle of trying to release 2.7.0:
# bug fix: changed $dir to $jenkinsdir in the "Get special HTML pages
# for TEI web site" section of install() function.
# Changed 2016-03-30 by MDH to ensure that the oxygen folder with
# updateSite.oxygen in it is copied from the old current release to
# the folder which will become the new one, so that it stays available
# for users, and can also be retrieved for updating by the oxygen-tei
# build script.
install()
{
echo Install ${name}/${version} in ${Vault} as current
${ECHO} mkdir -p ${Vault}/${name}/${version}
echo unpack to ${Vault}/${name}/${version}
${ECHO} unzip -q -o ${pname}-${version}.zip -d ${Vault}/${name}/${version}
case $package in
Roma)
${ECHO} unzip -q -o ${pname}-${version}.zip -d /usr/share;;
TEIP5)
${ECHO} rm -f teiwebsiteguidelines.zip;
echo Get special HTML pages for TEI web site;
${ECHO} curl -L -O -s $jenkinsdir/teiwebsiteguidelines.zip || die "Unable to fetch package $jenkinsdir/teiwebsiteguidelines.zip";
echo Copy oxygen folder with updateSite.oxygen to ${Vault}/${name}/${version}
${ECHO} cp -r ${Vault}/${name}/current/oxygen ${Vault}/${name}/${version}
echo unpack web guidelines to ${Vault}/${name}/${version};
${ECHO} unzip -q -o teiwebsiteguidelines -d ${Vault}/${name}/${version}/doc/tei-p5-doc;
${ECHO} rm teiwebsiteguidelines.zip;;
esac
}
makecurrent()
{
${ECHO} rm ${Vault}/${name}/current
echo link ${Vault}/${name}/${version} to ${Vault}/${name}/current
${ECHO} ln -s ${Vault}/${name}/${version} ${Vault}/${name}/current
}
upload()
{
echo upload ${pname}-${version}.zip to Sourceforge ${SFNAME} as user ${SFUSER}
${ECHO} rsync -e ssh ${pname}-${version}.zip ${SFUSER},tei@frs.sourceforge.net:/home/frs/project/t/te/tei/${SFNAME}/${pname}-${version}.zip
}
die()
{
echo; echo
echo "ERROR: $@."
D=`date "+%Y-%m-%d %H:%M:%S"`
echo "$D. That was a fatal error"
exit 1
}
Vault=/projects/tei/web/Vault
Jenkins=http://jenkins.tei-c.org/
ECHO=
SFUSER=rahtz
version=
package=
JOB=all
while test $# -gt 0; do
case $1 in
--sfuser=*) SFUSER=`echo $1 | sed 's/.*=//'`;;
--Jenkins=*) Jenkins=`echo $1 | sed 's/.*=//'`;; # Warning: if there is an '=' in the supplied URL this will fail
--dummy) ECHO=echo;;
--package=*) package=`echo $1 | sed 's/.*=//'`;;
--version=*) version=`echo $1 | sed 's/.*=//'`;;
--vault=*) Vault=`echo $1 | sed 's/.*=//'`;;
--upload) JOB=upload;;
--makecurrent) JOB=makecurrent;;
--install) JOB=install;;
*) if test "$1" = "${1#--}" ; then
break
else
echo "WARNING: Unrecognized option '$1' ignored"
fi ;;
esac
shift
done
if [ -z $version ]
then
echo You must use the --version option to specify which version of the package you are installing
exit 1
fi
if [ -z $package ]
then
echo You must use the --package option to specify which package you are installing
exit 1
fi
jenkinsdir=${Jenkins}/job/${package}/lastSuccessfulBuild/artifact
SFNAME=$package
case $package in
TEIP5) name=P5; pname=tei; SFNAME=TEI-P5-all; jenkinsdir=${jenkinsdir}/P5;;
Stylesheets1) name=Stylesheets1; pname=tei-xslt1;;
Stylesheets) name=Stylesheets; pname=tei-xsl;;
Roma) name=Roma; pname=tei-roma;;
*) echo "Error: package $package unsupported"; exit 1;;
esac
echo Try to fetch version $version of $package from $jenkinsdir
rm -f ${pname}-${version}.zip
${ECHO} curl -L -O -s $jenkinsdir/${pname}-${version}.zip || \
die "Unable to fetch package $jenkinsdir/${pname}-${version}.zip"
echo Selected task is $JOB
case $JOB in
all) install; makecurrent; upload;;
install) install ;;
makecurrent) makecurrent ;;
upload) upload;;
esac
${ECHO} rm ${pname}-${version}.zip