dotfiles/setup.sh

67 lines
1.7 KiB
Bash
Raw Normal View History

2017-11-03 07:09:33 +00:00
#!/bin/bash
2021-07-21 07:36:32 +00:00
set -u
mkdir -p ~/.config/homedir-backup 2>/dev/null
function linkfiles {
for file in $@; do
2022-02-15 07:55:29 +00:00
create_dir=false
2021-07-21 07:36:32 +00:00
name=$(basename $file)
dir=$(dirname $file)
if [ "$dir" == "dotfiles" ] ; then
targetdir=""
2022-02-15 07:55:29 +00:00
elif [ "$( dirname $dir | cut -f1 -d/)" == "configfile" ] ; then
targetdir="config/$(echo $dir | cut -f2- -d/)/"
create_dir=true
2021-07-21 07:36:32 +00:00
else
targetdir="$dir/"
fi
if [ ! -L ~/.${targetdir}${name} ] ; then
2022-02-15 07:55:29 +00:00
if $create_dir ; then
mkdir -p ~/.${targetdir}
fi
if [ -f hosts/$(hostname -s)/${name} ] ; then
dotfile="$(pwd)/hosts/$(hostname -s)/${name}"
else
dotfile="$(pwd)/$dir/${name}"
fi
2022-02-15 07:55:29 +00:00
2021-07-21 07:36:32 +00:00
mv -v ~/.${targetdir}${name} ~/.config/homedir-backup
ln -s "$dotfile" ~/.${targetdir}${name}
2021-07-21 07:36:32 +00:00
fi
done
}
2022-02-15 07:55:29 +00:00
#linkfiles 'dotfiles/*'
2022-02-14 20:37:02 +00:00
2022-02-15 07:55:29 +00:00
#git clone https://github.com/NvChad/NvChad ~/.config/nvim
#nvim -c "autocmd User PackerComplete quitall" -c "PackerSync"
#linkfiles 'config/*'
set -x
for file in $(find configfile -type f) ; do
linkfiles $file
done
set +x
exit
2021-04-19 10:08:05 +00:00
# Install powerline if possible
if which pip3 ; then
pip3 install --user -U -r requirements.txt
2021-04-19 10:08:05 +00:00
else
[ ! -d ~/.bash-git-prompt ] && git clone https://github.com/nold360/bash-git-prompt.git ~/.bash-git-prompt
fi
2017-11-03 07:24:23 +00:00
2021-04-19 10:08:05 +00:00
# Install vundle plugin manager & plugins
2019-02-14 18:45:24 +00:00
mkdir -p ~/.vim/bundle 2>/dev/null
2018-01-09 06:03:40 +00:00
[ ! -d ~/.vim/bundle/Vundle.vim ] && git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
2017-11-03 07:09:33 +00:00
vim -c ":PluginInstall" -c ":q" -c ":q"
2019-02-14 18:45:24 +00:00
2021-04-21 08:12:00 +00:00
# Tmux Plugin Manager
mkdir -p ~/.tmux/plugins 2>/dev/null
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
2021-04-19 10:08:05 +00:00
grep -qE "^source.*$(pwd)/bashrc" ~/.bashrc || echo "source $(pwd)/bashrc" >> ~/.bashrc
echo Done