source: dasscm/trunk/usr/bin/dasscm_remote_update.sh@ 1246

Last change on this file since 1246 was 1172, checked in by joergs, on Jun 2, 2014 at 3:44:03 PM

improved argument handling

  • Property svn:executable set to *
File size: 1.4 KB
Line 
1#!/bin/bash
2
3# dasscm_remote_update is intended for systems
4# where a local dasscm installation is not possible
5# but ssh and rsync is available.
6# In this case,
7# the files from the local repository checkout
8# are updated to the current content.
9# Use only, if a local dasscm installation is not possbile!
10
11DIR="$1"
12
13set -o errexit -o nounset
14
15usage()
16{
17echo "
18 usage: $0 hostname
19 hostname must be identical with the repository path
20"
21exit 1
22}
23
24OPTIONS="${DASSCM_RSYNC_OPTIONS:-}"
25REMOTE_USER=${DASSCM_REMOTE_USER:-"root"}
26
27if [ -z "$DIR" ]; then
28 usage
29fi
30
31if [ ! -d "$DIR" ]; then
32 echo
33 echo " failed to access directory $DIR"
34 usage
35fi
36
37# start at an current repository checkout of morbo.
38# only already existing files will be updated.
39# If you want to add more files,
40# create the file in the repository and re-run this script
41cd $DIR
42svn up || (echo "failed to update repository $DIR"; usage)
43FILELIST=`mktemp`
44svn ls -R > $FILELIST
45SERVER=`basename "$PWD"`
46RESULT=1
47if [ "$OPTIONS" ]; then
48 rsync -av --checksum --existing --files-from $FILELIST "$OPTIONS" $REMOTE_USER@$SERVER:/. .
49 RESULT=$?
50else
51 rsync -av --checksum --existing --files-from $FILELIST $REMOTE_USER@$SERVER:/. .
52 RESULT=$?
53fi
54if [ "$RESULT" -gt 0 ]; then
55 echo "FAILED to transfer dasscm files. Failed to access server $SERVER via ssh/rsync?"
56 usage
57fi
58rm $FILELIST
59echo "updated file must be commited manually"
Note: See TracBrowser for help on using the repository browser.