Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts: separate installation and update submodules scripts #105

Merged
merged 4 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
kb.bin
sc-machine
sc-component-manager
scp-machine
sc-web
ims.ostis.kb_copy
geometry.drawings
web-scn-editor
prepared_kb
ims.ostis.kb

kb.bin
bin
build

Expand Down
9 changes: 9 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Scripts `update_submodules.sh`
- Add sc-component-manager

### Changed

- Separate installation and update submodules scripts

### Deprecated

- Option `--update` in `install_submodules.sh`

## [0.9.0-Unlock] - 22.01.2024

### Changes
Expand Down
54 changes: 0 additions & 54 deletions scripts/clone_update_submodule.sh

This file was deleted.

7 changes: 6 additions & 1 deletion scripts/formats.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
stage()
{
([ -n "$(tput setaf 1 2<&-)" ] && { tput setaf 4 && tput bold && echo "$1" && tput sgr0; }) || echo "$1"
([ -n "$(tput setaf 1 2<&-)" ] && { tput setaf 4 && tput bold && echo "$1" && tput sgr0; }) || echo "$@"
}

warning()
{
([ -n "$(tput setaf 1 2<&-)" ] && { tput setaf 3 && tput bold && echo "$1" && tput sgr0; }) || echo "$@"
}
13 changes: 7 additions & 6 deletions scripts/install_dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env bash
set -eo pipefail

CURRENT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)
source "${CURRENT_DIR}/formats.sh"
SCRIPTS_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)
source "${SCRIPTS_DIR}/formats.sh"

if [[ -z "${SC_MACHINE_PATH}" || -z "${SC_WEB_PATH}" ]];
then
source "${CURRENT_DIR}/set_vars.sh"
source "${SCRIPTS_DIR}/set_vars.sh"
fi

function usage() {
Expand All @@ -22,7 +22,8 @@ USAGE
stage "Install dependencies"

args=()
while [ "$1" != "" ]; do
while [ "$1" != "" ];
do
case $1 in
--dev)
args+=("--dev")
Expand All @@ -38,7 +39,7 @@ while [ "$1" != "" ]; do
shift 1 # remove the current value for `$1` and use the next
done

"${PLATFORM_PATH}/scripts/install_sc_machine_dependencies.sh" "${args[@]}"
"${PLATFORM_PATH}/scripts/install_sc_web_dependencies.sh" "${args[@]}"
"${SCRIPTS_DIR}/install_sc_machine_dependencies.sh" "${args[@]}"
"${SCRIPTS_DIR}/install_sc_web_dependencies.sh" "${args[@]}"

stage "Dependencies installed successfully"
15 changes: 0 additions & 15 deletions scripts/install_ims_kb_submodule.sh

This file was deleted.

19 changes: 7 additions & 12 deletions scripts/install_platform.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
#!/usr/bin/env bash
set -eo pipefail

CURRENT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)
source "${CURRENT_DIR}/formats.sh"

if [[ -z "${SC_MACHINE_PATH}" || -z "${SC_WEB_PATH}" ]];
then
source "${CURRENT_DIR}/set_vars.sh"
fi
SCRIPTS_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)
source "${SCRIPTS_DIR}/formats.sh"

stage "Install ostis-web-platform"

"${PLATFORM_PATH}/scripts/install_submodules.sh"
"${PLATFORM_PATH}/scripts/install_dependencies.sh" --dev
"${PLATFORM_PATH}/scripts/build_sc_machine.sh"
"${PLATFORM_PATH}/scripts/build_sc_web.sh"
"${PLATFORM_PATH}/scripts/build_kb.sh"
"${SCRIPTS_DIR}/install_submodules.sh"
"${SCRIPTS_DIR}/install_dependencies.sh" --dev
"${SCRIPTS_DIR}/build_sc_machine.sh"
"${SCRIPTS_DIR}/build_sc_web.sh"
"${SCRIPTS_DIR}/build_kb.sh"

stage "OSTIS-web-platform installed successfully"
22 changes: 9 additions & 13 deletions scripts/install_platform_with_component_manager.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
#!/usr/bin/env bash
set -eo pipefail

