From 4056393d58d2d91cfd8d24d77c1812e1fdd04cb3 Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Fri, 14 Aug 2015 21:11:07 +0300 Subject: rz-mux: use rhizi-custom rhizi-mux package: add templates (TODO: should be in the common part) --- res/debian/pkg__rhizi-mux/install | 1 + src/local/rz-mux/rz-mux-tool.sh | 23 ++++++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/res/debian/pkg__rhizi-mux/install b/res/debian/pkg__rhizi-mux/install index e7bedf18..ae3933ec 100644 --- a/res/debian/pkg__rhizi-mux/install +++ b/res/debian/pkg__rhizi-mux/install @@ -3,6 +3,7 @@ res/neo4j/reset-db__clean.cypher usr/lib/rhizi/tools/neo4j res/rz-mux/* usr/share/rhizi/rz-mux/ src/client/* usr/lib/rhizi/webapp/static/js +res/local/template.d/* usr/share/rhizi/webapp/domain-fragment.d/default src/server/* usr/lib/rhizi/rhizi-server/ src/local/server-tools/* usr/lib/rhizi/tools/server-tools src/local/rz-mux/* usr/lib/rhizi/tools/rz-mux diff --git a/src/local/rz-mux/rz-mux-tool.sh b/src/local/rz-mux/rz-mux-tool.sh index 6c52b720..021f7076 100755 --- a/src/local/rz-mux/rz-mux-tool.sh +++ b/src/local/rz-mux/rz-mux-tool.sh @@ -108,7 +108,10 @@ install_instance__apache() { ln -vfs -T /etc/rhizi/mux-conf.d/${RZI_NAME} ${apache_module__rootdir}/webapp/etc ln -vfs -T /usr/lib/rhizi/webapp/static/js ${apache_module__rootdir}/webapp/static/js - ln -vfs -T /usr/share/rhizi/webapp/static/css ${apache_module__rootdir}/webapp/static/css + + ln -vfs -T ${rhizi_custom__instance}/js/domain_types.js ${apache_module__rootdir}/webapp/fragment.d/js/domain_types.js + ln -vfs -T ${rhizi_custom__instance}/css ${apache_module__rootdir}/webapp/static/css + ln -vfs -T /usr/share/rhizi/webapp/static/font ${apache_module__rootdir}/webapp/static/font ln -vfs -T /usr/share/rhizi/webapp/static/img ${apache_module__rootdir}/webapp/static/img ln -vfs -T /usr/share/rhizi/webapp/static/lib ${apache_module__rootdir}/webapp/static/lib @@ -117,6 +120,12 @@ install_instance__apache() { ln -vfs -T /etc/apache2/sites-available/${apache_module__siteconf_filename} /etc/apache2/sites-enabled/${apache_module__siteconf_filename} } +install_instance__apache__custom() { + if [ -e ${rhizi_custom__fragment} ]; then + cp -vr ${rhizi_custom__fragment}/* ${apache_module__rootdir}/webapp/fragment.d/template.d/ + fi +} + install_instance__rhizi() { # depends on install_instance__apache() [[ -e "${rz_module__confdir}" ]] && die "error: rhizi module already installed: ${rz_module__confdir}" @@ -125,7 +134,7 @@ install_instance__rhizi() { # depends on install_instance__apache() --directory ${rz_module__bkp} # install default fragments - JS - cp -vr /usr/share/rhizi/webapp/domain-fragment.d/default/* ${apache_module__rootdir}/webapp/fragment.d/ + cp -vr /usr/share/rhizi/webapp/domain-fragment.d/default/* ${apache_module__rootdir}/webapp/fragment.d/template.d/ } @@ -164,6 +173,10 @@ RZI_RZ_PID_FILE=/var/run/rhizi/${RZI_NAME}.pid RZI_RZ_INIT_SCRIPT_PATH=/etc/init.d/rhizi__${RZI_NAME} RZI_RZ_CRON_SCRIPT_PATH=/etc/cron.daily/rhizi__${RZI_NAME} +rhizi_custom__rootdir=$3 +rhizi_custom__instance=${rhizi_custom__rootdir}/domain-fragment.d/${RZI_NAME} +rhizi_custom__fragment=${rhizi_custom__rootdir}/fragment/by-domain/${RZI_NAME} + # # sanity checks # @@ -171,6 +184,9 @@ RZI_RZ_CRON_SCRIPT_PATH=/etc/cron.daily/rhizi__${RZI_NAME} [ -z ${RZI_NAME} ] && die 'error: RZI_NAME arg missing, aborting' [ -e ${RZI_NEO4J_PID_FILE} ] && die "error: ${RZI_NEO4J_SVC_NAME} server seems to be running, please stop it before continuing" [ -e ${RZI_RZ_PID_FILE} ] && die "error: ${RZI_RZ_PID_FILE} server seems to be running, please stop it before continuing" +[ ! -e ${rhizi_custom__rootdir}/domain-fragment.d ] && die 'error: 3rd argument must point to rhizi-custom git checkout' +[ ! -e ${rhizi_custom__instance} ] && die 'error: no such instance in rhizi-custom (${RZI_NAME} in ${rhizi_custom__rootdir}}' +[ -e /usr/lib/rhizi/webapp/static/js/domain_types.js ] && die 'unexpected domain_types.js in rhizi install' set_path_vars @@ -182,10 +198,11 @@ case $1 in install_instance__apache install_instance__neo4j install_instance__rhizi + install_instance__apache__custom # pass-on extra argument to python: install dom-x ...: # - opt: --rz_config__disable_access_control - if [ $# -ge 3 ] ; then shift 2; py_extra_args=$@ ; fi + if [ $# -ge 4 ] ; then shift 3; py_extra_args=$@ ; fi python /usr/lib/rhizi/tools/rz-mux/rz-mux-tool.py \ --template-dir /usr/share/rhizi/rz-mux/ \ --domain ${RZI_NAME} ${py_extra_args} -- cgit v1.3.1