Mercurial > hg > cc > valhalla
annotate bin/setup @ 0:fdd3f8a16fd4 default tip
shared scripts on valhalla cluster
author | Henry Thompson <ht@markup.co.uk> |
---|---|
date | Sat, 14 Mar 2020 11:00:58 +0000 |
parents | |
children |
rev | line source |
---|---|
0
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
1 #!/bin/bash |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
2 |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
3 SHARED=/home/shared/ht |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
4 |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
5 link () { |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
6 rm -f "$2" |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
7 ln -s "$1" "$2" |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
8 } |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
9 |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
10 link $SHARED $HOME/shared |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
11 link $SHARED/.profile $HOME/.profile |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
12 link $SHARED/.ia $HOME/.ia |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
13 |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
14 mkdir -p $HOME/.ssh |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
15 chmod 700 $HOME/.ssh |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
16 |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
17 if [ -f $HOME/.ssh/authorized_keys ] |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
18 then |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
19 if cmp -s $SHARED/.ssh/authorized_keys $HOME/.ssh/authorized_keys |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
20 then |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
21 : |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
22 else |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
23 cat $SHARED/.ssh/authorized_keys >> $HOME/.ssh/authorized_keys |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
24 fi |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
25 else |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
26 cp $SHARED/.ssh/authorized_keys $HOME/.ssh/authorized_keys |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
27 chmod 600 $HOME/.ssh/authorized_keys |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
28 fi |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
29 |
fdd3f8a16fd4
shared scripts on valhalla cluster
Henry Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
30 |