dotfiles/initialize_script

40 lines
1.2 KiB
Bash
Executable file

#!/bin/bash
# Setup script for vim & tmux
function get_path {
# Get the full path of a file
SCRIPT=`realpath $0`
# Remove everything but the filename
SCRIPTPATH=`dirname $SCRIPT`
}
function user_config {
read -p 'Install the script for a normal user or root account? [user/root]: ' USER
if [[ "$USER" == "user" ]]; then
get_path
mkdir $HOME/.vim
if [[ -a $HOME/.bashrc ]]; then
mv $HOME/.bashrc $HOME/.bashrc.old
echo "Old .bashrc moved to .bashrc.old"
fi
ln -s $SCRIPTPATH/{.bashrc,vim/.vimrc,tmux/.tmux.conf,.profile} $HOME/;
ln -s $SCRIPTPATH/vim/colors $HOME/.vim/
echo 'Linking configuration files done'
elif [[ "$USER" == "root" ]]; then
get_path
mkdir /root/.vim
if [[ -a $HOME/.bashrc ]]; then
mv /root/.bashrc /root/.bashrc.old
echo "Old .bashrc moved to .bashrc.old"
fi
ln -s $SCRIPTPATH/{.bashrc,vim/.vimrc,tmux/.tmux.conf,.profile} /root/
ln -s $SCRIPTPATH/vim/colors /root/.vim/
echo 'Linking configuration files done'
else
echo 'No selection was made'
exit 1
fi
}
user_config