forked from jeanclaude/Dotfiles
169 lines
4.8 KiB
Bash
Executable File
169 lines
4.8 KiB
Bash
Executable File
#!/bin/bash
|
|
# Symlinkes dotfiles to correct location
|
|
|
|
dotfiles=~/Dotfiles
|
|
|
|
calendar=false
|
|
shell=false
|
|
scripts=false
|
|
wm=false
|
|
xWin=false
|
|
vim=false
|
|
system=false
|
|
systemd=false
|
|
git=false
|
|
app=false
|
|
homeServer=false
|
|
|
|
linker() {
|
|
# Symlinks file $1 to destination $2
|
|
## Caution: destination $2 gets removed!
|
|
echo "Link {$1} to {$2}"
|
|
sudo rm -rf "$2" > /dev/null 2>&1
|
|
ln -sf "$1" "$2"
|
|
}
|
|
|
|
dirContentLinker() {
|
|
# Symlinks files in $1 to destination $2
|
|
if [[ -d $1 ]]
|
|
then
|
|
for file in ${1}*
|
|
do
|
|
echo "Link {$file} to {$2}"
|
|
ln -sf "$file" "$2"
|
|
done
|
|
fi
|
|
}
|
|
|
|
colorizer() {
|
|
# Replaces color placeholders in $1 and copies it to $2
|
|
## Caution: desitnation $2 gets removed!
|
|
|
|
local dir="$(dirname $2)"
|
|
echo "Color Copy {$1} to {$2}"
|
|
|
|
sudo rm -rf "$dir" > /dev/null 2>&1
|
|
mkdir -p "$dir"
|
|
sh $dotfiles/colorizer.sh "$1" "$2"
|
|
}
|
|
|
|
# PC
|
|
calendar=true
|
|
shell=true
|
|
scripts=true
|
|
wm=true
|
|
xWin=true
|
|
vim=true
|
|
system=true
|
|
systemd=true
|
|
git=true
|
|
app=true
|
|
|
|
# Process Files
|
|
## System
|
|
### Shell
|
|
if [[ "$shell" = true ]]
|
|
then
|
|
linker "$dotfiles/zsh/.zshrc" ~/.zshrc
|
|
linker "$dotfiles/zsh/alias.zsh" ~/.oh-my-zsh/custom/alias.zsh
|
|
linker "$dotfiles/zsh/jc.zsh-theme" ~/.oh-my-zsh/custom/themes/jc.zsh-theme
|
|
fi
|
|
|
|
### X
|
|
if [[ "$xWin" = true ]]
|
|
then
|
|
linker "$dotfiles/.xcolors" ~/.xcolors
|
|
linker "$dotfiles/zsh/.zlogin" ~/.zlogin
|
|
linker "$dotfiles/.xinitrc" ~/.xinitrc
|
|
linker "$dotfiles/.Xresources" ~/.Xresources
|
|
xrdb ~/.Xresources
|
|
|
|
linker "$dotfiles/gtk-3.0" ~/.config/gtk-3.0
|
|
linker "$dotfiles/.gtkrc-2.0" ~/.gtkrc-2.0
|
|
linker "$dotfiles/Themes/Lumiere" ~/.themes/Lumiere
|
|
fi
|
|
|
|
### System Configs
|
|
if [[ "$system" = true ]]
|
|
then
|
|
linker "$dotfiles/fontconfig" ~/.config/fontconfig
|
|
linker "$dotfiles/mimeapps.list" ~/.config/mimeapps.list
|
|
linker "$dotfiles/locale.conf" ~/.config/locale.conf
|
|
fi
|
|
|
|
if [[ "$systemd" = true ]]
|
|
then
|
|
sudo bash -c "$(declare -f linker); linker \"$dotfiles/acpi\" '/etc/acpi'" # Run as root
|
|
linker "$dotfiles/systemd" ~/.config/systemd
|
|
linker "$dotfiles/.pam_environment" ~/.pam_environment
|
|
fi
|
|
|
|
## Scripts
|
|
if [[ "$scripts" = true ]]
|
|
then
|
|
linker "$dotfiles/Scripts/displayer" ~/bin/displayer
|
|
sudo bash -c "$(declare -f linker); linker \"$dotfiles/Scripts/displayer\" '/bin/displayer'"
|
|
linker "$dotfiles/Scripts/lock.sh" ~/bin/lock.sh
|
|
linker "$dotfiles/Scripts/battery.sh" ~/bin/battery.sh
|
|
linker "$dotfiles/Scripts/monitor.sh" ~/bin/monitor.sh
|
|
linker "$dotfiles/Scripts/backlight.sh" ~/bin/backlight.sh
|
|
sudo bash -c "$(declare -f linker); linker \"$dotfiles/Scripts/backlight.sh\" '/bin/backlight.sh'"
|
|
linker "$dotfiles/Scripts/volume.sh" ~/bin/volume.sh
|
|
sudo bash -c "$(declare -f linker); linker \"$dotfiles/Scripts/volume.sh\" '/bin/volume.sh'"
|
|
sudo bash -c "$(declare -f linker); linker \"$dotfiles/Scripts/scrotMenu.sh\" '/bin/scrotMenu.sh'"
|
|
sudo bash -c "$(declare -f linker); linker \"$dotfiles/Scripts/monitorMenu.sh\" '/bin/monitorMenu.sh'"
|
|
linker "$dotfiles/Scripts/wwan.sh" ~/bin/wwan.sh
|
|
sudo bash -c "$(declare -f linker); linker \"$dotfiles/Scripts/wwan.sh\" '/bin/wwan.sh'"
|
|
fi
|
|
|
|
## WM
|
|
if [[ "$wm" = true ]]
|
|
then
|
|
linker "$dotfiles/Openbox/autostart" ~/.config/openbox/autostart
|
|
linker "$dotfiles/Openbox/environment" ~/.config/openbox/environment
|
|
linker "$dotfiles/Openbox/menu.xml" ~/.config/openbox/menu.xml
|
|
linker "$dotfiles/Openbox/rc.xml" ~/.config/openbox/rc.xml
|
|
linker "$dotfiles/Tint2/tint2rc" ~/.config/tint2/tint2rc
|
|
linker "$dotfiles/Themes/Vent" ~/.themes/Vent
|
|
fi
|
|
|
|
## Applications
|
|
### VIM
|
|
if [[ "$vim" = true ]]
|
|
then
|
|
mkdir -p ~/.config/nvim/autoload
|
|
linker "$dotfiles/Vim/init.vim" ~/.config/nvim/init.vim
|
|
linker "$dotfiles/Vim/General" ~/.config/nvim/General
|
|
linker "$dotfiles/Vim/PluginConfig" ~/.config/nvim/PluginConfig
|
|
linker "$dotfiles/Vim/autoload" ~/.config/nvim/autoload
|
|
linker "$dotfiles/Vim/UltiSnips" ~/.config/nvim/UltiSnips
|
|
linker "$dotfiles/Vimiv/vimiv.conf" ~/.config/vimiv/vimiv.conf
|
|
linker "$dotfiles/Vimiv/keys.conf" ~/.config/vimiv/keys.conf
|
|
fi
|
|
|
|
### Git
|
|
if [[ "$git" = true ]]
|
|
then
|
|
linker "$dotfiles/Git/.gitconfig" ~/.gitconfig
|
|
linker "$dotfiles/Git/.gitignore_global" ~/.gitignore_global
|
|
fi
|
|
|
|
### Other Applications
|
|
if [[ "$app" = true ]]
|
|
then
|
|
colorizer "$dotfiles/dunst/dunstrc.raw" ~/.config/dunst/dunstrc
|
|
linker "$dotfiles/mpv" ~/.config/mpv
|
|
colorizer "$dotfiles/termite/config.raw" ~/.config/termite/config
|
|
linker "$dotfiles/Rofi" ~/.config/rofi
|
|
linker "$dotfiles/Taskwarrior/taskrc" ~/.config/taskwarrior/taskrc
|
|
linker "$dotfiles/Taskwarrior/dark-16.theme" ~/.config/taskwarrior/dark-16.theme
|
|
fi
|
|
|
|
## Calendar and Todo
|
|
if [[ "$calendar" = true ]]
|
|
then
|
|
linker "$dotfiles/Calendar/Khal" ~/.config/khal
|
|
linker "$dotfiles/Calendar/VdirSyncer" ~/.config/vdirsyncer
|
|
linker "$dotfiles/Todoman" ~/.config/todoman
|
|
fi
|