# HG changeset patch # User ymh # Date 1272041582 -7200 # Node ID 03f5524aa3c0ceaf016b182eca9f8e00feec6768 # Parent a7b73ae25643988b7c0e88e005f1596860b946fc correct sync script and add mosatags user creation diff -r a7b73ae25643 -r 03f5524aa3c0 build/sbin/sync_mosatags --- a/build/sbin/sync_mosatags Fri Apr 23 11:07:28 2010 +0200 +++ b/build/sbin/sync_mosatags Fri Apr 23 18:53:02 2010 +0200 @@ -1,4 +1,4 @@ -#!/bin/env bash +#!/usr/bin/env bash shopt -s extglob @@ -25,7 +25,7 @@ sync_type='all' server='dev' -hg_user="$hg_anonymous_user:$hg_anonymous_password"; +hg_user="$hg_anonymous_user" hg_operation='update' debug=false @@ -40,9 +40,10 @@ echo " -o : one of update|archive" echo " -l : the url of the hg repository" echo " -u : hg user" + echo " -p : hg password" echo " -c : path for cloning the repository" - echo " -e : path prefix for export. The version will be" - echo " appended. ignored when hg operation is \"update\"" + echo " -e : path prefix for export. The version will be" + echo " appended. ignored when hg operation is \"update\"" echo " -d: debug mode. display only environement" } @@ -56,14 +57,13 @@ hg_clone_url=`hg paths|grep "^default"`; hg_clone_url=${hg_clone_url##"default = "}; echo "Repository path = |$hg_clone_url|, must be |$hg_url|."; - if [[ "$hg_url" =~ "${hg_clone_url}" ]]; then + if [[ "$hg_compare_url" =~ "${hg_clone_url}" ]]; then echo "Repository already exists pull" hg pull -f || { echo "problem when pulling"; exit;} else echo "Repository bad url, deleting clone." popd rm -fr $clone_path - pushd "$clone_path" fi fi if [ ! -d "$clone_path" ]; then @@ -93,14 +93,14 @@ echo "cleanup"; if [ -d "$export_path" && "$export_path" != "$clone_path" ]; then echo "Delete export_path : $export_path" - #rm -fr $export_path; + rm -fr $export_path; echo "ok"; fi } sync_web() { echo "==============="; - export_path_web="$export_path"/web/thdProject; + export_path_web="$export_path"/web/thdProject/; server_ip_name=$server"_web_server"; server_ip=${!server_ip_name}; sync_user_name=${server}_sync_user; @@ -130,11 +130,12 @@ P log/*** P data/*** EOT - pushd "$export_path_web"; - echo "symfony unfreeze" - php symfony unfreeze ; - popd; - + if [ "$hg_operation" == "update" ]; then + pushd "$export_path_web"; + echo "symfony unfreeze" + php symfony unfreeze ; + popd; + fi fi } @@ -142,15 +143,15 @@ sync_engine() { echo "==============="; echo "sync engine"; - export_path_engine="$export_path"/engine; + export_path_engine="$export_path"/engine/; server_ip_name=$server"_engine_server"; server_ip=${!server_ip_name}; sync_user_name=${server}_sync_user; sync_user=${!sync_user_name}; echo "sync web from $export_path_engine to $server_ip ($server_ip_name) with user $sync_user ($sync_user_name)"; if [ -d "$export_path_engine" ]; then - echo rsync -Cvrlz --delete --filter=". -" "$export_path_engine" $syn_user@$server_ip:$engine_location - cat <