From bc4fc09a898265e15f7f3d79c15d413df820544a Mon Sep 17 00:00:00 2001
From: Pierre Guilleminot <pierre.guilleminot@gmail.com>
Date: Thu, 24 Nov 2016 12:18:00 +0100
Subject: [PATCH] Move scripts in scripts/

---
 {devtool => scripts}/Dockerfile    |  4 +++
 build.sh => scripts/build.sh       |  4 +--
 coverage.sh => scripts/coverage.sh |  0
 {devtool => scripts}/dev.sh        | 54 +++++++++++++++---------------
 4 files changed, 33 insertions(+), 29 deletions(-)
 rename {devtool => scripts}/Dockerfile (90%)
 rename build.sh => scripts/build.sh (99%)
 rename coverage.sh => scripts/coverage.sh (100%)
 rename {devtool => scripts}/dev.sh (80%)

diff --git a/devtool/Dockerfile b/scripts/Dockerfile
similarity index 90%
rename from devtool/Dockerfile
rename to scripts/Dockerfile
index b6c3cbc8a..0bba79d3a 100644
--- a/devtool/Dockerfile
+++ b/scripts/Dockerfile
@@ -1,3 +1,7 @@
+# This Dockerfile should be used to create an development environment to
+# develop applications for cozy-stack. It installs go and couchdb 2.
+# It should not be used for hosting your cozy cloud in production.
+
 FROM debian:jessie
 
 ENV COUCHDB_VERSION 2.0.0
diff --git a/build.sh b/scripts/build.sh
similarity index 99%
rename from build.sh
rename to scripts/build.sh
index cb83e23c7..2ea4f1941 100755
--- a/build.sh
+++ b/scripts/build.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 set -e
 
 COZY_ENV_DFL=production
@@ -7,7 +7,7 @@ COZY_ENV_DFL=production
 [ -z ${COZY_DEPLOY_USER} ] && COZY_DEPLOY_USER=${USER}
 
 pushd `dirname $0` > /dev/null
-WORK_DIR=`pwd`
+WORK_DIR=$(dirname "`pwd`")
 popd > /dev/null
 
 if [ -r ${WORK_DIR}/local.env ]; then
diff --git a/coverage.sh b/scripts/coverage.sh
similarity index 100%
rename from coverage.sh
rename to scripts/coverage.sh
diff --git a/devtool/dev.sh b/scripts/dev.sh
similarity index 80%
rename from devtool/dev.sh
rename to scripts/dev.sh
index baf40c340..f2dd19c5d 100755
--- a/devtool/dev.sh
+++ b/scripts/dev.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env bash
 
 [ -z ${COZY_DEV_HOST} ] && COZY_DEV_HOST="cozy.local"
 [ -z ${COZY_DEV_PORT} ] && COZY_DEV_PORT="8080"
@@ -14,31 +14,31 @@ if [ -d ${COZY_STACK_PATH} ] && [ -f ${COZY_STACK_PATH}/cozy-stack ]; then
 fi
 
 usage() {
-	echo "Usage: ${0} [-h] [-d <app path>] [–v <stack version>]"
-
-	echo "\nEnvironment variables"
-	echo "\n  COZY_DEV_HOST"
-	echo "    specify the hostname or domain on which the dev server is listening"
-	echo "    to incoming requests. default: dev.cozycloud.cc"
-	echo "\n  COZY_DEV_PORT"
-	echo "    specify the port on which the dev server is listening."
-	echo "    default: 8080."
-	echo "\n  COZY_STACK_PATH"
-	echo "    specify the path of the cozy-stack binary folder or the binary"
-	echo "    itself. default: \"\$GOPATH/bin\"."
-	echo "\n  COZY_STACK_HOST"
-	echo "    specify the hostname on which the cozy-stack is launched."
-	echo "    default: localhost."
-	echo "\n  COZY_STACK_PORT"
-	echo "    specify the port on which the cozy-stack is listening."
-	echo "    default: 8080."
-	echo "\n  COUCHDB_ENABLE"
-	echo "    specify whether or not this script should launch couchdb."
-	echo "    default: 1"
-	echo "\n  COUCHDB_HOST"
-	echo "    specify the host of the couchdb database. default: localhost"
-	echo "\n  COUCHDB_PORT"
-	echo "    specify the port of the couchdb database. default: 5984"
+	echo -e "Usage: ${0} [-h] [-d <app path>] [–v <stack version>]"
+
+	echo -e "\nEnvironment variables"
+	echo -e "\n  COZY_DEV_HOST"
+	echo -e "    specify the hostname or domain on which the dev server is listening"
+	echo -e "    to incoming requests. default: dev.cozycloud.cc"
+	echo -e "\n  COZY_DEV_PORT"
+	echo -e "    specify the port on which the dev server is listening."
+	echo -e "    default: 8080."
+	echo -e "\n  COZY_STACK_PATH"
+	echo -e "    specify the path of the cozy-stack binary folder or the binary"
+	echo -e "    itself. default: \"\$GOPATH/bin\"."
+	echo -e "\n  COZY_STACK_HOST"
+	echo -e "    specify the hostname on which the cozy-stack is launched."
+	echo -e "    default: localhost."
+	echo -e "\n  COZY_STACK_PORT"
+	echo -e "    specify the port on which the cozy-stack is listening."
+	echo -e "    default: 8080."
+	echo -e "\n  COUCHDB_ENABLE"
+	echo -e "    specify whether or not this script should launch couchdb."
+	echo -e "    default: 1"
+	echo -e "\n  COUCHDB_HOST"
+	echo -e "    specify the host of the couchdb database. default: localhost"
+	echo -e "\n  COUCHDB_PORT"
+	echo -e "    specify the port of the couchdb database. default: 5984"
 }
 
 if [ -n "${COZY_STACK_PATH}" ] && [ ! -f "${COZY_STACK_PATH}" ]; then
@@ -214,7 +214,7 @@ check_hosts() {
 }
 
 echo_err() {
-	>&2 echo "error: ${1}"
+	>&2 echo -e "error: ${1}"
 }
 
 while getopts ":hd:v:" optname; do
-- 
GitLab