diff options
author | Urbain Vaes <urbain@vaes.uk> | 2016-03-08 19:03:17 +0000 |
---|---|---|
committer | Urbain Vaes <urbain@vaes.uk> | 2016-03-08 19:03:17 +0000 |
commit | 810035ab675fbf35a79bb9b1f23619ad696e9183 (patch) | |
tree | d39d7e896acdde0d09762b09733fd9b471ae8372 | |
parent | 18fec99e540705c159a1b786122453446dc3a469 (diff) |
Improve install file
-rw-r--r-- | .dotmap | 32 | ||||
-rw-r--r-- | .gitignore | 16 | ||||
-rw-r--r-- | .mutt/cache/.gitkeep | 0 | ||||
-rw-r--r-- | .mutt/temp/.gitkeep | 0 | ||||
-rw-r--r-- | .vim/vimundo/.gitkeep | 0 | ||||
-rwxr-xr-x | bin/dot | 103 | ||||
-rw-r--r-- | install.yaml | 52 |
7 files changed, 85 insertions, 118 deletions
@@ -0,0 +1,32 @@ +declare -A dotmap +dotmap[/home/urbain/.zsh]=/home/urbain/dotfiles/.zsh +dotmap[/home/urbain/.mbsyncrc]=/home/urbain/dotfiles/.mbsyncrc +dotmap[/home/urbain/.mrtrust]=/home/urbain/dotfiles/.mr/mrtrust +dotmap[/home/urbain/.inputrc]=/home/urbain/dotfiles/.inputrc +dotmap[/home/urbain/.xinitrc]=/home/urbain/dotfiles/.xinitrc +dotmap[/home/urbain/.ncmpcpp]=/home/urbain/dotfiles/.ncmpcpp +dotmap[/home/urbain/.latexmkrc]=/home/urbain/dotfiles/.latexmkrc +dotmap[/home/urbain/bin]=/home/urbain/dotfiles/bin +dotmap[/home/urbain/.mrconfig]=/home/urbain/dotfiles/.mr/mrconfig +dotmap[/home/urbain/.zgen]=/home/urbain/dotfiles/.zsh/zgen +dotmap[/home/urbain/.vim]=/home/urbain/dotfiles/.vim +dotmap[/home/urbain/.local/share/qutebrowser/userscripts]=/home/urbain/dotfiles/.qutebrowser/userscripts +dotmap[/home/urbain/.config/i3status/config]=/home/urbain/dotfiles/.i3/i3status.conf +dotmap[/home/urbain/.config/dunst/dunstrc]=/home/urbain/dotfiles/.dunstrc +dotmap[/home/urbain/.config/zathura/zathurarc]=/home/urbain/dotfiles/.zathurarc +dotmap[/home/urbain/.config/newsbeuter]=/home/urbain/dotfiles/.newsbeuter +dotmap[/home/urbain/.config/qutebrowser]=/home/urbain/dotfiles/.qutebrowser +dotmap[/home/urbain/.config/i3/config]=/home/urbain/dotfiles/.i3/config +dotmap[/home/urbain/.bashrc]=/home/urbain/dotfiles/.bashrc +dotmap[/home/urbain/.vimrc]=/home/urbain/dotfiles/.vim/vimrc +dotmap[/home/urbain/.urxvt]=/home/urbain/dotfiles/.urxvt +dotmap[/home/urbain/.mutt]=/home/urbain/dotfiles/.mutt +dotmap[/home/urbain/.password-store]=/home/urbain/dotfiles/.passwords +dotmap[/home/urbain/.tmux.conf]=/home/urbain/dotfiles/.tmux.conf +dotmap[/home/urbain/.zshrc]=/home/urbain/dotfiles/.zsh/zshrc +dotmap[/home/urbain/.msmtprc]=/home/urbain/dotfiles/.msmtprc +dotmap[/home/urbain/.gitconfig]=/home/urbain/dotfiles/.gitconfig +dotmap[/home/urbain/.vifm]=/home/urbain/dotfiles/.vifm +dotmap[/home/urbain/.surfraw.bookmarks]=/home/urbain/dotfiles/.surfraw.bookmarks +dotmap[/home/urbain/.git_template]=/home/urbain/dotfiles/.git_template +dotmap[/home/urbain/.Xresources]=/home/urbain/dotfiles/.Xresources @@ -1,23 +1,19 @@ .mutt/attachments/* -.mutt/cache/ -.mutt/cache/headers -.mutt/mailboxes/ -.mutt/mutt-colors-solarized/ +.mutt/cache/* .mutt/solarized -.mutt/temp/ -.nvim/.netrwhist +.mutt/temp/* .passwords .personal +.qutebrowser/qsettings .urxvt/ext .vifm/Trash .vifm/vifminfo .vifm/vimfiles .vim/.netrwhist -.vim/netrwhist -.vim/plugged/ +.vim/plugged .vim/vim-plug -.vim/vimundo/ -.zsh/zgen +.vim/vimundo/* .zsh/tmp +.zsh/zgen !*.gitkeep diff --git a/.mutt/cache/.gitkeep b/.mutt/cache/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.mutt/cache/.gitkeep diff --git a/.mutt/temp/.gitkeep b/.mutt/temp/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.mutt/temp/.gitkeep diff --git a/.vim/vimundo/.gitkeep b/.vim/vimundo/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.vim/vimundo/.gitkeep @@ -1,56 +1,47 @@ -#!/usr/bin/env python - -import os -import sys -import yaml - -# Colors for terminal -from termcolor import colored - -# Path of dotfiles -homepath = '/home/urbain' -dotpath = homepath + '/dotfiles' - -# Load yaml configuration file -with open(dotpath + "/install.yaml", 'r') as stream: - config = yaml.load(stream) - -# Special and default symlinks -special_symlinks = set(config['special'].keys()) -normal_symlinks = set(config['default']) - - -def perform(action): - - for f in special_symlinks | normal_symlinks: - - # Print filename - print('[' + colored(f, 'green') + ']') - - if f in config['pre'] and action == 'up': - - # Format command - command = config['pre'][f] - formatted = command.format(file=f, path=dotpath) - - # Print & execute - print(formatted) - os.system(formatted) - - # Target of symlink - if f in special_symlinks: - t = config['special'][f] - elif f in normal_symlinks: - t = homepath + '/' + f - - # Command to execute - command = config['commands'][action] - formatted = command.format(file=f, path=dotpath, target=t) - - # Print & execute command - print(formatted) - os.system(formatted) - - print('\n') - -perform(sys.argv[1]) +#!/usr/bin/env bash + +get_links() +{ + find $HOME -not -path "$HOME/dotfiles/*" -type l | while read line; do + if [[ "$(realpath -q $line)" == "${HOME}/dotfiles/"* ]]; then + echo $line + fi + done +} + +clean() +{ + get_links | while read link; do + rm -v ${link} + done +} + +down() +{ + source $HOME/dotfiles/.dotmap + for link in "${!dotmap[@]}"; do + echo "Removing ${link}." + rm -rf $link + done +} + +up() +{ + source $HOME/dotfiles/.dotmap + for link in "${!dotmap[@]}"; do + target=${dotmap[$link]} + mkdir -p $(dirname ${link}) + echo "Linking $target." + rm -rf $link && ln -s $target $link + done +} + +save() +{ + echo "declare -A dotmap" > .dotmap + get_links | while read link; do + echo "dotmap[$link]=$(realpath -q $link)" >> .dotmap + done +} + +$1 diff --git a/install.yaml b/install.yaml deleted file mode 100644 index 1d56663..0000000 --- a/install.yaml +++ /dev/null @@ -1,52 +0,0 @@ -# Commands to install / uninstall symlinks -commands: - up: rm -rf {target} && mkdir -p $(dirname {target}) && ln -s {path}/{file} {target} - down: rm -rf {target} - - -# Default targets -default: - - bin - - .bashrc - - .gitconfig - - .git_template - - .inputrc - - .latexmkrc - - .mbsyncrc - - .mutt - - .msmtprc - - .ncmpcpp - - .surfraw.bookmarks - - .tmux.conf - - .urxvt - - .vim - - .vifm - - .xinitrc - - .Xresources - - .zsh - -# Special targets -special: - .dunstrc: ~/.config/dunst/dunstrc - .i3/config: ~/.config/i3/config - .i3/i3status.conf: ~/.config/i3status/config - .mr/mrconfig: ~/.mrconfig - .mr/mrtrust: ~/.mrtrust - .newsbeuter: ~/.config/newsbeuter - .vim/vimrc: ~/.vimrc - .qutebrowser: ~/.config/qutebrowser - .qutebrowser/userscripts: ~/.local/share/qutebrowser/userscripts - .passwords: ~/.password-store - .zathurarc: ~/.config/zathura/zathurarc - .zsh/zgen: ~/.zgen - .zsh/zshrc: ~/.zshrc - -# Additional actions before symlink -pre: - .mutt: | - mkdir -p {path}/.mutt/temp - mkdir -p {path}/.mutt/cache - mkdir -p {path}/.mutt/bodies - - .vim: | - mkdir -p {path}/.vim/vimundo |