Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opensilecs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
silecs
opensilecs
Commits
5af19857
Commit
5af19857
authored
8 years ago
by
al.schwinn
Browse files
Options
Downloads
Patches
Plain Diff
fixed return/exit chaos
parent
c2cc2f00
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
silecs-communication-cpp/releaseSilecs.sh
+33
-14
33 additions, 14 deletions
silecs-communication-cpp/releaseSilecs.sh
with
33 additions
and
14 deletions
silecs-communication-cpp/releaseSilecs.sh
+
33
−
14
View file @
5af19857
#!/bin/sh
set
-e
# Usage examples:
# Usage examples:
# first you need to source this script, so that you can use it's methods:
# first you need to source this script, so that you can use it's methods:
# $ source releaseSilecs.sh
# $ source releaseSilecs.sh
...
@@ -18,12 +15,24 @@ set -e
...
@@ -18,12 +15,24 @@ set -e
# List of silecs packages which is released or patched
# List of silecs packages which is released or patched
PACKAGES
=
"silecs-codegen silecs-model silecs-communication-cpp silecs-diagnostic-cpp snap7"
PACKAGES
=
"silecs-codegen silecs-model silecs-communication-cpp silecs-diagnostic-cpp snap7"
# Check that folder exists, print proper error if not
checkFolderExists
()
{
FOLDER
=
$1
if
[
!
-d
${
FOLDER
}
]
;
then
echo
"Error: The folder '
${
FOLDER
}
' is needed in order to finish the installation."
echo
"Installation cancelled."
exit
1
fi
}
# releases all silecs-packages to release-dir
# releases all silecs-packages to release-dir
function
release
release
()
{
{
VERSION
=
$1
VERSION
=
$1
RELEASE_DIR_BASE
=
$2
RELEASE_DIR_BASE
=
$2
WORKSPACE
=
$3
WORKSPACE
=
$3
checkFolderExists
${
WORKSPACE
}
for
PACKAGE
in
$PACKAGES
;
do
for
PACKAGE
in
$PACKAGES
;
do
INSTALL_DIR
=
${
RELEASE_DIR_BASE
}
/
${
PACKAGE
}
/
${
VERSION
}
INSTALL_DIR
=
${
RELEASE_DIR_BASE
}
/
${
PACKAGE
}
/
${
VERSION
}
...
@@ -31,6 +40,7 @@ function release
...
@@ -31,6 +40,7 @@ function release
echo
"Error: Silecs version
${
VERSION
}
is already installed in
${
INSTALL_DIR
}
. Exiting now."
echo
"Error: Silecs version
${
VERSION
}
is already installed in
${
INSTALL_DIR
}
. Exiting now."
return
1
return
1
else
else
checkFolderExists
${
WORKSPACE
}
/
${
PACKAGE
}
echo
"installing
${
INSTALL_DIR
}
from
${
WORKSPACE
}
/
${
PACKAGE
}
"
echo
"installing
${
INSTALL_DIR
}
from
${
WORKSPACE
}
/
${
PACKAGE
}
"
${
WORKSPACE
}
/
${
PACKAGE
}
/install.sh
${
INSTALL_DIR
}
${
WORKSPACE
}
/
${
PACKAGE
}
/install.sh
${
INSTALL_DIR
}
fi
fi
...
@@ -38,40 +48,49 @@ function release
...
@@ -38,40 +48,49 @@ function release
return
0
return
0
}
}
function
plugin_release
plugin_release
()
{
{
RELEASE_DIR_BASE
=
$1
(
WORKSPACE
=
$2
set
-e
PACKAGE
=
silecs-eclipse-plugin-update-site
RELEASE_DIR_BASE
=
$1
INSTALL_DIR
=
${
RELEASE_DIR_BASE
}
/
${
PACKAGE
}
WORKSPACE
=
$2
echo
"installing
${
INSTALL_DIR
}
from
${
WORKSPACE
}
/
${
PACKAGE
}
"
PACKAGE
=
silecs-eclipse-plugin-update-site
${
WORKSPACE
}
/
${
PACKAGE
}
/install.sh
${
INSTALL_DIR
}
INSTALL_DIR
=
${
RELEASE_DIR_BASE
}
/
${
PACKAGE
}
checkFolderExists
${
WORKSPACE
}
/
${
PACKAGE
}
echo
"installing
${
INSTALL_DIR
}
from
${
WORKSPACE
}
/
${
PACKAGE
}
"
${
WORKSPACE
}
/
${
PACKAGE
}
/install.sh
${
INSTALL_DIR
}
return
0
)
}
}
# releases a specific package to release-dir. For all other packages symlinks to the base-version are generated
# releases a specific package to release-dir. For all other packages symlinks to the base-version are generated
function
patch
patch
()
{
{
PACKAGE_TO_PATCH
=
$1
PACKAGE_TO_PATCH
=
$1
NEW_VERSION
=
$2
NEW_VERSION
=
$2
BASE_VERSION
=
$3
BASE_VERSION
=
$3
RELEASE_DIR_BASE
=
$4
RELEASE_DIR_BASE
=
$4
WORKSPACE
=
$5
WORKSPACE
=
$5
checkFolderExists
${
WORKSPACE
}
for
PACKAGE
in
$PACKAGES
;
do
for
PACKAGE
in
$PACKAGES
;
do
INSTALL_DIR
=
${
RELEASE_DIR_BASE
}
/
${
PACKAGE
}
/
${
NEW_VERSION
}
INSTALL_DIR
=
${
RELEASE_DIR_BASE
}
/
${
PACKAGE
}
/
${
NEW_VERSION
}
BASE_DIR
=
${
RELEASE_DIR_BASE
}
/
${
PACKAGE
}
/
${
BASE_VERSION
}
BASE_DIR
=
${
RELEASE_DIR_BASE
}
/
${
PACKAGE
}
/
${
BASE_VERSION
}
checkFolderExists
${
BASE_DIR
}
if
[
"
$PACKAGE
"
==
"
$PACKAGE_TO_PATCH
"
]
;
then
if
[
"
$PACKAGE
"
==
"
$PACKAGE_TO_PATCH
"
]
;
then
if
[
-d
${
INSTALL_DIR
}
]
;
then
if
[
-d
${
INSTALL_DIR
}
]
;
then
if
[
-L
${
INSTALL_DIR
}
]
;
then
if
[
-L
${
INSTALL_DIR
}
]
;
then
checkFolderExists
${
WORKSPACE
}
/
${
PACKAGE
}
# Replace Sym-Link with patch-version ... needed if more than one package is patched for the same version
# Replace Sym-Link with patch-version ... needed if more than one package is patched for the same version
unlink
${
INSTALL_DIR
}
unlink
${
INSTALL_DIR
}
echo
"installing
${
INSTALL_DIR
}
from
${
WORKSPACE
}
/
${
PACKAGE
}
"
checkFolderExists
${
WORKSPACE
}
/
${
PACKAGE
}
${
WORKSPACE
}
/
${
PACKAGE
}
/install.sh
${
INSTALL_DIR
}
${
WORKSPACE
}
/
${
PACKAGE
}
/install.sh
${
INSTALL_DIR
}
else
else
echo
"Error: Silecs version
${
NEW_VERSION
}
of package
${
PACKAGE
}
is already installed in
${
INSTALL_DIR
}
. Exiting now."
echo
"Error: Silecs version
${
NEW_VERSION
}
of package
${
PACKAGE
}
is already installed in
${
INSTALL_DIR
}
. Exiting now."
return
1
return
1
fi
fi
else
else
checkFolderExists
${
WORKSPACE
}
/
${
PACKAGE
}
echo
"installing
${
INSTALL_DIR
}
from
${
WORKSPACE
}
/
${
PACKAGE
}
"
echo
"installing
${
INSTALL_DIR
}
from
${
WORKSPACE
}
/
${
PACKAGE
}
"
${
WORKSPACE
}
/
${
PACKAGE
}
/install.sh
${
INSTALL_DIR
}
${
WORKSPACE
}
/
${
PACKAGE
}
/install.sh
${
INSTALL_DIR
}
fi
fi
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment