From c28664ae40dbd3eb5ced3e8d6a4c42991938c290 Mon Sep 17 00:00:00 2001 From: Marc Aymerich Date: Sat, 3 Oct 2015 19:16:50 +0000 Subject: [PATCH] Fixes on deployment --- orchestra/bin/orchestra-admin | 12 ++++-------- orchestra/contrib/systemusers/backends.py | 4 ++-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/orchestra/bin/orchestra-admin b/orchestra/bin/orchestra-admin index a303943d..b480490e 100755 --- a/orchestra/bin/orchestra-admin +++ b/orchestra/bin/orchestra-admin @@ -60,10 +60,6 @@ check_root () { export -f check_root -verlt () { - [ "$1" = "$2" ] && return 1 || verlte $1 $2 -} - get_orchestra_dir () { if ! $(echo "import orchestra" | $PYTHON_BIN 2> /dev/null); then echo -e "\norchestra not installed.\n" >&2 @@ -139,6 +135,7 @@ function install_requirements () { git \ iceweasel \ dnsutils" + fi run apt-get update run apt-get install -y $APT @@ -174,13 +171,12 @@ function install_requirements () { # Install a more recent version of wkhtmltopdf (0.12.2) (PDF page number support) wkhtmltox_version=$(dpkg --list | grep wkhtmltox | awk {'print $3'}) - if [[ ! $wkhtmltox_version || verlt $wkhtmltox_version 0.12.2.1 ]]; then + minor=$(echo -e "$wkhtmltox_version\n0.12.2.1" | sort -V | head -n 1) + if [[ ! $wkhtmltox_version ]] || [[ $wkhtmltox_version != 0.12.2.1 && $minor == ${wkhtmltox_version} ]]; then wkhtmltox=$(mktemp) wget http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-jessie-amd64.deb -O ${wkhtmltox} dpkg -i ${wkhtmltox} || { echo "Installing missing dependencies for wkhtmltox..." && apt-get -f -y install; } fi - - } export -f install_requirements @@ -246,5 +242,5 @@ function startproject () { export -f startproject -[ $# -lt 1 ] && print_help +[ $# -lt 1 ] && { print_help; exit 1; } $1 "${@}" diff --git a/orchestra/contrib/systemusers/backends.py b/orchestra/contrib/systemusers/backends.py index ce510c98..d4052a38 100644 --- a/orchestra/contrib/systemusers/backends.py +++ b/orchestra/contrib/systemusers/backends.py @@ -57,11 +57,11 @@ class UNIXUserBackend(ServiceController): chmod 750 %(base_home)s ls -A /etc/skel/ | while read line; do if [[ ! -e %(home)s/${line} ]]; then - cp -a $line %(home)s/${line} + cp -a $line %(home)s/${line} && \ chown -R %(user)s:%(group)s %(home)s/${line} fi done - """) % context + fi""") % context ) if context['home'] != context['base_home']: self.append(textwrap.dedent("""