Use array for keeping track of files

Signed-off-by: Severin Kaderli <severin.kaderli@gmail.com>
This commit is contained in:
Severin Kaderli 2018-12-09 10:14:32 +01:00
parent 3711ac3ea6
commit 0bf9c3067c
2 changed files with 291 additions and 25 deletions

View file

@ -2,6 +2,26 @@
#
# Author: Severin Kaderli <severin.kaderli@gmail.com>
# Usage: ./install.sh
FILES=(
".gitconfig"
".vimrc"
".bash_logout"
".bash_profile"
".bashrc"
".aliases"
".xinitrc"
".Xresources"
".config/i3"
".config/termite"
".config/polybar"
".config/dunst"
".config/compton.conf"
".dircolors"
".hyper.js"
"bin"
".crontab"
)
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# TODO: Install yaourt or else the next thing fails
@ -16,29 +36,13 @@ yaourt -S --noconfirm $(cat "$DIR/yaourt/packages.aur.list")
# TODO: Create a function that makes the linking easier and that checks if
# the links already exists
# Setting up git configuration
ln -s "$DIR/.gitconfig" "$HOME/.gitconfig"
for file in "${FILES[@]}"
do
rm -rf "$HOME/$file"
ln -fs "$DIR/$file" "$HOME/$file"
done
# Setting up vim configuration
ln -s "$DIR/.vimrc" "$HOME/.vimrc"
# Setting up various configuration files
ln -s "$DIR/.bash_logout" "$HOME/.bash_logout"
ln -s "$DIR/.bash_profile" "$HOME/.bash_profile"
ln -s "$DIR/.bashrc" "$HOME/.bashrc"
ln -s "$DIR/.aliases" "$HOME/.aliases"
ln -s "$DIR/.xinitrc" "$HOME/.xinitrc"
ln -s "$DIR/.Xresources" "$HOME/.Xresources"
ln -s "$DIR/.config/i3" "$HOME/.config/i3"
ln -s "$DIR/.config/termite" "$HOME/.config/termite"
ln -s "$DIR/.config/polybar" "$HOME/.config/polybar"
ln -s "$DIR/.dircolors" "$HOME/.dircolors"
ln -s "$DIR/.config/compton.conf" "$HOME/.config/compton.conf"
ln -s "$DIR/.hyper.js" "$HOME/.hyper.js"
# Symlinking scripts directory and giving execute permissions
ln -s "$DIR/bin" "$HOME/bin"
# ive scripts execute permissions
chmod +x "$HOME/bin/*"
# Download and install composer
@ -47,6 +51,3 @@ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"
mv "$DIR/composer.phar" "$HOME/bin/composer"
# Link crontab file
ln -s "$DIR/.crontab" "$HOME/.crontab"