view 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
line wrap: on
line source

#!/bin/bash

SHARED=/home/shared/ht

link () {
    rm -f "$2"
    ln -s "$1" "$2"
}

link $SHARED $HOME/shared
link $SHARED/.profile $HOME/.profile
link $SHARED/.ia $HOME/.ia

mkdir -p $HOME/.ssh
chmod 700 $HOME/.ssh

if [ -f $HOME/.ssh/authorized_keys ]
then
    if cmp -s $SHARED/.ssh/authorized_keys $HOME/.ssh/authorized_keys
    then
	:
    else
	cat $SHARED/.ssh/authorized_keys >> $HOME/.ssh/authorized_keys
    fi
else
    cp $SHARED/.ssh/authorized_keys $HOME/.ssh/authorized_keys
    chmod 600 $HOME/.ssh/authorized_keys
fi