From 565792515d203982a8b582014c184f7062fdb5d4 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Fri, 22 Jan 2016 20:13:57 +0100 Subject: [PATCH 1/5] [mod] remove trailing spaces --- ynh-dev | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/ynh-dev b/ynh-dev index 95c0994..717947d 100755 --- a/ynh-dev +++ b/ynh-dev @@ -11,7 +11,7 @@ Usage : Run a docker or virtualbox vm `basename $0` kill VM Kill the last docker or all vagrant - + Inside the vm `basename $0` ip Give the ip of the guest container @@ -21,17 +21,17 @@ Usage : Deploy sources to test it `basename $0` watch [PAQUET [PAQUET ...]] Deploy sources each time there is change - + PAQUET : moulinette ssowat yunohost yunohost-admin - + VM docker virtualbox - + VERSION stable8 testing8 @@ -59,7 +59,7 @@ BASE_DIR=/yunohost if [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ "$1" = "help" ]; then usage - + elif [ "$1" = "create-env" ]; then #Create a development environment pwd=`pwd` @@ -73,14 +73,14 @@ elif [ "$1" = "create-env" ]; then git clone https://github.com/YunoHost/Dockerfile Dockerfile git clone https://github.com/zamentur/yunohost-vagrant yunohost-vagrant cp $pwd/$0 ./$0 - ln -s yunohost-vagrant/Vagrantfile Vagrantfile - + ln -s yunohost-vagrant/Vagrantfile Vagrantfile + elif [ "$1" = "run" ]; then #Run a vm and give a prompt DOMAIN=$2 VM=$3 VERSION=$4 - + if [ "$VM" = "docker" ]; then docker exec -t -i $(sudo docker run -h yunohost.$DOMAIN -v $(pwd):/yunohost -d zamentur/yunohost-$VERSION /sbin/init) /bin/bash elif [ "$VM" = "virtualbox" ] || [ "$VM" = "vagrant" ]; then @@ -90,7 +90,7 @@ elif [ "$1" = "run" ]; then echo "This kind of VM is not supported" exit 100; fi - + elif [ "$1" = "kill" ]; then VM=$2 if [ "$VM" = "docker" ]; then @@ -100,17 +100,17 @@ elif [ "$1" = "kill" ]; then else echo "This kind of VM is not supported" exit 100; - fi + fi elif [ "$1" = "upgrade" ]; then check_yunohost_vm sudo apt-get update sudo apt-get -y upgrade - sudo apt-get -y dist-upgrade + sudo apt-get -y dist-upgrade sudo apt-get install -y inotify-tools net-tools elif [ "$1" = "ip" ]; then check_yunohost_vm sudo apt-get install -y net-tools - /sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}' + /sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}' elif [ "$1" = "deploy" ]; then check_yunohost_vm for i in ${!paquets[@]}; do @@ -146,8 +146,8 @@ elif [ "$1" = "deploy" ]; then elif [ "$1" = "watch" ]; then check_yunohost_vm sudo apt-get install -y inotify-tools - while inotifywait -r -e close_write $BASE_DIR/moulinette/ $BASE_DIR/SSOwat/ $BASE_DIR/yunohost/ $BASE_DIR/yunohost-admin/; do - $BASE_DIR/$0 deploy ${@:2}; + while inotifywait -r -e close_write $BASE_DIR/moulinette/ $BASE_DIR/SSOwat/ $BASE_DIR/yunohost/ $BASE_DIR/yunohost-admin/; do + $BASE_DIR/$0 deploy ${@:2}; done else usage From 41f0b8ba088f20ca42baece8269cfa7e32c5f341 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Fri, 22 Jan 2016 20:14:35 +0100 Subject: [PATCH 2/5] [mod] create target folder if it doesn't exist --- ynh-dev | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ynh-dev b/ynh-dev index 717947d..37da0d1 100755 --- a/ynh-dev +++ b/ynh-dev @@ -63,7 +63,10 @@ if [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ "$1" = "help" ]; then elif [ "$1" = "create-env" ]; then #Create a development environment pwd=`pwd` + + [ -e "$2" ] || mkdir -p $2 cd $2 + mkdir -p apps mkdir -p backup git clone -b unstable https://github.com/Kloadut/SSOwat SSOwat From 832954fd2233e26448f1c20e0ee2eb47f73fcc2e Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Fri, 22 Jan 2016 20:17:02 +0100 Subject: [PATCH 3/5] [mod] set -x --- ynh-dev | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ynh-dev b/ynh-dev index 37da0d1..13f9f80 100755 --- a/ynh-dev +++ b/ynh-dev @@ -61,6 +61,8 @@ if [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ "$1" = "help" ]; then usage elif [ "$1" = "create-env" ]; then + set -x + #Create a development environment pwd=`pwd` From bc8d0c668094540236ec51a8361e82b4f1b8e695 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Fri, 22 Jan 2016 20:17:31 +0100 Subject: [PATCH 4/5] [mod] check that a path is passed to create-env --- ynh-dev | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ynh-dev b/ynh-dev index 13f9f80..383bc68 100755 --- a/ynh-dev +++ b/ynh-dev @@ -66,6 +66,12 @@ elif [ "$1" = "create-env" ]; then #Create a development environment pwd=`pwd` + if [ ! "$2" ] + then + echo "I need a destination folder to create the dev environement" + exit 1 + fi + [ -e "$2" ] || mkdir -p $2 cd $2 From 6b1e0d54a378e45d453aa4e51c1918f6eddc26ce Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Fri, 22 Jan 2016 22:04:57 +0100 Subject: [PATCH 5/5] [fix] prune moulinette cache when deploying --- ynh-dev | 1 + 1 file changed, 1 insertion(+) diff --git a/ynh-dev b/ynh-dev index 383bc68..e2bd3ff 100755 --- a/ynh-dev +++ b/ynh-dev @@ -131,6 +131,7 @@ elif [ "$1" = "deploy" ]; then cd $BASE_DIR/moulinette ./setup.py install cd .. + [-e "./cache/moulinette/actionsmap/yunohost.pkl"] && rm /var/cache/moulinette/actionsmap/yunohost.pkl echo "moulinette deployed" ;; ssowat)