#! /bin/bash
#
# clone_and_link.sh
# Copyright (C) 2016 fabian <fabian@fabi-laptop-arch>
#
# Distributed under terms of the MIT license.
#


if [[ $1 == "shared" ]]; then
    ln -Tsfv $PWD/zsh $HOME/.zsh
    ln -Tsfv ~/.zsh/.zshrc $HOME/.zshrc
    touch ~/.zsh/.shared_config
    ln -Tsfv $PWD/tmux $HOME/.tmux
    ln -Tsfv ~/.tmux/.tmux.conf $HOME/.tmux.conf
    mkdir -p $HOME/.config
    rm -rf $HOME/.config/nvim
    ln -Tsfv $PWD/nvim $HOME/.config/nvim
    touch $HOME/.config/nvim/.shared_config
else
    ln -Tsfv $PWD/zsh $HOME/.zsh
    ln -Tsfv ~/.zsh/.zshrc $HOME/.zshrc
    ln -Tsfv $PWD/tmux $HOME/.tmux
    ln -Tsfv ~/.tmux/.tmux.conf $HOME/.tmux.conf
    mkdir -p $HOME/.config
    rm -rf $HOME/.config/nvim
    ln -Tsfv $PWD/nvim $HOME/.config/nvim
fi

cat $PWD/ssh_tty | sudo tee /etc/sudoers.d/ssh_tty > /dev/null
