Skip to content

Commit

Permalink
generate ssh keys, install vim dependencies,
Browse files Browse the repository at this point in the history
  • Loading branch information
akash0x53 committed Nov 30, 2019
1 parent b3ffded commit 3788a95
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 4 deletions.
47 changes: 44 additions & 3 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,56 @@
#!/usr/bin/env bash

link_file()
{
local conf_file=$1

echo -n "Setup $conf_file"
ln -s "${PWD}/${conf_file}" "$HOME/${conf_file}" &> /dev/null
[ "$?" -eq "0" ] && echo " ... DONE." || echo " ... MAY ALREADY EXISTS."
}
# install required tools
sudo apt install xsel $> /dev/null


# setup gitconfig
ln -s "$PWD/gitconfig" "$HOME/.gitconfig" &2>/dev/null
link_file gitconfig

# setup bashrc
# if ~/.bashrc present already, create new .mybashrc and add "source .mybashrc" in .bashrc
if [ -f "$HOME/.bashrc" ]; then
echo "source $PWD/bashrc.funcs" >> $HOME/.bashrc
echo "source $PWD/bashrc" >> $HOME/.bashrc
if [ ! -w "$HOME/.bashrc" ]; then
echo "NOTE: .bashrc file locked"
else
echo "source $PWD/bashrc.funcs" >> $HOME/.bashrc
echo "source $PWD/bashrc" >> $HOME/.bashrc
chmod -w "$HOME/.bashrc"
fi
else
echo "WARNING: bashrc setup failed, system .bashrc not found."
fi

# setup vimrc
mkdir -p $HOME/.vim
if [ ! -d "$HOME/.vim/autoload" ]; then
git clone https://github.com/tpope/vim-pathogen.git $HOME/.vim/
fi
link_file vimrc

# SSH config
# Create key-pair for github account and add in ssh-config

KFILE="$HOME/.ssh/gh"
SSH_CONF="$HOME/.ssh/config"

if [ ! -f "$KFILE" ]; then
ssh-keygen -t rsa -b 4096 -f "$KFILE" -N ''
gh_ssh="""
Host github.com\n
HostName githun.com\n
IdentityFile $KFILE\n
"""
touch "$SSH_CONF"
echo -e $gh_ssh >> "$SSH_CONF"
cat "$KFILE.pub" | xsel -ib
notify-send "Public key copied to clipboard"
fi
2 changes: 1 addition & 1 deletion vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ set foldlevel=-1
"set noexpandtab
set tabstop=4
set shiftwidth=4
"set expandtab
set expandtab
colorscheme desert

"call pathogen#infect()
Expand Down

0 comments on commit 3788a95

Please sign in to comment.