File: my_ssh

package info (click to toggle)
gnat-gps 5.3dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 50,360 kB
  • ctags: 11,617
  • sloc: ada: 374,346; ansic: 92,327; python: 15,979; xml: 12,186; sh: 3,277; makefile: 1,113; awk: 154; perl: 128; java: 17
file content (32 lines) | stat: -rwxr-xr-x 989 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
# As ssh the first argument of this script is the name of the
# remote machine
machine=$1
shift

# variables containing the path to local and remote directory that
# are the root project directory.
local_dir="local_root_project_dir"
remote_dir="remote_root_project_dir"

# convert the local path into a path suitable for the remote machine
cmd=`echo "$@" | sed -e "s|$local_dir|$remote_dir/|g"`

# in the Cygwin case, the paths passed to the rsync command must be
# in Unix format
case `uname` in
   CYGWIN*) local_dir=`cygpath -u $local_dir`;;
esac

# synchronize sources from local to remote machine
rsync -ar --rsh="ssh" --include="*.ads" --include="*.adb" \
      --include="*.gpr" --include="*/" --exclude="*" \
      $local_dir/ $machine:$remote_dir

# execute the remote command
ssh $machine "$cmd"

# synchronize ALI files from remote to local machine
rsync -ar --rsh="ssh" --include="*.ali" --include="*/" \
      --exclude="*" \
      $machine:$remote_dir/ $local_dir/