Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 2db9c7007c27d368a74815489ac77d0bfff3dc41 (plain) (blame)
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
#!/bin/bash -x

#--------------------------------------------------------------------------------
# Copyright (c) 2012 CEA LIST.
#
#    
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
# which accompanies this distribution, and is available at
# https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
#    Nicolas Bros (Mia-Software)
#--------------------------------------------------------------------------------

set -o errexit
set -o nounset

XSLT_FILE=/opt/public/modeling/mdt/papyrus/addToComposite.xsl

[ $# -eq 2 ] || (echo "usage: $0 <compositeUpdateSite> <newChildName>"; exit 1)
_compositeUpdateSite=$1
_newChildName=$2

newTimeStamp=$(date +%s000)

[[ "$_compositeUpdateSite" =~ ^/home/data/httpd/download\.eclipse\.org/.*$ ]] || (echo "incorrect parameter: compositeUpdateSite"; exit 1)
[[ "$_newChildName" =~ ^M[1-7]|RC[1-9]|SR[1-9]_RC[1-9]|[0-9]+\.[0-9]\.[0-9]$ ]] || (echo "incorrect parameter: newChildName"; exit 1)

[ -d "$_compositeUpdateSite" ] || (echo "compositeUpdateSite is not a directory"; exit 1)
[ -f "$_compositeUpdateSite/compositeArtifacts.xml" ] || (echo "compositeArtifacts.xml not found"; exit 1)
[ -f "$_compositeUpdateSite/compositeContent.xml" ] || (echo "compositeContent.xml not found"; exit 1)

echo "Adding the new child '${_newChildName}' to the composite update site ${_compositeUpdateSite}"


cd "${_compositeUpdateSite}"
mv compositeArtifacts.xml compositeArtifacts.xml.bak
mv compositeContent.xml compositeContent.xml.bak

echo "Updating compositeContent.xml"
xsltproc --stringparam newChild "${_newChildName}" --stringparam newTimestamp ${newTimeStamp} -o compositeContent.xml ${XSLT_FILE} compositeContent.xml.bak
echo "Updating compositeArtifacts.xml"
xsltproc --stringparam newChild "${_newChildName}" --stringparam newTimestamp ${newTimeStamp} -o compositeArtifacts.xml ${XSLT_FILE} compositeArtifacts.xml.bak

echo "done."

Back to the top