From 698c291790aceb906d6aeb2e5bde56f25a3a41f1 Mon Sep 17 00:00:00 2001 From: Julien Malik Date: Wed, 19 Mar 2014 22:38:17 +0100 Subject: [PATCH] clean up nodejs-npm junk --- scripts/install | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/scripts/install b/scripts/install index 5ae8e0f..87ee380 100644 --- a/scripts/install +++ b/scripts/install @@ -11,29 +11,32 @@ if [[ ! $? -eq 0 ]]; then exit 1 fi -echo "Install dependencies" +echo "Install dependencies..." sudo apt-get install nodejs-legacy npm -y -echo "Download sources..." version=0.4.1 echo "Downloading Ghost $version..." mkdir ../tmp sudo wget -O ../tmp/ghost-$version.zip "https://en.ghost.org/zip/ghost-$version.zip" -unzip ../tmp/ghost-$version.zip -d ../tmp/ghost echo "Deploying source files..." +unzip ../tmp/ghost-$version.zip -d ../tmp/ghost final_path=/var/www/ghostblog sudo mkdir -p $final_path sudo useradd -d $final_path ghostblog - sudo cp -r ../tmp/ghost $final_path sudo chown -R ghostblog: $final_path echo "Install Ghost with NPM..." sudo su --shell /bin/bash --command "cd $final_path/ghost && npm install --production" ghostblog -sudo rm -rf $final_path/tmp -echo "Deploying configuration" +echo "Cleaning up install tree..." +sudo rm -rf $final_path/.npm +find $final_path -type d | grep test$ | xargs sudo rm -rf +find $final_path -type d | grep tests$ | xargs sudo rm -rf +sudo rm -rf $final_path/ghost/node_modules/sqlite3/build + +echo "Deploying configuration..." sed -i "s@YNH_DOMAIN@$domain@g" ../conf/config.js sed -i "s@YNH_LOCATION@$path@g" ../conf/config.js sed -i "s@YNH_MAIL@@g" ../conf/config.js @@ -44,6 +47,10 @@ sudo chmod 644 $final_path/ghost/config.js echo "Nginx configuration..." sed -i "s@YNH_LOCATION@$path@g" ../conf/nginx.conf sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/ghostblog.conf +if [ $is_public = "Yes" ]; then + sudo yunohost app setting ghostblog unprotected_uris -v "/" +fi +sudo yunohost app setting ghostblog is_public -v $is_public echo "Init script..." logfile=/var/log/ghostblog.log @@ -58,11 +65,6 @@ sudo service ynh-app-ghostblog start sudo yunohost app service ynh-app-ghostblog -l $logfile echo "Reloading Nginx..." -if [ $is_public = "Yes" ]; -then - sudo yunohost app setting ghostblog unprotected_uris -v "/" -fi -sudo yunohost app setting ghostblog is_public -v $is_public sudo service nginx reload sudo yunohost app ssowatconf