CURRENT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)
source "${CURRENT_DIR}/formats.sh"

if [ -z "${SC_MACHINE_PATH}" ];
then
source "${CURRENT_DIR}/set_vars.sh"
fi
SCRIPTS_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)
SUBMODULE_SCRIPTS_DIR="${SCRIPTS_DIR}/submodule-scripts"
source "${SCRIPTS_DIR}/formats.sh"

stage "Install ostis-web-platform"

"${PLATFORM_PATH}/scripts/install_sc_machine_submodule.sh"
"${PLATFORM_PATH}/scripts/install_sc_machine_dependencies.sh" --dev
"${PLATFORM_PATH}/scripts/install_sc_component_manager_submodule.sh"
"${PLATFORM_PATH}/scripts/build_sc_machine.sh"
"${PLATFORM_PATH}/scripts/build_sc_component_manager.sh"
"${PLATFORM_PATH}/scripts/build_kb.sh"
"${SUBMODULE_SCRIPTS_DIR}/install_sc_machine.sh"
"${SCRIPTS_DIR}/install_sc_machine_dependencies.sh" --dev
"${SUBMODULE_SCRIPTS_DIR}/install_sc_component_manager.sh"
"${SCRIPTS_DIR}/build_sc_machine.sh"
"${SCRIPTS_DIR}/build_sc_component_manager.sh"
"${SCRIPTS_DIR}/build_kb.sh"

stage "OSTIS-web-platform installed successfully"
15 changes: 0 additions & 15 deletions scripts/install_sc_component_manager_submodule.sh

This file was deleted.

6 changes: 3 additions & 3 deletions scripts/install_sc_machine_dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env bash
set -eo pipefail

CURRENT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)
source "${CURRENT_DIR}/formats.sh"
SCRIPTS_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)
source "${SCRIPTS_DIR}/formats.sh"

if [ -z "${SC_MACHINE_PATH}" ];
then
source "${CURRENT_DIR}/set_vars.sh"
source "${SCRIPTS_DIR}/set_vars.sh"
fi

stage "Install sc-machine dependencies"
Expand Down
15 changes: 0 additions & 15 deletions scripts/install_sc_machine_submodule.sh

This file was deleted.

6 changes: 3 additions & 3 deletions scripts/install_sc_web_dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env bash
set -eo pipefail

CURRENT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)
source "${CURRENT_DIR}/formats.sh"
SCRIPTS_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)
source "${SCRIPTS_DIR}/formats.sh"

if [ -z "${SC_WEB_PATH}" ];
then
source "${CURRENT_DIR}/set_vars.sh"
source "${SCRIPTS_DIR}/set_vars.sh"
fi

stage "Install sc-web dependencies"
Expand Down
15 changes: 0 additions & 15 deletions scripts/install_sc_web_submodule.sh

This file was deleted.

39 changes: 24 additions & 15 deletions scripts/install_submodules.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
#!/usr/bin/env bash
set -eo pipefail

CURRENT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)
source "${CURRENT_DIR}/formats.sh"
SCRIPTS_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)
SUBMODULE_SCRIPTS_DIR="${SCRIPTS_DIR}/submodule-scripts"
source "${SCRIPTS_DIR}/formats.sh"

if [[ -z "${PLATFORM_PATH}" || -z "${SC_MACHINE_PATH}" || -z "${SC_WEB_PATH}" || -z "${SC_COMPONENT_MANAGER_PATH}" \
|| -z "${SC_MACHINE_REPO}" || -z "${SC_WEB_REPO}" || -z "${SC_COMPONENT_MANAGER_REPO}" \
|| -z "${SC_MACHINE_BRANCH}" || -z "${SC_WEB_BRANCH}" || -z "${SC_COMPONENT_MANAGER_BRANCH}" \
|| -z "${SC_MACHINE_COMMIT}" || -z "${SC_WEB_COMMIT}" || -z "${SC_COMPONENT_MANAGER_COMMIT}" ]];
if [[ -z "${PLATFORM_PATH}" ]];
then
source "${CURRENT_DIR}/set_vars.sh"
source "${SCRIPTS_DIR}/set_vars.sh"
fi


