-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.sh
52 lines (39 loc) · 1.09 KB
/
setup.sh
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#! /usr/bin/env bash
# check if username has been provided
if (( $# != 1 ))
then
echo "Usage: ./setup.sh username"
echo "no username provided"
exit 1
fi
# get directory of this script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# .BASH_PROFILE & .BASHRC
if [ ! -f ~/.bash_profile ]; then
echo "~/.bash_profile not found"
cp $DIR/.bash_profile ~/
echo "~/.bash_profile created"
fi
if [ ! -f ~/.bashrc ]; then
echo "~/.bashrc not found"
cp $DIR/.bashrc ~/
echo "~/.bashrc created"
fi
echo "# Added by sdal_configs setup" >> ~/.bashrc
echo "source $DIR/.bash_aliases_sdal" >> ~/.bashrc
# SSH CONFIG FILE
mkdir -p ~/.ssh
if [ ! -f ~/.ssh/config_home ]; then
echo "~/.ssh/config_home not found"
touch ~/.ssh/config_home
echo "~/.ssh/config_home created"
fi
cat ~/.ssh/config_home > ~/.ssh/config
printf "\n\n# SDAL CONFIG BELOW\n\n">> ~/.ssh/config
# use user supplied pid
sed -i -e "s/<your_pid>/$1/g" $DIR/config
cat $DIR/config >> ~/.ssh/config
# reset the file
sed -i -e "s/$1/<your_pid>/g" $DIR/config
# SSHFS MOUNTS
cp $DIR/mount_this_ssh.sh ~/.ssh/