| Rev | Line |   | 
|---|
| [804] | 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 | 
 | 
|---|
| [1164] | 11 | DIR="$1"
 | 
|---|
 | 12 | 
 | 
|---|
| [1163] | 13 | set -o errexit -o nounset
 | 
|---|
 | 14 | 
 | 
|---|
| [804] | 15 | usage()
 | 
|---|
 | 16 | {
 | 
|---|
 | 17 | echo "
 | 
|---|
 | 18 |   usage: $0 hostname
 | 
|---|
 | 19 |   hostname must be identical with the repository path
 | 
|---|
 | 20 | "
 | 
|---|
 | 21 | exit 1
 | 
|---|
 | 22 | }
 | 
|---|
 | 23 | 
 | 
|---|
| [1172] | 24 | OPTIONS="${DASSCM_RSYNC_OPTIONS:-}"
 | 
|---|
| [1163] | 25 | REMOTE_USER=${DASSCM_REMOTE_USER:-"root"}
 | 
|---|
| [804] | 26 | 
 | 
|---|
| [1164] | 27 | if [ -z "$DIR" ]; then
 | 
|---|
| [804] | 28 |     usage
 | 
|---|
 | 29 | fi
 | 
|---|
 | 30 | 
 | 
|---|
| [1164] | 31 | if [ ! -d "$DIR" ]; then
 | 
|---|
| [804] | 32 |     echo
 | 
|---|
| [1164] | 33 |     echo "  failed to access directory $DIR"
 | 
|---|
| [804] | 34 |     usage
 | 
|---|
 | 35 | fi
 | 
|---|
 | 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
 | 
|---|
| [1164] | 41 | cd $DIR
 | 
|---|
 | 42 | svn up || (echo "failed to update repository $DIR"; usage)
 | 
|---|
| [1163] | 43 | FILELIST=`mktemp`
 | 
|---|
| [1164] | 44 | svn ls -R > $FILELIST
 | 
|---|
 | 45 | SERVER=`basename "$PWD"`
 | 
|---|
| [1172] | 46 | RESULT=1
 | 
|---|
 | 47 | if [ "$OPTIONS" ]; then
 | 
|---|
 | 48 |     rsync -av --checksum --existing --files-from $FILELIST "$OPTIONS" $REMOTE_USER@$SERVER:/. .
 | 
|---|
 | 49 |     RESULT=$?
 | 
|---|
 | 50 | else
 | 
|---|
 | 51 |     rsync -av --checksum --existing --files-from $FILELIST $REMOTE_USER@$SERVER:/. .
 | 
|---|
 | 52 |     RESULT=$?
 | 
|---|
 | 53 | fi
 | 
|---|
 | 54 | if [ "$RESULT" -gt 0 ]; then
 | 
|---|
 | 55 |     echo "FAILED to transfer dasscm files. Failed to access server $SERVER via ssh/rsync?"
 | 
|---|
 | 56 |     usage
 | 
|---|
 | 57 | fi
 | 
|---|
| [1163] | 58 | rm $FILELIST
 | 
|---|
| [804] | 59 | echo "updated file must be commited manually"
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.