1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

M #-: Use patches for enterprise edition (#4874)

Signed-off-by: Frederick <fborges@opennebula.io>
This commit is contained in:
Frederick Borges 2020-06-03 14:45:11 +02:00 committed by GitHub
parent 830045e17e
commit bbbd904f6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 8 deletions

View File

@ -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|<a href="http://opennebula.io" target="_blank">OpenNebula <%= OpenNebula::VERSION %></a>|<a href="http://opennebula.io" target="_blank">OpenNebula <%= OpenNebula::VERSION %></a><div id="enterprise_edition"><a href="http://opennebula.io/enterprise" target="_blank">Enterprise Edition</a></div>|g' ../views/index.erb
else
sed -i -e 's|<a href="http://opennebula.io" target="_blank">OpenNebula <%= OpenNebula::VERSION %></a><div id="enterprise_edition"><a href="http://opennebula.io/enterprise" target="_blank">Enterprise Edition</a></div>|<a href="http://opennebula.io" target="_blank">OpenNebula <%= OpenNebula::VERSION %></a>|g' ../views/index.erb
fi
install_patch

View File

@ -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 @@
</div>
<div id="footer" class="text-center large-12 columns">
<a href="http://opennebula.io" target="_blank">OpenNebula <%= OpenNebula::VERSION %></a>
+ <div id="enterprise_edition"><a href="http://opennebula.io/enterprise" target="_blank">Enterprise Edition</a></div>
<div id="latest_version" style="display:none;"></div>
</div>
</div>