File: my_ssh

package info (click to toggle)
gnat-gps 18-5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 45,716 kB
  • sloc: ada: 362,679; python: 31,031; xml: 9,597; makefile: 1,030; ansic: 917; sh: 264; java: 17
file content (32 lines) | stat: -rw-r--r-- 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/