diff --git a/src/sunstone/public/build.sh b/src/sunstone/public/build.sh index e6f4c7da9c..4cafe254ae 100755 --- a/src/sunstone/public/build.sh +++ b/src/sunstone/public/build.sh @@ -5,11 +5,12 @@ set -e #------------------------------------------------------------------------------- usage() { echo - echo "Usage: build.sh [-d] [-c] [-l] [-h]" + echo "Usage: build.sh [-d] [-c] [-l] [-h] [-e]" echo echo "-d: install build dependencies (bower, grunt)" echo "-c: clean build" echo "-l: preserve main.js" + echo "-e: apply enterprise edition patchs" echo "-h: prints this help" } @@ -25,6 +26,26 @@ dependencies() { export PATH=$PATH:$PWD/node_modules/.bin } +install_enterprise_patch() { + PATCH_DIR="./patches/enterprise" + + for i in `ls ${PATCH_DIR}` ; do + if [ -f "${PATCH_DIR}/$i" ]; then + if [ "$ENTERPRISE" = "yes" ]; then + # If the patch is not applied then apply it. + if ! patch -f -s -R -d.. -p1 --dry-run < "${PATCH_DIR}/$i"; then + patch -d.. -p1 <"${PATCH_DIR}/$i" + fi + else + # If the patch is not applied then apply it. + if ! patch -f -s -d.. -p1 --dry-run < "${PATCH_DIR}/$i"; then + patch -R -d.. -p1 <"${PATCH_DIR}/$i" + fi + fi + fi + done +} + install_patch() { npm install @@ -41,6 +62,8 @@ install_patch() { fi done + install_enterprise_patch + if [ "$DO_LINK" = "yes" ]; then mv -f dist/main.js ./main.js fi @@ -95,11 +118,4 @@ if [ "$DEPENDENCIES" = "yes" ]; then exit 0 fi -if [ "$ENTERPRISE" = "yes" ]; then - echo "Enterprise Edition Activated" - sed -i -e 's|OpenNebula <%= OpenNebula::VERSION %>|OpenNebula <%= OpenNebula::VERSION %>
Enterprise Edition
|g' ../views/index.erb -else - sed -i -e 's|OpenNebula <%= OpenNebula::VERSION %>
Enterprise Edition
|OpenNebula <%= OpenNebula::VERSION %>|g' ../views/index.erb -fi - install_patch diff --git a/src/sunstone/public/patches/enterprise/index_enterprise.patch b/src/sunstone/public/patches/enterprise/index_enterprise.patch new file mode 100644 index 0000000000..f2f70f7a76 --- /dev/null +++ b/src/sunstone/public/patches/enterprise/index_enterprise.patch @@ -0,0 +1,10 @@ +--- ../views/index.erb 2020-06-02 11:00:38.387772510 +0200 ++++ ../views/index_enterprise.erb 2020-06-02 11:00:26.479778023 +0200 +@@ -95,6 +95,7 @@ + + +