ENTAXY-480 release version 1.8.3
This commit is contained in:
201
update-management/update-management-components/LICENSE.txt
Normal file
201
update-management/update-management-components/LICENSE.txt
Normal file
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
14
update-management/update-management-components/pom.xml
Normal file
14
update-management/update-management-components/pom.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>ru.entaxy.esb</groupId>
|
||||
<artifactId>update-management</artifactId>
|
||||
<version>1.8.3</version>
|
||||
</parent>
|
||||
<groupId>ru.entaxy.esb.update-management</groupId>
|
||||
<artifactId>update-management-components</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>ENTAXY :: UPDATE MANAGEMENT :: COMPONENTS</name>
|
||||
<description>ENTAXY :: UPDATE MANAGEMENT :: COMPONENTS</description>
|
||||
|
||||
</project>
|
@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~~~~~~licensing~~~~~~
|
||||
update-management-components
|
||||
==========
|
||||
Copyright (C) 2020 - 2023 EmDev LLC
|
||||
==========
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
~~~~~~/licensing~~~~~~
|
||||
-->
|
||||
|
||||
<features name="${project.artifactId}-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.6.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.6.0 http://karaf.apache.org/xmlns/features/v1.6.0">
|
||||
|
||||
<feature name="${project.artifactId}" version="${project.version}">
|
||||
<configfile finalname="etc/scripts/entaxy.update.shell.script" override="true">
|
||||
mvn:ru.entaxy.esb.update-management/update-management-components/1.8.3/script/etc~scripts~entaxy.update.shell
|
||||
</configfile>
|
||||
<configfile finalname="scripts/update/executor" override="true">
|
||||
mvn:ru.entaxy.esb.update-management/update-management-components/1.8.3/script/scripts~update~executor
|
||||
</configfile>
|
||||
<!-- --><!-- -->
|
||||
<configfile finalname="scripts/update/operations" override="true">
|
||||
mvn:ru.entaxy.esb.update-management/update-management-components/1.8.3/script/scripts~update~operations
|
||||
</configfile>
|
||||
<configfile finalname="scripts/update/print-update-info" override="true">
|
||||
mvn:ru.entaxy.esb.update-management/update-management-components/1.8.3/script/scripts~update~print-update-info
|
||||
</configfile>
|
||||
<!-- --><!-- -->
|
||||
<configfile finalname="scripts/update/update-get" override="true">
|
||||
mvn:ru.entaxy.esb.update-management/update-management-components/1.8.3/script/scripts~update~update-get
|
||||
</configfile>
|
||||
<!-- --><!-- -->
|
||||
<configfile finalname="scripts/update/update-info" override="true">
|
||||
mvn:ru.entaxy.esb.update-management/update-management-components/1.8.3/script/scripts~update~update-info
|
||||
</configfile>
|
||||
<!-- --><!-- -->
|
||||
<configfile finalname="scripts/update/update-install" override="true">
|
||||
mvn:ru.entaxy.esb.update-management/update-management-components/1.8.3/script/scripts~update~update-install
|
||||
</configfile>
|
||||
<!-- --><!-- -->
|
||||
<configfile finalname="scripts/update/update-list" override="true">
|
||||
mvn:ru.entaxy.esb.update-management/update-management-components/1.8.3/script/scripts~update~update-list
|
||||
</configfile>
|
||||
<!-- --><!-- -->
|
||||
<configfile finalname="scripts/update/update-prepare" override="true">
|
||||
mvn:ru.entaxy.esb.update-management/update-management-components/1.8.3/script/scripts~update~update-prepare
|
||||
</configfile>
|
||||
<!-- --><!-- -->
|
||||
<configfile finalname="scripts/update/utils" override="true">
|
||||
mvn:ru.entaxy.esb.update-management/update-management-components/1.8.3/script/scripts~update~utils
|
||||
</configfile>
|
||||
</feature>
|
||||
|
||||
</features>
|
@ -0,0 +1,45 @@
|
||||
entaxy:update-get = {
|
||||
karafRoot = ((($.context bundle) loadClass java.lang.System) getProperty 'karaf.home')
|
||||
cd $karafRoot
|
||||
source scripts/update/update-get $args
|
||||
}
|
||||
entaxy:update-prepare = {
|
||||
karafRoot = ((($.context bundle) loadClass java.lang.System) getProperty 'karaf.home')
|
||||
cd $karafRoot
|
||||
source scripts/update/update-prepare $args
|
||||
}
|
||||
entaxy:update-info = {
|
||||
karafRoot = ((($.context bundle) loadClass java.lang.System) getProperty 'karaf.home')
|
||||
cd $karafRoot
|
||||
source scripts/update/update-info $args
|
||||
}
|
||||
entaxy:update-list = {
|
||||
karafRoot = ((($.context bundle) loadClass java.lang.System) getProperty 'karaf.home')
|
||||
cd $karafRoot
|
||||
source scripts/update/update-list $args
|
||||
}
|
||||
entaxy:update-install = {
|
||||
karafRoot = ((($.context bundle) loadClass java.lang.System) getProperty 'karaf.home')
|
||||
cd $karafRoot
|
||||
|
||||
__ORIGIN_ARGS__ = "${args}"
|
||||
source scripts/update/update-install $args
|
||||
}
|
||||
|
||||
__get_loaded_updates = {
|
||||
list = []
|
||||
fsref = ($.context getServiceReference org.apache.karaf.features.FeaturesService)
|
||||
fs = ($.context getService $fsref)
|
||||
|
||||
_features = ($fs getFeatures "entaxy-update-configuration")
|
||||
each $_features {
|
||||
$list add ($it getVersion)
|
||||
}
|
||||
|
||||
$.context ungetService $fsref
|
||||
$list
|
||||
}
|
||||
|
||||
complete -c entaxy:update-prepare -e
|
||||
complete -c entaxy:update-prepare -d "Prepare update for installation"
|
||||
complete -c entaxy:update-prepare -a '__get_loaded_updates'
|
@ -0,0 +1,41 @@
|
||||
<!-- -->
|
||||
<configfile finalname="etc/scripts/entaxy.update.shell.script" override="true">
|
||||
mvn:ru.entaxy.esb.update-management/update-management-components/1.8.3/script/etc~scripts~entaxy.update.shell
|
||||
</configfile>
|
||||
<!-- --><!-- -->
|
||||
<configfile finalname="scripts/update/executor" override="true">
|
||||
mvn:ru.entaxy.esb.update-management/update-management-components/1.8.3/script/scripts~update~executor
|
||||
</configfile>
|
||||
<!-- --><!-- -->
|
||||
<configfile finalname="scripts/update/operations" override="true">
|
||||
mvn:ru.entaxy.esb.update-management/update-management-components/1.8.3/script/scripts~update~operations
|
||||
</configfile>
|
||||
<!-- --><!-- -->
|
||||
<configfile finalname="scripts/update/print-update-info" override="true">
|
||||
mvn:ru.entaxy.esb.update-management/update-management-components/1.8.3/script/scripts~update~print-update-info
|
||||
</configfile>
|
||||
<!-- --><!-- -->
|
||||
<configfile finalname="scripts/update/update-get" override="true">
|
||||
mvn:ru.entaxy.esb.update-management/update-management-components/1.8.3/script/scripts~update~update-get
|
||||
</configfile>
|
||||
<!-- --><!-- -->
|
||||
<configfile finalname="scripts/update/update-info" override="true">
|
||||
mvn:ru.entaxy.esb.update-management/update-management-components/1.8.3/script/scripts~update~update-info
|
||||
</configfile>
|
||||
<!-- --><!-- -->
|
||||
<configfile finalname="scripts/update/update-install" override="true">
|
||||
mvn:ru.entaxy.esb.update-management/update-management-components/1.8.3/script/scripts~update~update-install
|
||||
</configfile>
|
||||
<!-- --><!-- -->
|
||||
<configfile finalname="scripts/update/update-list" override="true">
|
||||
mvn:ru.entaxy.esb.update-management/update-management-components/1.8.3/script/scripts~update~update-list
|
||||
</configfile>
|
||||
<!-- --><!-- -->
|
||||
<configfile finalname="scripts/update/update-prepare" override="true">
|
||||
mvn:ru.entaxy.esb.update-management/update-management-components/1.8.3/script/scripts~update~update-prepare
|
||||
</configfile>
|
||||
<!-- --><!-- -->
|
||||
<configfile finalname="scripts/update/utils" override="true">
|
||||
mvn:ru.entaxy.esb.update-management/update-management-components/1.8.3/script/scripts~update~utils
|
||||
</configfile>
|
||||
<!-- -->
|
@ -0,0 +1,96 @@
|
||||
# source scripts/updtae/utils
|
||||
# source scripts/updtae/operations
|
||||
|
||||
__EXEC_PLAN = {
|
||||
|
||||
_thePlan = $1
|
||||
|
||||
each $_thePlan {
|
||||
|
||||
_data = $it
|
||||
|
||||
# echo "DATA :: ${_data}"
|
||||
|
||||
_rebootVal = ($_data get "reboot")
|
||||
_reboot = ($_rebootVal equals "true")
|
||||
_forceReboot = ($_rebootVal equals "force")
|
||||
|
||||
_sleep = ($_data get "sleep")
|
||||
|
||||
_operation = $_data get "operation"
|
||||
|
||||
__RESULT__ = [error=false]
|
||||
|
||||
_checkReboot = (__FALSE__)
|
||||
|
||||
echo
|
||||
echo "\-\-\-"
|
||||
echo " Perfoming operation: ${_operation}"
|
||||
|
||||
_result = __exec_operation ${_operation} ${_data}
|
||||
|
||||
|
||||
if { $_operation equals "feature" } {
|
||||
|
||||
_st = $__RESULT__ get "status"
|
||||
echo "\>\> ...${_st}"
|
||||
|
||||
if { NOT { $_result } } {
|
||||
echo "\>\> Failed upgrading \[${_featureName}\] from repo \[${_repo}\]"
|
||||
$__RESULT__ put "error" true
|
||||
$__RESULT__ put "status" "FAILED"
|
||||
break
|
||||
}
|
||||
|
||||
if { $_st equals "ALREADY_INSTALLED" } {
|
||||
echo "\>\> No changes made for \[${_featureName}\] from repo \[${_repo}\]"
|
||||
continue
|
||||
}
|
||||
|
||||
if { $_st equals "INSTALLED" } {
|
||||
echo "\>\> Successfully installed ${_featureName} from repo ${_repo}"
|
||||
_checkReboot = (__TRUE__)
|
||||
}
|
||||
}
|
||||
|
||||
# end of operation
|
||||
echo
|
||||
|
||||
# ensure we have status after last operation
|
||||
sz = $installPlan size
|
||||
_lastData = $installPlan get %(sz-1)
|
||||
if { $_lastData equals $_data } {
|
||||
_st = $__RESULT__ get "status"
|
||||
if { "${_st}" equals "" } {
|
||||
$__RESULT__ put "status" "INSTALLED"
|
||||
}
|
||||
}
|
||||
|
||||
# sleep - needed for refreshed initializers to complete
|
||||
if { NOT { $_sleep equals "" } } {
|
||||
echo "Sleeping for ${_sleep} seconds"
|
||||
shell:sleep $_sleep
|
||||
}
|
||||
|
||||
# process reboot
|
||||
if { $_checkReboot } {
|
||||
if { $_reboot } {
|
||||
echo "~~~~~~~~"
|
||||
echo "System must be rebooted"
|
||||
$__RESULT__ put "reboot" "true"
|
||||
$__RESULT__ put "status" "INSTALLING"
|
||||
break
|
||||
}
|
||||
if { $_forceReboot } {
|
||||
echo "~~~~~~~~"
|
||||
echo "System must be rebooted"
|
||||
$__RESULT__ put "reboot" "force"
|
||||
$__RESULT__ put "status" "INSTALLING"
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,190 @@
|
||||
|
||||
source scripts/update/utils
|
||||
|
||||
# Installs (if not present) feature repo and upgrades (if not present) feature
|
||||
# $1 - map of params
|
||||
# return true if succeded
|
||||
__check_upgrade_feature = {
|
||||
|
||||
featuresService = (service:get org.apache.karaf.features.FeaturesService)
|
||||
|
||||
_params = $1
|
||||
|
||||
# echo " :: __check_upgrade_feature :: "
|
||||
|
||||
_repoToInstall = ($_params get "repo")
|
||||
_featureName = ($_params get "feature")
|
||||
_upgrade = ($_params get "upgrade")
|
||||
|
||||
_u = ""
|
||||
|
||||
if { $_upgrade } {
|
||||
_u = "-u"
|
||||
}
|
||||
|
||||
_res = (__TRUE__)
|
||||
|
||||
echo "... process repo: ${_repoToInstall} ..."
|
||||
|
||||
_repoResult = __utils_check_install_repo $_repoToInstall
|
||||
if { NOT { $_repoResult } } {
|
||||
__RESULT__ = [error=true message="Failed installing repository: ${_repoToInstall}" status="FAILED"]
|
||||
_res = (__FALSE__)
|
||||
} else {
|
||||
echo "... process feature: ${_featureName} ..."
|
||||
|
||||
_feature = ($featuresService getFeature $_featureName $_version)
|
||||
if { $_feature equals '' } {
|
||||
__RESULT__ = [error=true message="Feature not found: ${_featureName}" status="FAILED"]
|
||||
_res = (__FALSE__)
|
||||
} else {
|
||||
_featureId = $_feature getId
|
||||
_state = ($featuresService getState $_featureId) toString
|
||||
|
||||
if { NOT { $_state equals "Started" } } {
|
||||
echo "\>\> Installing feature ${_featureName}/${_version} ..."
|
||||
try {
|
||||
feature:install -v "${_u}" "${_featureName}/${_version}"
|
||||
__RESULT__ = [error=false status="INSTALLED"]
|
||||
} catch {
|
||||
__RESULT__ = [error=true message="Error installing feature: ${_featureName}" status="FAILED"]
|
||||
echo "\>\> ... failed"
|
||||
_res = (__FALSE__)
|
||||
}
|
||||
if { $_res } {
|
||||
echo "\>\> ... installed"
|
||||
|
||||
_state = ($featuresService getState $_featureId) toString
|
||||
|
||||
if { NOT { $_state equals "Started" } } {
|
||||
__RESULT__ = [error=true message="Error installing feature: ${_featureName}" status="FAILED"]
|
||||
_res = (__FALSE__)
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
__RESULT__ = [error=false status="ALREADY_INSTALLED"]
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_s = $__RESULT__ get "status"
|
||||
# echo "Return status: ${_s}"
|
||||
|
||||
$_res
|
||||
}
|
||||
|
||||
__feature_post = {
|
||||
_res = $1
|
||||
_st = $__RESULT__ get "status"
|
||||
echo "\>\> ...${_st}"
|
||||
_toReturn = []
|
||||
|
||||
if { NOT { $_res } } {
|
||||
echo "\>\> Failed upgrading \[${_featureName}\] from repo \[${_repo}\]"
|
||||
$__RESULT__ put "error" true
|
||||
$__RESULT__ put "status" "FAILED"
|
||||
_toReturn = [break=(__TRUE__) checkReboot = (__FALSE__)]
|
||||
}
|
||||
|
||||
if { $_st equals "ALREADY_INSTALLED" } {
|
||||
echo "\>\> No changes made for \[${_featureName}\] from repo \[${_repo}\]"
|
||||
_toReturn = [continue=(__TRUE__) checkReboot = (__FALSE__)]
|
||||
}
|
||||
|
||||
if { $_st equals "INSTALLED" } {
|
||||
echo "\>\> Successfully installed ${_featureName} from repo ${_repo}"
|
||||
_toReturn = [checkReboot = (__TRUE__)]
|
||||
}
|
||||
|
||||
# echo "_toReturn :: "
|
||||
# echo ${_toReturn}
|
||||
|
||||
$_toReturn
|
||||
}
|
||||
|
||||
commonsIoId = [ ((list -s -t 0 | grep "org.apache.commons.io") split ' ') ] get 0
|
||||
# echo "!!!! COMMONS-IO :: ${commonsIoId}"
|
||||
|
||||
__backup = {
|
||||
_params = $1
|
||||
|
||||
_action = ($_params get "action")
|
||||
_origin = ($_params get "source")
|
||||
_bak = "${_origin}.bak"
|
||||
|
||||
echo "\>\> EXEC BACKUP \[$_action\]"
|
||||
|
||||
if { $_action equals "create" } {
|
||||
_overwrite = ($_params get "overwrite")
|
||||
_from = new (($.context bundle) loadClass java.io.File) $_origin
|
||||
_to = new (($.context bundle) loadClass java.io.File) "$_bak"
|
||||
if { $_overwrite } {
|
||||
_exists = ($_to exists)
|
||||
if { NOT { $_exists } } {
|
||||
_r = ((($.context bundle %(commonsIoId+0)) loadClass org.apache.commons.io.FileUtils) copyFile $_from $_to)
|
||||
} else {
|
||||
echo "\>\> .. skipping: backup already exists"
|
||||
}
|
||||
} else {
|
||||
_r = ((($.context bundle %(commonsIoId+0)) loadClass org.apache.commons.io.FileUtils) copyFile $_from $_to)
|
||||
}
|
||||
}
|
||||
if { $_action equals "restore" } {
|
||||
_to = new (($.context bundle) loadClass java.io.File) $_origin
|
||||
_from = new (($.context bundle) loadClass java.io.File) "$_bak"
|
||||
_r = ((($.context bundle %(commonsIoId+0)) loadClass org.apache.commons.io.FileUtils) copyFile $_from $_to)
|
||||
}
|
||||
if { $_action equals "clean" } {
|
||||
_from = new (($.context bundle) loadClass java.io.File) "$_bak"
|
||||
_exists = ($_from exists)
|
||||
if { $_exists } {
|
||||
_r = ((($.context bundle %(commonsIoId+0)) loadClass org.apache.commons.io.FileUtils) forceDelete $_from)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
__OPERATIONS = new java.util.HashMap
|
||||
|
||||
__add_operation = {
|
||||
$__OPERATIONS put $1 $2
|
||||
}
|
||||
|
||||
__exec_operation = {
|
||||
_oper = $1
|
||||
_data = $2
|
||||
# echo "__exec_operation ${_oper} ${_data}"
|
||||
# echo ($__OPERATIONS get $_oper)
|
||||
if { $__OPERATIONS containsKey $_oper } {
|
||||
_toExec = $__OPERATIONS get $_oper
|
||||
# echo $_toExec
|
||||
_execString = "${_toExec} \${_data}"
|
||||
# echo $_execString
|
||||
eval $_execString
|
||||
} else {
|
||||
"OPERATION_NOT_FOUND"
|
||||
}
|
||||
}
|
||||
|
||||
__exec_operation_post = {
|
||||
_oper = $1
|
||||
_mainResult = $2
|
||||
echo "__exec_operation ${_oper}-post ${_mainResult}"
|
||||
echo ($__OPERATIONS get "${_oper}-post")
|
||||
if { $__OPERATIONS containsKey "${_oper}-post" } {
|
||||
_toExec = $__OPERATIONS get "${_oper}-post"
|
||||
echo $_toExec
|
||||
_execString = "${_toExec} \${_mainResult}"
|
||||
echo $_execString
|
||||
eval $_execString
|
||||
} else {
|
||||
"NOT_FOUND"
|
||||
}
|
||||
}
|
||||
|
||||
__add_operation "feature" __check_upgrade_feature
|
||||
__add_operation "feature-post" __feature_post
|
||||
__add_operation "backup" __backup
|
@ -0,0 +1,84 @@
|
||||
_version = $1
|
||||
_versionFormatted = ($_version replaceAll '-' '.')
|
||||
|
||||
if { NOT { "noHeader" equals $2 } } {
|
||||
|
||||
# print header
|
||||
# ID:20 Version:20 Type:12 Status:20 Repository:
|
||||
echo " ID \| Version \| Type \| Status \| Repository "
|
||||
echo " -------------------------------------------------------------------------------------------------- "
|
||||
|
||||
}
|
||||
|
||||
|
||||
__printLine = {
|
||||
|
||||
# $1 - list of data
|
||||
# $2 - list of lengths
|
||||
# $3 - list of prefixes
|
||||
|
||||
_result = ""
|
||||
i = 0
|
||||
_lengths = $2
|
||||
_prefixes = $3
|
||||
|
||||
# echo "__printLine"
|
||||
# echo (${i} getClass)
|
||||
|
||||
t = ($_lengths get ${i})
|
||||
# echo $t
|
||||
|
||||
each $1 {
|
||||
_length = ($_lengths get ${i})
|
||||
_prefix = ($_prefixes get $i)
|
||||
_value = ((($.context bundle) loadClass java.lang.String) format "\%-${_length}s" "${_prefix}${it}" )
|
||||
|
||||
# echo $_value
|
||||
|
||||
if { NOT { $_result equals ''} } {
|
||||
_result = "${_result}\|"
|
||||
}
|
||||
_result = "${_result}${_value}"
|
||||
# echo (${i} getClass)
|
||||
%(i+=1)
|
||||
# echo (${i} getClass)
|
||||
}
|
||||
|
||||
# _id = ((($.context bundle) loadClass java.lang.String) format "\%-20s" $2 )
|
||||
# _version = ((($.context bundle) loadClass java.lang.String) format "\%-20s" $3 )
|
||||
# _status = ((($.context bundle) loadClass java.lang.String) format "\%-16s" $4 )
|
||||
# _repo = ((($.context bundle) loadClass java.lang.String) format "\%-20s" $5 )
|
||||
|
||||
# echo "${_id}\|${_version}\|${_status}\|${_repo}"
|
||||
echo $_result
|
||||
}
|
||||
|
||||
_pid = "entaxy.update.$_versionFormatted"
|
||||
_configExists = config:exists $_pid
|
||||
|
||||
if { $_configExists } {
|
||||
|
||||
featuresService = (service:get org.apache.karaf.features.FeaturesService)
|
||||
configService = (service:get org.osgi.service.cm.ConfigurationAdmin)
|
||||
configuration = ($configService getConfiguration $_pid)
|
||||
properties = ($configuration getProperties)
|
||||
|
||||
_configFeature = ($featuresService getFeature "entaxy-update-configuration" $_version)
|
||||
|
||||
_values = [($properties get 'update.id') ($properties get "update.version") ($properties get "update.type") ($properties get "update.status") ($properties get "update.repo")]
|
||||
_lengths = [20 20 12 20 10]
|
||||
_prefixes = [' ' ' ' ' ' ' ' ' ']
|
||||
|
||||
__printLine $_values $_lengths $_prefixes
|
||||
|
||||
_components = ( config:property-get -p $_pid "components") toString
|
||||
_componentsList = $_components split ","
|
||||
|
||||
_prefixes = [' - ' ' * ' ' ' ' ' ' ']
|
||||
|
||||
each $_componentsList {
|
||||
_component = (${it}) trim
|
||||
_values = [($properties get "${_component}.feature") ($properties get "${_component}.current.version") "" ($properties get "${_component}.status") ($properties get "${_component}.update.repo")]
|
||||
__printLine $_values $_lengths $_prefixes
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
_version = $1
|
||||
|
||||
echo
|
||||
echo "************"
|
||||
echo Getting update with version $_version
|
||||
echo "************"
|
||||
echo
|
||||
|
||||
_repo = (feature:repo-list | grep ru.entaxy.esb/update/$_version)
|
||||
_repo_length = ($_repo length)
|
||||
if { $_repo_length'' equals "0" } {
|
||||
echo "\>\> Installing Entaxy update $_version repository..."
|
||||
feature:repo-add mvn:ru.entaxy.esb/update/$_version/xml/update
|
||||
echo "\>\> ... installed"
|
||||
} else {
|
||||
echo "\>\> Entaxy update $_version repository is already installed"
|
||||
}
|
||||
|
||||
_versionFormatted = ($_version toString) replaceAll "-" "."
|
||||
|
||||
service = (service:get org.apache.karaf.features.FeaturesService)
|
||||
|
||||
_configFeature = ($service getFeature "entaxy-update-configuration" $_version)
|
||||
_configFeatureId = $_configFeature getId
|
||||
_state = ($service getState $_configFeatureId) toString
|
||||
|
||||
echo
|
||||
if { NOT { $_state equals "Started" } } {
|
||||
echo "\>\> Installing Entaxy update $_version configuration..."
|
||||
feature:install -v -r "entaxy-update-configuration"/$_version
|
||||
echo "\>\> ... installed"
|
||||
}
|
||||
|
||||
_state = ($service getState $_configFeatureId) toString
|
||||
|
||||
echo
|
||||
if { $_state equals "Started" } {
|
||||
echo "Configuration loaded for version $_version"
|
||||
} else {
|
||||
echo "Configuration load failed for version $_version"
|
||||
}
|
||||
echo
|
@ -0,0 +1,14 @@
|
||||
_version = $1
|
||||
_versionFormatted = ($_version replaceAll '-' '.')
|
||||
|
||||
featureService = (service:get org.apache.karaf.features.FeaturesService)
|
||||
|
||||
_configFeature = ($featureService getFeature "entaxy-update-configuration" $_version)
|
||||
|
||||
if { $_configFeature equals ''} {
|
||||
echo "!!!"
|
||||
echo "Update ${_version} not found"
|
||||
} else {
|
||||
source scripts/update/print-update-info $_version
|
||||
}
|
||||
echo
|
@ -0,0 +1,271 @@
|
||||
source scripts/update/utils
|
||||
|
||||
_version = $1
|
||||
_versionFormatted = ($_version replaceAll '-' '.')
|
||||
|
||||
partial = (__FALSE__)
|
||||
|
||||
argsSplitted = $__ORIGIN_ARGS__ split " "
|
||||
|
||||
each $argsSplitted {
|
||||
|
||||
_arg = $it
|
||||
_val = $_arg trim
|
||||
|
||||
if { "partial" equals $_val } {
|
||||
partial = (__TRUE__)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
featureService = (service:get org.apache.karaf.features.FeaturesService)
|
||||
|
||||
_configFeature = ($featureService getFeature "entaxy-update-configuration" $_version)
|
||||
|
||||
__set_component_status = {
|
||||
_comp = $1
|
||||
_prop = "${_comp}.status"
|
||||
if { $_comp equals '' } {
|
||||
_prop = "update.status"
|
||||
}
|
||||
config:edit $_pid
|
||||
config:property-set "${_prop}" $2
|
||||
config:update
|
||||
}
|
||||
|
||||
if { $_configFeature equals ''} {
|
||||
echo "!!!"
|
||||
echo "Update ${_version} not found"
|
||||
} else {
|
||||
|
||||
_pid = "entaxy.update.$_versionFormatted"
|
||||
|
||||
configService = (service:get org.osgi.service.cm.ConfigurationAdmin)
|
||||
configuration = ($configService getConfiguration $_pid)
|
||||
properties = ($configuration getProperties)
|
||||
|
||||
_components = ( $properties get "components") toString
|
||||
_componentsList = $_components split ","
|
||||
|
||||
total = ($_componentsList length)
|
||||
installed = new java.util.ArrayList
|
||||
toInstall = new java.util.ArrayList
|
||||
blocked = new java.util.ArrayList
|
||||
|
||||
each $_componentsList {
|
||||
|
||||
_component = $it
|
||||
_status = ($properties get "${_component}.status")
|
||||
# echo "${it} : ${_status}"
|
||||
|
||||
if { $_status equals "INSTALLED" } {
|
||||
($installed add $_component)
|
||||
continue
|
||||
}
|
||||
|
||||
if { $_status equals "VERSION_MISMATCH" } {
|
||||
echo "!!! ERROR !!!"
|
||||
echo "Update can not be installed: VERSION_MISMATCH for component \[${_component}\]"
|
||||
break
|
||||
}
|
||||
|
||||
_repo = ($properties get "${_component}.update.repo")
|
||||
if { $_repo equals '' } {
|
||||
_status = "REPO_NOT_FOUND"
|
||||
|
||||
__set_component_status ${_component} $_status
|
||||
|
||||
} else {
|
||||
|
||||
# echo " CHECK !!!"
|
||||
_exists = __utils_check_install_repo $_repo
|
||||
|
||||
if { NOT { $_exists } } {
|
||||
_status = "REPO_NOT_FOUND"
|
||||
__set_component_status ${_component} $_status
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if { $_status equals "REPO_NOT_FOUND" } {
|
||||
|
||||
($blocked add $_component)
|
||||
|
||||
if { $partial } {
|
||||
|
||||
echo ""
|
||||
echo "\-\-\- INFO \-\-\-"
|
||||
echo "Update can not be installed: REPO_NOT_FOUND for component \[${_component}\]"
|
||||
echo "Partial update is allowed, so the process will move on"
|
||||
echo ""
|
||||
continue
|
||||
|
||||
} else {
|
||||
echo ""
|
||||
echo "!!! ERROR !!!"
|
||||
echo "Update can not be installed: REPO_NOT_FOUND for component \[${_component}\]"
|
||||
echo "Partial update is NOT allowed, so the process will stop"
|
||||
echo ""
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
($toInstall add $_component)
|
||||
|
||||
}
|
||||
|
||||
# echo $total
|
||||
# echo $installed
|
||||
# echo $toInstall
|
||||
# echo $blocked
|
||||
|
||||
_processInstall = (__FALSE__)
|
||||
|
||||
if { ($toInstall isEmpty) } {
|
||||
echo "Nothing to install"
|
||||
} else {
|
||||
sz = ($toInstall size)
|
||||
if { %(sz < total) } {
|
||||
# echo "Partial install"
|
||||
_processInstall = $partial
|
||||
} else {
|
||||
_processInstall = (__TRUE__)
|
||||
}
|
||||
}
|
||||
|
||||
_rebootNeeded = new (($.context bundle) loadClass java.lang.Boolean) 'false'
|
||||
|
||||
# echo
|
||||
# echo "${toInstall}"
|
||||
# echo ($toInstall size)
|
||||
# echo
|
||||
|
||||
totalToInstall = ($toInstall size)
|
||||
# echo "TOTAL :: ${totalToInstall}"
|
||||
|
||||
if { $_processInstall } {
|
||||
__set_component_status '' "INSTALLING"
|
||||
each $toInstall {
|
||||
_component = $it
|
||||
_baseFeatureName = $properties get "${_component}.feature"
|
||||
_featureName = "${_baseFeatureName}-update"
|
||||
_feature = ($featureService getFeature "${_featureName}" $_version)
|
||||
_featureStatus = ($featureService getState $_feature) toString
|
||||
if { $_featureStatus equals "Uninstalled" } {
|
||||
feature:install -v -r "${_featureName}/$_version"
|
||||
_featureStatus = ($featureService getState $_feature) toString
|
||||
# echo " AFTER INSTALL :: ${_featureStatus}"
|
||||
if { NOT { $_featureStatus equals "Started" } } {
|
||||
__set_component_status ${_component} "FEATURE_INSTALL_FAILED"
|
||||
($blocked add $_component)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
karafRoot = ((($.context bundle) loadClass java.lang.System) getProperty 'karaf.home')
|
||||
cd $karafRoot
|
||||
cd updates/$_version
|
||||
_files = (shell:ls -m) toString
|
||||
cd $karafRoot
|
||||
|
||||
_filesArr = ($_files split ",")
|
||||
_filesList = new java.util.ArrayList
|
||||
each $_filesArr {
|
||||
$_filesList add ($it trim)
|
||||
}
|
||||
_current = $properties get "${_component}.current.version"
|
||||
_componentFeatureName = $properties get "${_component}.feature"
|
||||
li = $_current length
|
||||
_script = ""
|
||||
while { %(li>0) } {
|
||||
|
||||
_current = $_current substring 0 $li
|
||||
_scriptName = "${_componentFeatureName}.${_current}.update"
|
||||
|
||||
# echo "TEST :: $_scriptName"
|
||||
if { $_filesList contains $_scriptName } {
|
||||
_script = $_scriptName
|
||||
break
|
||||
}
|
||||
|
||||
li = $_current lastIndexOf "."
|
||||
|
||||
|
||||
}
|
||||
if { $_script equals '' } {
|
||||
|
||||
_scriptName = "${_componentFeatureName}.update"
|
||||
echo "TEST :: $_scriptName"
|
||||
}
|
||||
|
||||
# echo "SCRIPT :: ${_scriptName}"
|
||||
|
||||
echo "\>\> Running installations script"
|
||||
echo "\>\> updates/${_version}/${_script}"
|
||||
|
||||
source updates/$_version/$_script
|
||||
|
||||
# echo "RESULT :: ${__RESULT__}"
|
||||
_error = ($__RESULT__ get "error")
|
||||
|
||||
if { $_error } {
|
||||
_message = $__RESULT__ get "message"
|
||||
echo ""
|
||||
echo "!!! ERROR !!!"
|
||||
echo "${_message}"
|
||||
echo
|
||||
}
|
||||
|
||||
_resultStatus = $__RESULT__ get "status"
|
||||
if { $_resultStatus equals 'ALREADY_INSTALLED' } {
|
||||
_resultStatus = "INSTALLED"
|
||||
}
|
||||
|
||||
if { $_resultStatus equals 'INSTALLED' } {
|
||||
%(totalToInstall-=1)
|
||||
}
|
||||
|
||||
if { NOT { $_resultStatus equals '' } } {
|
||||
__set_component_status ${_component} $_resultStatus
|
||||
}
|
||||
|
||||
_reboot = ($__RESULT__ get "reboot")
|
||||
if { NOT { $_reboot equals "" } } {
|
||||
if { NOT { $_reboot equals "false" } } {
|
||||
_rebootNeeded = (__TRUE__)
|
||||
echo "** the system will reboot now to apply updates"
|
||||
echo
|
||||
echo "** PLEASE RUN THE SCRIPT AGAIN AFTER RESTART **"
|
||||
if { $_reboot equals "force" } {
|
||||
shutdown -r -f
|
||||
} else {
|
||||
shutdown -r
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
blockedSize = ($blocked size)
|
||||
|
||||
if { NOT { $_rebootNeeded } } {
|
||||
|
||||
if { %(totalToInstall+blockedSize>0) } {
|
||||
__set_component_status '' "PARTIAL_INSTALLED"
|
||||
} else {
|
||||
__set_component_status '' "INSTALLED"
|
||||
}
|
||||
|
||||
echo
|
||||
echo "*********"
|
||||
echo "** UPDATE FINISHED"
|
||||
echo "*********"
|
||||
source scripts/update/print-update-info $_version
|
||||
echo
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
#_version = $1
|
||||
#_versionFormatted = ($_version replaceAll '-' '.')
|
||||
|
||||
echo
|
||||
|
||||
#print header only
|
||||
source scripts/update/print-update-info "0"
|
||||
|
||||
featuresService = (service:get org.apache.karaf.features.FeaturesService)
|
||||
_features = ( $featuresService getFeatures "entaxy-update-configuration" )
|
||||
|
||||
each ($_features) {
|
||||
|
||||
version = ($it getVersion)
|
||||
source scripts/update/print-update-info $version "noHeader"
|
||||
|
||||
}
|
||||
echo
|
@ -0,0 +1,136 @@
|
||||
_version = $1
|
||||
|
||||
echo
|
||||
echo "************"
|
||||
echo Preparing update with version $_version
|
||||
echo "************"
|
||||
echo
|
||||
|
||||
_versionFormatted = ($_version toString) replaceAll "-" "."
|
||||
|
||||
_pid = "entaxy.update.$_versionFormatted"
|
||||
_configExists = config:exists $_pid
|
||||
|
||||
featuresService = (service:get org.apache.karaf.features.FeaturesService)
|
||||
configService = (service:get org.osgi.service.cm.ConfigurationAdmin)
|
||||
configuration = ($configService getConfiguration $_pid)
|
||||
properties = ($configuration getProperties)
|
||||
|
||||
_found = (new java.util.HashMap)
|
||||
|
||||
if { $_configExists } {
|
||||
_components = ( config:property-get -p $_pid "components") toString
|
||||
_componentsList = $_components split ","
|
||||
|
||||
totalCount = 0
|
||||
installedCount = 0
|
||||
|
||||
each $_componentsList {
|
||||
_component = (${it}) trim
|
||||
_componentFeatureNameProp = "${_component}\.feature"
|
||||
# echo "${_componentFeatureNameProp}"
|
||||
_componentFeatureName = ( config:property-get -p $_pid ${_componentFeatureNameProp} )
|
||||
# echo $_componentFeatureName
|
||||
_features = ($featuresService getFeatures $_componentFeatureName )
|
||||
|
||||
each ($_features) {
|
||||
_v = ($it getVersion)
|
||||
_status = ($featuresService getState $it) toString
|
||||
# echo $_v
|
||||
# echo ($it getId ) : ($it getName ) $_sqbr$_v']' '-' $_status
|
||||
if { $_status equals "Started" } {
|
||||
$_found put $_component $it
|
||||
|
||||
_versionsProp = "${_component}\.versions"
|
||||
# echo ":${_versionsProp}:${_pid}"
|
||||
_allowedVersionsValues = ( ( config:property-get -p $_pid ${_versionsProp}) toString )
|
||||
# echo $_allowedVersionsValues
|
||||
_allowedVersionsValues = $_allowedVersionsValues split ","
|
||||
_allowedVersions = new ArrayList
|
||||
each $_allowedVersionsValues {
|
||||
$_allowedVersions add (($it trim) replaceAll "-" ".")
|
||||
}
|
||||
# echo "ALLOWED VERSIONS: ${_allowedVersions}"
|
||||
_allowed = $_allowedVersions contains $_v
|
||||
_installed = $_versionFormatted equals $_v
|
||||
# echo "ALLOWED:${_allowed}"
|
||||
|
||||
_updateRepo = ($properties get "${_component}.update.repo")
|
||||
|
||||
config:edit $_pid
|
||||
|
||||
|
||||
config:property-set "${_component}.current" ($it getId)
|
||||
config:property-set "${_component}.current.repo" ($it getRepositoryUrl)
|
||||
config:property-set "${_component}.current.version" $_v
|
||||
config:property-set "${_component}.current.allowed" $_allowed
|
||||
if { $_allowed } {
|
||||
config:property-set "${_component}.status" "PREPARED"
|
||||
} else {
|
||||
if { $_installed } {
|
||||
%(installedCount+=1)
|
||||
config:property-set "${_component}.status" "VERSION_MISMATCH"
|
||||
} else {
|
||||
config:property-set "${_component}.status" "INSTALLED"
|
||||
}
|
||||
}
|
||||
|
||||
if { ($_updateRepo equals '') } {
|
||||
# echo "SET REPO"
|
||||
_currentRepoSplitted = ((($.context bundle) loadClass java.util.Arrays) asList (($it getRepositoryUrl) split "/"))
|
||||
# echo $_currentRepoSplitted
|
||||
_group = (${_currentRepoSplitted} get 0)
|
||||
_artifact = (${_currentRepoSplitted} get 1)
|
||||
_updateRepo = "${_group}/${_artifact}/${_version}/xml\/update"
|
||||
# echo $_updateRepo
|
||||
config:property-set "${_component}.update.repo" $_updateRepo
|
||||
}
|
||||
|
||||
config:update
|
||||
%(totalCount+=1)
|
||||
|
||||
# echo "FOUND:"
|
||||
# echo ($it getId)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_configFeature = ($featuresService getFeature "entaxy-update-configuration" $_version)
|
||||
|
||||
config:edit $_pid
|
||||
|
||||
_updateId = ($properties get "update.id")
|
||||
if { $_updateId equals '' } {
|
||||
config:property-set "update.id" "entaxy-update"
|
||||
}
|
||||
|
||||
_updateVersion = ($properties get "update.version")
|
||||
if { $_updateVersion equals '' } {
|
||||
config:property-set "update.version" $1
|
||||
}
|
||||
|
||||
_updateType = ($properties get "update.type")
|
||||
if { $_updateType equals '' } {
|
||||
config:property-set "update.type" "VERSION"
|
||||
}
|
||||
|
||||
if { $installedCount = 0 } {
|
||||
config:property-set "update.status" "PREPARED"
|
||||
} else {
|
||||
if { $installedCount = $totalCount } {
|
||||
config:property-set "update.status" "INSTALLED"
|
||||
} else {
|
||||
config:property-set "update.status" "PARTIAL"
|
||||
}
|
||||
}
|
||||
config:property-set "update.repo" ($_configFeature getRepositoryUrl)
|
||||
|
||||
config:update
|
||||
|
||||
source scripts/update/update-info $_version
|
||||
} else {
|
||||
echo "!!!"
|
||||
echo "Update configuration for version $_version NOT found"
|
||||
echo "Please run \'entaxy:get-update "${_version}"\'"
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
# $1 - feature repo url
|
||||
# return true if exists
|
||||
__utils_repo_exists = {
|
||||
_repo = $1
|
||||
|
||||
_repos = (feature:repo-list | grep $_repo)
|
||||
_repo_length = ($_repos length)
|
||||
_r = ( NOT { "$_repo_length" equals '0'} )
|
||||
# echo " ${_repo_length} :: $_r"
|
||||
$_r
|
||||
}
|
||||
|
||||
# $1 - feature repo url
|
||||
# return true if succeeded
|
||||
__utils_check_install_repo = {
|
||||
|
||||
_repo = $1
|
||||
|
||||
_exists = __utils_repo_exists $_repo
|
||||
|
||||
if { NOT { $_exists } } {
|
||||
try {
|
||||
r = (feature:repo-add $_repo)
|
||||
} catch { }
|
||||
|
||||
_exists = __utils_repo_exists $_repo
|
||||
}
|
||||
|
||||
$_exists
|
||||
}
|
||||
|
||||
__TRUE__ = {
|
||||
new (($.context bundle) loadClass java.lang.Boolean) 'true'
|
||||
}
|
||||
|
||||
__FALSE__ = {
|
||||
new (($.context bundle) loadClass java.lang.Boolean) 'false'
|
||||
}
|
Reference in New Issue
Block a user