Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-mysqlbackend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
caosdb
Software
caosdb-mysqlbackend
Commits
6a796358
Commit
6a796358
authored
5 years ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
MAINT: move patchheader
parent
44db82dc
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
patches/applyPatches.sh
+1
-2
1 addition, 2 deletions
patches/applyPatches.sh
patches/utils/patch_header.sh
+2
-2
2 additions, 2 deletions
patches/utils/patch_header.sh
utils/patch_header.sh
+123
-0
123 additions, 0 deletions
utils/patch_header.sh
with
126 additions
and
4 deletions
patches/applyPatches.sh
+
1
−
2
View file @
6a796358
...
...
@@ -27,13 +27,12 @@
#apply all available patches.
set
-e
PATCHES
=
"./patch*/patch.sh"
export
UTILSPATH
=
"./utils"
export
UTILSPATH
=
".
.
/utils"
for
p
in
$PATCHES
do
$p
"
$@
"
--patch
=
$p
done
source
./utils/patch_header.sh
cd
../
./update_sql_procedures.sh
This diff is collapsed.
Click to expand it.
patches/utils/patch_header.sh
+
2
−
2
View file @
6a796358
...
...
@@ -23,8 +23,8 @@
#
#header for patch scripts
.
../../utils/
load_settings.sh
.
../../utils/
helpers.sh
.
load_settings.sh
.
helpers.sh
USAGE
=
"
$1
[ --env=ENV_FILE ] [ --patch=PATCH ] [ --backupdir=BACKUPDIR ]
\n\n
"
CMD_OPTIONS
=
$(
cat
<<
EOF
...
...
This diff is collapsed.
Click to expand it.
utils/patch_header.sh
0 → 100644
+
123
−
0
View file @
6a796358
#
# ** header v3.0
# This file is a part of the CaosDB Project.
#
# Copyright (C) 2018 Research Group Biomedical Physics,
# Max-Planck-Institute for Dynamics and Self-Organization Göttingen
# Copyright 2019 Daniel Hornung
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# ** end header
#
#header for patch scripts
.
../../utils/load_settings.sh
.
../../utils/helpers.sh
USAGE
=
"
$1
[ --env=ENV_FILE ] [ --patch=PATCH ] [ --backupdir=BACKUPDIR ]
\n\n
"
CMD_OPTIONS
=
$(
cat
<<
EOF
options:
-h, --help
Show brief help.
--env=ENV_FILE
A file where variables are stored in the format of shell environment
variables. Content of this file overrides environment variables already
present.
--patch=PATCH
*TODO* Please document this option.
--backupdir=BACKUPDIR
The directory where backup files are stored to.
--yaml[=True|False]
If given (and the optional value is not False), additional machine-readable
YAML output is emitted. Only implemented for some commands yet.
This script basically uses the same environment variables as the server
configuration make file. Notable examples are:
- LOGIN_PATH
- MYSQL_HOST
- MYSQL_PORT
- DATABASE_NAME
- DATABASE_USER
- DATABASE_USER_PW
EOF
)
set
-e
function
_print_help
()
{
echo
-e
"
$USAGE
"
echo
-e
"
$CMD_OPTIONS
"
if
[
-n
"
$PRINT_HELP
"
]
;
then
echo
-e
"
$PRINT_HELP
"
fi
if
[
-n
"
$1
"
]
;
then
echo
-e
"
$1
"
fi
}
while
test
$#
-gt
0
;
do
case
"
$1
"
in
-h
|
--help
)
_print_help
exit
0
;;
--env
*
)
ENV_FILE
=
"
${
1
#--*=
}
"
shift
;;
--patch
*
)
PATCH
=
"
${
1
#--*=
}
"
shift
;;
--backupdir
*
)
BACKUPDIR
=
"
${
1
#--*=
}
"
shift
;;
--yaml
*
)
if
[[
"
$1
"
==
"--yaml"
]]
;
then
YAML
=
"True"
else
YAML
=
"
${
1
#--*=
}
"
fi
shift
;;
*
)
echo
"Unknown option
$1
"
exit
1
shift
;;
esac
done
if
[
-n
"
$PATCH
"
]
;
then
echo
-ne
"applying patch
$PATCH
to
$DATABASE_NAME
... "
fi
# @param $1: db version string, e.g. v2.0.0
# @return: 0 on success, 1 on failure
function
check_version
{
local
version
=
$(
$MYSQL_CMD
$MYSQL_CONNECTION
-B
-e
"Select CaosDBVersion();"
)
if
[[
"
$(
echo
$version
|
sed
's/^CaosDBVersion()\s//'
)
"
=
"
$1
"
]]
;
then
return
0
fi
uptodate
}
# @param $1: new version string
function
update_version
{
mysql_execute
"DROP FUNCTION IF EXISTS CaosDBVersion; CREATE FUNCTION CaosDBVersion() RETURNS VARCHAR(255) DETERMINISTIC RETURN '
$1
';"
}
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