From 3f16b9b3de9d78c7e8676f9c6894cc007bac5706 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 13 Apr 2018 15:24:07 +0100 Subject: [PATCH] Use new global modules directory for scuttlebot --- src/freedombone-app-scuttlebot | 20 ++++++++++---------- src/freedombone-base-tripwire | 3 +++ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/freedombone-app-scuttlebot b/src/freedombone-app-scuttlebot index e820b842..56fc14dd 100755 --- a/src/freedombone-app-scuttlebot +++ b/src/freedombone-app-scuttlebot @@ -259,14 +259,14 @@ function git_ssb_script { function scuttlebot_git_setup { if [[ "$1" == "mesh" ]]; then - if [ ! -d "$rootdir/usr/local/lib/node_modules/git-ssb/node_modules/git-ssb-web/highlight" ]; then - mkdir "$rootdir/usr/local/lib/node_modules/git-ssb/node_modules/git-ssb-web/highlight" + if [ ! -d "$rootdir/root/.npm-global/node_modules/git-ssb/node_modules/git-ssb-web/highlight" ]; then + mkdir "$rootdir/root/.npm-global/node_modules/git-ssb/node_modules/git-ssb-web/highlight" fi - if [ ! -f "$rootdir/usr/local/lib/node_modules/git-ssb/node_modules/highlight.js/styles/foundation.css" ]; then + if [ ! -f "$rootdir/root/.npm-global/node_modules/git-ssb/node_modules/highlight.js/styles/foundation.css" ]; then echo $'Could not find foundation.css' exit 347687245 fi - cp "$rootdir/usr/local/lib/node_modules/git-ssb/node_modules/highlight.js/styles/foundation.css" "$rootdir/usr/local/lib/node_modules/git-ssb/node_modules/git-ssb-web/highlight/foundation.css" + cp "$rootdir/root/.npm-global/node_modules/git-ssb/node_modules/highlight.js/styles/foundation.css" "$rootdir/root/.npm-global/node_modules/git-ssb/node_modules/git-ssb-web/highlight/foundation.css" git_ssb_nginx_site=$rootdir/etc/nginx/sites-available/git_ssb { echo 'server {'; @@ -284,14 +284,14 @@ function scuttlebot_git_setup { exit 7357225 fi - if [ ! -d /usr/local/lib/node_modules/git-ssb/node_modules/git-ssb-web/highlight ]; then - mkdir /usr/local/lib/node_modules/git-ssb/node_modules/git-ssb-web/highlight + if [ ! -d /root/.npm-global/node_modules/git-ssb/node_modules/git-ssb-web/highlight ]; then + mkdir /root/.npm-global/node_modules/git-ssb/node_modules/git-ssb-web/highlight fi - if [ ! -f /usr/local/lib/node_modules/git-ssb/node_modules/highlight.js/styles/foundation.css ]; then + if [ ! -f /root/.npm-global/node_modules/git-ssb/node_modules/highlight.js/styles/foundation.css ]; then echo $'Could not find foundation.css' exit 347687245 fi - cp /usr/local/lib/node_modules/git-ssb/node_modules/highlight.js/styles/foundation.css /usr/local/lib/node_modules/git-ssb/node_modules/git-ssb-web/highlight/foundation.css + cp /root/.npm-global/node_modules/git-ssb/node_modules/highlight.js/styles/foundation.css /root/.npm-global/node_modules/git-ssb/node_modules/git-ssb-web/highlight/foundation.css git_ssb_nginx_site=/etc/nginx/sites-available/${SCUTTLEBOT_DOMAIN_NAME} function_check nginx_http_redirect @@ -313,7 +313,7 @@ function scuttlebot_git_setup { fi { echo ''; - echo ' root /usr/local/lib/node_modules/git-ssb/node_modules/git-ssb-web;'; + echo ' root /root/.npm-global/node_modules/git-ssb/node_modules/git-ssb-web;'; echo ''; echo ' location = / {'; echo " proxy_pass http://localhost:${GIT_SSB_PORT};"; @@ -339,7 +339,7 @@ function scuttlebot_git_setup { echo ' add_header X-Content-Type-Options nosniff;'; echo ' add_header X-Frame-Options SAMEORIGIN;'; echo ''; - echo ' root /usr/local/lib/node_modules/git-ssb/node_modules/git-ssb-web;'; + echo ' root /root/.npm-global/node_modules/git-ssb/node_modules/git-ssb-web;'; echo ''; echo ' location = / {'; echo " proxy_pass http://localhost:${GIT_SSB_PORT};"; diff --git a/src/freedombone-base-tripwire b/src/freedombone-base-tripwire index 67baa7fa..ea059d1a 100755 --- a/src/freedombone-base-tripwire +++ b/src/freedombone-base-tripwire @@ -122,6 +122,9 @@ function install_tripwire { if ! grep -q '!/usr/local/lib/node_modules' /etc/tripwire/twpol.txt; then sed -i '\|/etc\t\t->.*|a\ !/usr/local/lib/node_modules ;' /etc/tripwire/twpol.txt fi + if ! grep -q '!/root/.npm-global/node_modules' /etc/tripwire/twpol.txt; then + sed -i '\|/etc\t\t->.*|a\ !/root/.npm-global/node_modules ;' /etc/tripwire/twpol.txt + fi # Events here are likely due to USB HRNG activity if ! grep -q '!/dev/char' /etc/tripwire/twpol.txt; then sed -i '\|/dev\t\t->.*|a\ !/dev/char ;' /etc/tripwire/twpol.txt