1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-23 17:33:56 +03:00

F #1692: Solved bug w/ symbolic links

This commit is contained in:
Abel Coronado 2018-05-08 15:10:03 +02:00 committed by Ruben S. Montero
parent b9fd1feb2d
commit dc50763f46
3 changed files with 30 additions and 32 deletions

View File

@ -124,6 +124,7 @@ if [ -z "$ROOT" ] ; then
MAN_LOCATION="/usr/share/man/man1" MAN_LOCATION="/usr/share/man/man1"
VM_LOCATION="/var/lib/one/vms" VM_LOCATION="/var/lib/one/vms"
DOCS_LOCATION="/usr/share/docs/one" DOCS_LOCATION="/usr/share/docs/one"
MAIN_JS_LOCATION="$VAR_LOCATION/sunstone"
DOCKER_MACHINE_LOCATION="src/docker_machine/src/docker_machine/bin/docker-machine-driver-opennebula" DOCKER_MACHINE_LOCATION="src/docker_machine/src/docker_machine/bin/docker-machine-driver-opennebula"
if [ "$CLIENT" = "yes" ]; then if [ "$CLIENT" = "yes" ]; then
@ -134,7 +135,7 @@ if [ -z "$ROOT" ] ; then
CHOWN_DIRS="" CHOWN_DIRS=""
elif [ "$SUNSTONE" = "yes" ]; then elif [ "$SUNSTONE" = "yes" ]; then
MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $VAR_LOCATION \ MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $VAR_LOCATION \
$SUNSTONE_LOCATION $ETC_LOCATION" $SUNSTONE_LOCATION $ETC_LOCATION $MAIN_JS_LOCATION"
DELETE_DIRS="$MAKE_DIRS" DELETE_DIRS="$MAKE_DIRS"
@ -161,7 +162,7 @@ if [ -z "$ROOT" ] ; then
$INCLUDE_LOCATION $SHARE_LOCATION $DOCS_LOCATION \ $INCLUDE_LOCATION $SHARE_LOCATION $DOCS_LOCATION \
$LOG_LOCATION $RUN_LOCATION $LOCK_LOCATION \ $LOG_LOCATION $RUN_LOCATION $LOCK_LOCATION \
$SYSTEM_DS_LOCATION $DEFAULT_DS_LOCATION $MAN_LOCATION \ $SYSTEM_DS_LOCATION $DEFAULT_DS_LOCATION $MAN_LOCATION \
$VM_LOCATION $ONEGATE_LOCATION $ONEFLOW_LOCATION" $VM_LOCATION $ONEGATE_LOCATION $ONEFLOW_LOCATION $MAIN_JS_LOCATION"
DELETE_DIRS="$LIB_LOCATION $ETC_LOCATION $LOG_LOCATION $VAR_LOCATION \ DELETE_DIRS="$LIB_LOCATION $ETC_LOCATION $LOG_LOCATION $VAR_LOCATION \
$RUN_LOCATION $SHARE_DIRS" $RUN_LOCATION $SHARE_DIRS"
@ -184,6 +185,7 @@ else
MAN_LOCATION="$ROOT/share/man/man1" MAN_LOCATION="$ROOT/share/man/man1"
VM_LOCATION="$VAR_LOCATION/vms" VM_LOCATION="$VAR_LOCATION/vms"
DOCS_LOCATION="$ROOT/share/docs" DOCS_LOCATION="$ROOT/share/docs"
MAIN_JS_LOCATION="$VAR_LOCATION/sunstone"
DOCKER_MACHINE_LOCATION="src/docker_machine/src/docker_machine/bin/docker-machine-driver-opennebula" DOCKER_MACHINE_LOCATION="src/docker_machine/src/docker_machine/bin/docker-machine-driver-opennebula"
if [ "$CLIENT" = "yes" ]; then if [ "$CLIENT" = "yes" ]; then
@ -197,7 +199,7 @@ else
DELETE_DIRS="$MAKE_DIRS" DELETE_DIRS="$MAKE_DIRS"
elif [ "$SUNSTONE" = "yes" ]; then elif [ "$SUNSTONE" = "yes" ]; then
MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $VAR_LOCATION \ MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $VAR_LOCATION \
$SUNSTONE_LOCATION $ETC_LOCATION" $SUNSTONE_LOCATION $ETC_LOCATION $MAIN_JS_LOCATION"
DELETE_DIRS="$MAKE_DIRS" DELETE_DIRS="$MAKE_DIRS"
elif [ "$ONEFLOW" = "yes" ]; then elif [ "$ONEFLOW" = "yes" ]; then
@ -212,7 +214,7 @@ else
MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $ETC_LOCATION $VAR_LOCATION \ MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $ETC_LOCATION $VAR_LOCATION \
$INCLUDE_LOCATION $SHARE_LOCATION $SYSTEM_DS_LOCATION \ $INCLUDE_LOCATION $SHARE_LOCATION $SYSTEM_DS_LOCATION \
$DEFAULT_DS_LOCATION $MAN_LOCATION $DOCS_LOCATION \ $DEFAULT_DS_LOCATION $MAN_LOCATION $DOCS_LOCATION \
$VM_LOCATION $ONEGATE_LOCATION $ONEFLOW_LOCATION" $VM_LOCATION $ONEGATE_LOCATION $ONEFLOW_LOCATION $MAIN_JS_LOCATION"
DELETE_DIRS="$MAKE_DIRS" DELETE_DIRS="$MAKE_DIRS"
@ -2042,14 +2044,14 @@ if [ "$INSTALL_ETC" = "yes" ] ; then
done done
fi fi
if [ "$SUNSTONE" = "yes" ] || [ "$SUNSTONE_DEV" = "yes" ] ; then
mkdir $VAR_LOCATION/sunstone && touch $VAR_LOCATION/sunstone/main.js
ln -s $VAR_LOCATION/sunstone/main.js $SUNSTONE_LOCATION/public/dist/main.js
fi
# --- Set ownership or remove OpenNebula directories --- # --- Set ownership or remove OpenNebula directories ---
if [ "$UNINSTALL" = "no" ] ; then if [ "$UNINSTALL" = "no" ] ; then
if [ "$SUNSTONE" = "yes" ] || [ "$SUNSTONE_DEV" = "yes" ] ; then
touch $VAR_LOCATION/sunstone/main.js
rm $SUNSTONE_LOCATION/public/dist/main.js
ln -s $VAR_LOCATION/sunstone/main.js $SUNSTONE_LOCATION/public/dist/main.js
fi
for d in $CHOWN_DIRS; do for d in $CHOWN_DIRS; do
chown -R $ONEADMIN_USER:$ONEADMIN_GROUP $DESTDIR$d chown -R $ONEADMIN_USER:$ONEADMIN_GROUP $DESTDIR$d
done done

