diff --git a/oneapps/postinstall.sh b/oneapps/postinstall.sh index 39807e6a13..a27d611d2b 100755 --- a/oneapps/postinstall.sh +++ b/oneapps/postinstall.sh @@ -1,27 +1,43 @@ #!/bin/bash -FLAVOR="#FLAVOR#" +if [ -n $1 ]; then + FLAVOR=$1 + ROOT=$2 +else + FLAVOR="#FLAVOR#" +fi case "$FLAVOR" in debian) - SUNSTONE_PLUGINS=/etc/one/sunstone-plugins.yaml + SUNSTONE_VIEWS_PATH=/etc/one/sunstone-views SUNSTONE_SERVER=/etc/one/sunstone-server.conf - OPENNEBULA_JS=/usr/share/opennebula/sunstone/public/js/opennebula.js - OPENNEBULA_JS_NEW=/usr/share/opennebula/oneapps/public/js/opennebula.js SUNSTONE_AUTH="/var/lib/one/.one/sunstone_auth" APPFLOW_AUTH="/var/lib/one/.one/appflow_auth" ;; -*) - SUNSTONE_PLUGINS=/etc/one/sunstone-plugins.yaml +systemwide) + SUNSTONE_VIEWS_PATH=/etc/one/sunstone-views SUNSTONE_SERVER=/etc/one/sunstone-server.conf - OPENNEBULA_JS=/usr/lib/one/sunstone/public/js/opennebula.js - OPENNEBULA_JS_NEW=/usr/share/one/oneapps/public/js/opennebula.js SUNSTONE_AUTH="/var/lib/one/.one/sunstone_auth" APPFLOW_AUTH="/var/lib/one/.one/appflow_auth" ;; + +selfcontained) + SUNSTONE_VIEWS_PATH=$ROOT/etc/sunstone-views + SUNSTONE_SERVER=$ROOT/etc/sunstone-server.conf + SUNSTONE_AUTH="$HOME/.one/sunstone_auth" + APPFLOW_AUTH="$HOME/.one/appflow_auth" + ;; + +*) + echo "Flavor not supported: systemwide, debian or selfcontained" 1>&2 + exit 255 + ;; + esac +VIEW_FILES="admin.yaml user.yaml" + function print_install_message() { cat <> $config_file } -function add_plugin() { - add_config "$1" "$2" "$SUNSTONE_PLUGINS" +function add_view() { + for f in $VIEW_FILES; do + add_config "$1" "$2" "$SUNSTONE_VIEWS_PATH/$f" + done } function add_server() { @@ -74,52 +92,68 @@ function add_server() { } -# Configure sunstone-plugins.yaml and sunstone-server.conf +# Configure sunstone-views.yaml and sunstone-server.conf -make_backup "$SUNSTONE_PLUGINS" +make_backup "$SUNSTONE_VIEWS" make_backup "$SUNSTONE_SERVER" -add_plugin "apptools.appstage-dashboard.js" \ -"- user-plugins/apptools.appstage-dashboard.js: - :user: - :group: - :ALL: true" +add_view "apptools-appflow-dashboard" \ +" apptools-appflow-dashboard: + panel_tabs: + table_columns: + actions:" -add_plugin "apptools.appstage.js" \ -"- user-plugins/apptools.appstage.js: - :user: - :group: - :ALL: true" +add_view "apptools-appflow-services" \ +" apptools-appflow-services: + panel_tabs: + service_info_tab: true + service_role_tab: true + service_vms_tab: true + service_log_tab: true + table_columns: + actions: + Service.refresh: true + Service.chown: true + Service.chgrp: true + Service.chmod: true + Service.shutdown: true + Service.delete: true" -add_plugin "apptools.appflow-dashboard.js" \ -"- user-plugins/apptools.appflow-dashboard.js: - :group: - :ALL: true - :user:" +add_view "apptools-appflow-templates" \ +" apptools-appflow-templates: + panel_tabs: + service_template_info_panel: true + table_columns: + actions: + ServiceTemplate.refresh: true + ServiceTemplate.create_dialog: true + ServiceTemplate.instantiate: true + ServiceTemplate.chown: true + ServiceTemplate.chgrp: true + ServiceTemplate.chmod: true + ServiceTemplate.delete: true" -add_plugin "apptools.appflow.templates.js" \ -"- user-plugins/apptools.appflow.templates.js: - :group: - :ALL: true - :user:" +add_view "apptools-appstage-dashboard" \ +" apptools-appstage-dashboard: + panel_tabs: + table_columns: + actions:" -add_plugin "apptools.appflow.services.js" \ -"- user-plugins/apptools.appflow.services.js: - :group: - :ALL: true - :user:" +add_view "apptools-appstage" \ +" apptools-appstage: + panel_tabs: + appstage_info_tab: true + appstage_node_tab: true + table_columns: + actions: + AppStage.refresh: true + AppStage.create_dialog: true + AppStage.update_dialog: true + AppStage.chown: true + AppStage.chgrp: true + AppStage.chmod: true + AppStage.delete: true" -add_plugin "apptools.appmarket-dashboard.js" \ -"- user-plugins/apptools.appmarket-dashboard.js: - :group: - :ALL: true - :user:" - -add_plugin "apptools.appmarket.appliances.js" \ -"- user-plugins/apptools.appmarket.appliances.js: - :group: - :ALL: true - :user:" add_server "^:routes:" ":routes:" @@ -128,11 +162,6 @@ add_server "- appflow" " - appflow" add_server "- appmarket" " - appmarket" -# Install new opennebula.js - -make_backup "$OPENNEBULA_JS" -cp "$OPENNEBULA_JS_NEW" "$OPENNEBULA_JS" - # Copy sunstone_auth to appflow_auth