annotate bin/copy-remote.sh @ 830:6de24d387889

remove old import
author Jeff Hammel <k0scist@gmail.com>
date Sun, 19 Feb 2017 17:55:23 -0800
parents 1919706e94f5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
372
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 #!/bin/bash
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
2
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3 # TODO -> silvermirror
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4 # (STUB)
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
6 REMOTE=k0s.org
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
7
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
8 if ! echo $PWD | grep '^'$HOME
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
9 then
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
10 echo "should be in subtree of $HOME to use"
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
11 exit 1
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
12 fi
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
13
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
14 for i in "$@"
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
15 do
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
16 if [ ! -e $i ]
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
17 then
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
18 echo "Error: $i does not exist"
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
19 exit 1
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
20 fi
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
21 done
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
22
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
23 for i in "$@"
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
24 do
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
25 path=$(readlink -f $i)
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
26 if [ "${path:0:1}" != "/" ]
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
27 then
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
28 # relative path
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
29 #path=${PWD}/${path}
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
30 fi
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
31 scp ${REMOTE}:${path} ${path}
1919706e94f5 stub copy-remote
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
32 done