View File

@ -17,27 +17,21 @@
require 'rubygems' require 'rubygems'
require 'json' require 'json'
ADDONS_LOCATION = SUNSTONE_LOCATION + "/public/app/addons/dist/*" ADDONS_LOCATION = SUNSTONE_LOCATION + "/public/app/addons/dist"
MAIN_DIST_PATH = SUNSTONE_LOCATION + "/public/dist/main-dist.js" MAIN_DIST_PATH = SUNSTONE_LOCATION + "/public/dist/main-dist.js"
MAIN_PATH = VAR_LOCATION + "/sunstone/main.js" MAIN_PATH = VAR_LOCATION + "/sunstone/main.js"
class OpenNebulaAddons class OpenNebulaAddons
def initialize(logger) def initialize(logger)
@logger = logger @logger = logger
@main_folder = File.join(VAR_LOCATION, "sunstone")
begin main = File.new(MAIN_PATH, "w")
Dir.mkdir(@main_folder) main_dist = File.new(MAIN_DIST_PATH, "r")
rescue Exception => e
@logger.error "Cannot create sunstone folder"
@logger.error e.message
end
main = File.open(MAIN_PATH, "w") files = Dir["#{ADDONS_LOCATION}/*"].select{ |f| File.file? f }
main_dist = File.new(MAIN_DIST_PATH)
files = Dir[ADDONS_LOCATION].select{ |f| File.file? f }
lines = main_dist.gets lines = main_dist.gets
while lines != nil while lines != nil
main << lines main << lines
@ -57,22 +51,21 @@ class OpenNebulaAddons
def load_start_section(files, tmp) def load_start_section(files, tmp)
files.each do |file| files.each do |file|
add = File.new(file) add = File.new(file, "r")
boolist = false
add.each do |line| add.each do |line|
if line.include? "// list-start //" tmp << line if !line.include? "// list-start //"
boolist = true
end
tmp << line if !boolist
end end
add.close add.close
end end
end end
def load_list_start(files, tmp) def load_list_start(files, tmp)
files.each do |file| files.each do |file|
add = File.new(file) add = File.new(file, "r")
line = add.gets line = add.gets
while line != nil while line != nil
if line.include? "// list-start //" if line.include? "// list-start //"
line = add.gets line = add.gets
@ -83,6 +76,7 @@ class OpenNebulaAddons
end end
line = add.gets line = add.gets
end end
add.close add.close
end end
end end

View File

@ -20,8 +20,9 @@ import os
Import('env') Import('env')
if env['sunstone']=='yes': if env['sunstone']=='yes':
os.system("rm dist/main.js") os.system("mv dist/main.js ../")
print "Generating Sunstone minified files\n" print "Generating Sunstone minified files\n"
exit_code=os.system("grunt --gruntfile ./Gruntfile.js sass") exit_code=os.system("grunt --gruntfile ./Gruntfile.js sass")
if exit_code != 0: if exit_code != 0:
@ -32,4 +33,5 @@ if env['sunstone']=='yes':
if exit_code != 0: if exit_code != 0:
print "Error generating minifying Sunstone files\n" print "Error generating minifying Sunstone files\n"
exit(-1) exit(-1)
os.system("mv dist/main.js dist/main-dist.js") os.system("mv dist/main.js dist/main-dist.js && mv dist/main.js.map dist/main-dist.js.map")
os.system("mv -f ../main.js dist/main.js")