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"
VM_LOCATION="/var/lib/one/vms"
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"
if [ "$CLIENT" = "yes" ]; then
@ -134,7 +135,7 @@ if [ -z "$ROOT" ] ; then
CHOWN_DIRS=""
elif [ "$SUNSTONE" = "yes" ]; then
MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $VAR_LOCATION \
$SUNSTONE_LOCATION $ETC_LOCATION"
$SUNSTONE_LOCATION $ETC_LOCATION $MAIN_JS_LOCATION"
DELETE_DIRS="$MAKE_DIRS"
@ -161,7 +162,7 @@ if [ -z "$ROOT" ] ; then
$INCLUDE_LOCATION $SHARE_LOCATION $DOCS_LOCATION \
$LOG_LOCATION $RUN_LOCATION $LOCK_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 \
$RUN_LOCATION $SHARE_DIRS"
@ -184,6 +185,7 @@ else
MAN_LOCATION="$ROOT/share/man/man1"
VM_LOCATION="$VAR_LOCATION/vms"
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"
if [ "$CLIENT" = "yes" ]; then
@ -197,7 +199,7 @@ else
DELETE_DIRS="$MAKE_DIRS"
elif [ "$SUNSTONE" = "yes" ]; then
MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $VAR_LOCATION \
$SUNSTONE_LOCATION $ETC_LOCATION"
$SUNSTONE_LOCATION $ETC_LOCATION $MAIN_JS_LOCATION"
DELETE_DIRS="$MAKE_DIRS"
elif [ "$ONEFLOW" = "yes" ]; then
@ -212,7 +214,7 @@ else
MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $ETC_LOCATION $VAR_LOCATION \
$INCLUDE_LOCATION $SHARE_LOCATION $SYSTEM_DS_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"
@ -2042,14 +2044,14 @@ if [ "$INSTALL_ETC" = "yes" ] ; then
done
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 ---
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
chown -R $ONEADMIN_USER:$ONEADMIN_GROUP $DESTDIR$d
done

View File

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

View File

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