usage() {
cat <<USAGE
Usage: $0 [--update]
Expand All @@ -26,26 +23,38 @@ USAGE
exit 1
}

UPDATE=0

while [ "$1" != "" ];
do
case $1 in
"--help" | "-h" )
usage
;;
"--update" )
UPDATE=1
;;
* )
usage
;;
esac
shift 1
done

stage "Clone submodules"
if (( UPDATE == 1 ));
then
warning "The option \"--update\" is deprecated. Use \"update_submodules.sh\" instead."

"${SCRIPTS_DIR}/update_submodules.sh"
else
stage "Clone submodules"

cd "${PLATFORM_PATH}" && git submodule update --init --recursive
cd "${PLATFORM_PATH}" && git submodule update --init --recursive

"${PLATFORM_PATH}/scripts/install_sc_machine_submodule.sh" "$@"
"${PLATFORM_PATH}/scripts/install_sc_component_manager_submodule.sh" "$@"
"${PLATFORM_PATH}/scripts/install_sc_web_submodule.sh" "$@"
"${PLATFORM_PATH}/scripts/install_ims_kb_submodule.sh" "$@"
"${SUBMODULE_SCRIPTS_DIR}/install_sc_machine.sh"
"${SUBMODULE_SCRIPTS_DIR}/install_sc_component_manager.sh"
"${SUBMODULE_SCRIPTS_DIR}/install_sc_web.sh"
"${SUBMODULE_SCRIPTS_DIR}/install_ims_ostis_kb.sh"

stage "Submodules cloned successfully"
stage "Submodules cloned successfully"
fi
12 changes: 12 additions & 0 deletions scripts/submodule-scripts/install_ims_ostis_kb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -eo pipefail

SUBMODULE_SCRIPTS_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)
UTILS_DIR="${SUBMODULE_SCRIPTS_DIR}/utils"

if [[ -z "${IMS_KB_REPO}" || -z "${IMS_KB_PATH}" || -z "${IMS_KB_BRANCH}" || -z "${IMS_KB_COMMIT}" ]];
then
source "${SUBMODULE_SCRIPTS_DIR}/../set_vars.sh"
fi

"${UTILS_DIR}/install_submodule.sh" --repo "${IMS_KB_REPO}" --path "${IMS_KB_PATH}" --branch "${IMS_KB_BRANCH}" --commit "${IMS_KB_COMMIT}"
12 changes: 12 additions & 0 deletions scripts/submodule-scripts/install_sc_component_manager.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -eo pipefail

SUBMODULE_SCRIPTS_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)
UTILS_DIR="${SUBMODULE_SCRIPTS_DIR}/utils"

if [[ -z "${SC_COMPONENT_MANAGER_REPO}" || -z "${SC_COMPONENT_MANAGER_PATH}" || -z "${SC_COMPONENT_MANAGER_BRANCH}" || -z "${SC_COMPONENT_MANAGER_COMMIT}" ]];
then
source "${SUBMODULE_SCRIPTS_DIR}/../set_vars.sh"
fi

"${UTILS_DIR}/install_submodule.sh" --repo "${SC_COMPONENT_MANAGER_REPO}" --path "${SC_COMPONENT_MANAGER_PATH}" --branch "${SC_COMPONENT_MANAGER_BRANCH}" --commit "${SC_COMPONENT_MANAGER_COMMIT}"
12 changes: 12 additions & 0 deletions scripts/submodule-scripts/install_sc_machine.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -eo pipefail

SUBMODULE_SCRIPTS_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)
UTILS_DIR="${SUBMODULE_SCRIPTS_DIR}/utils"

if [[ -z "${SC_MACHINE_REPO}" || -z "${SC_MACHINE_PATH}" || -z "${SC_MACHINE_BRANCH}" || -z "${SC_MACHINE_COMMIT}" ]];
then
source "${SUBMODULE_SCRIPTS_DIR}/../set_vars.sh"
fi

"${UTILS_DIR}/install_submodule.sh" --repo "${SC_MACHINE_REPO}" --path "${SC_MACHINE_PATH}" --branch "${SC_MACHINE_BRANCH}" --commit "${SC_MACHINE_COMMIT}"
Loading
Loading