From 2dc9d4299442280e9e2b386de66507edc3d7b681 Mon Sep 17 00:00:00 2001 From: Urbain Vaes Date: Fri, 15 Jan 2016 10:08:00 +0000 Subject: Simplify install script --- .i3/Makefile | 8 ------- .mr/mrconfig | 24 +++++++++++++++++++++ .mr/mrtrust | 1 + .mrconfig | 24 --------------------- .mutt/Makefile | 19 ----------------- .offlineimap/Makefile | 13 ------------ .uzbl/Makefile | 13 ------------ .vim/Makefile | 16 -------------- .zathura/Makefile | 10 --------- .zathura/zathurarc | 2 -- .zathurarc | 2 ++ .zsh/Makefile | 17 --------------- Makefile | 5 ----- bin/dot | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++ install.yaml | 47 +++++++++++++++++++++++++++++++++++++++++ 15 files changed, 132 insertions(+), 127 deletions(-) delete mode 100644 .i3/Makefile create mode 100644 .mr/mrconfig create mode 100644 .mr/mrtrust delete mode 100644 .mrconfig delete mode 100644 .mutt/Makefile delete mode 100644 .offlineimap/Makefile delete mode 100644 .uzbl/Makefile delete mode 100644 .vim/Makefile delete mode 100644 .zathura/Makefile delete mode 100644 .zathura/zathurarc create mode 100644 .zathurarc delete mode 100644 .zsh/Makefile delete mode 100644 Makefile create mode 100755 bin/dot create mode 100644 install.yaml diff --git a/.i3/Makefile b/.i3/Makefile deleted file mode 100644 index ccbbffa..0000000 --- a/.i3/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -HOME=/home/urbain -TARGET=$(HOME)/.config/i3 - -$(TARGET) : - rm -f $@ && ln -s $(PWD) $@ - -clean : - rm -f $(TARGETS) diff --git a/.mr/mrconfig b/.mr/mrconfig new file mode 100644 index 0000000..33ea339 --- /dev/null +++ b/.mr/mrconfig @@ -0,0 +1,24 @@ +[dotfiles] +checkout = git clone 'git@github.com:uvaes/dotfiles' 'dotfiles' + +[dotfiles/.personal] +checkout = git clone 'git@github.com:uvaes/personal' '.personal' + +[dotfiles/.vim/vim-plug] +checkout = git clone 'https://github.com/junegunn/vim-plug' 'vim-plug' +skip = [ "$1" = push ] + +[dotfiles/.mutt/solarized] +checkout = git clone 'https://github.com/altercation/mutt-colors-solarized' 'solarized' +skip = [ "$1" = push ] + +[dotfiles/.zsh/zgen] +checkout = git clone 'https://github.com/tarjoilija/zgen' 'zgen' +skip = [ "$1" = push ] + +[dotfiles/.passwords] +checkout = git clone 'urbain@urbainvaes.com:git/passwords.git' '.passwords' + +[dotfiles/.urxvt/ext] +checkout = git clone 'https://github.com/muennich/urxvt-perls' 'ext' +skip = [ "$1" = push ] diff --git a/.mr/mrtrust b/.mr/mrtrust new file mode 100644 index 0000000..aa0f340 --- /dev/null +++ b/.mr/mrtrust @@ -0,0 +1 @@ +~/Dropbox/phd/.mrconfig diff --git a/.mrconfig b/.mrconfig deleted file mode 100644 index ad60854..0000000 --- a/.mrconfig +++ /dev/null @@ -1,24 +0,0 @@ -[.] -checkout = git clone 'git@github.com:uvaes/dotfiles' 'dotfiles' - -[.passwords] -checkout = git clone 'git@github.com:uvaes/passwords' '.passwords' - -[.zsh/zgen] -checkout = git clone 'https://github.com/tarjoilija/zgen' 'zgen' -skip = [ "$1" = push ] - -[.vim/vim-plug] -checkout = git clone 'https://github.com/junegunn/vim-plug' 'vim-plug' -skip = [ "$1" = push ] - -[.urxvt/ext] -checkout = git clone 'https://github.com/muennich/urxvt-perls' 'ext' -skip = [ "$1" = push ] - -[.mutt/solarized] -checkout = git clone 'https://github.com/altercation/mutt-colors-solarized' 'solarized' -skip = [ "$1" = push ] - -[.personal] -checkout = git clone 'git@github.com:uvaes/personal' '.personal' diff --git a/.mutt/Makefile b/.mutt/Makefile deleted file mode 100644 index a4b94ce..0000000 --- a/.mutt/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -HOME=/home/urbain -TARGETS=$(addprefix $(HOME)/,.mutt .mutt/temp .mutt/cache .mutt/cache/bodies) - -all : $(TARGETS) - -$(HOME)/.mutt : - rm -f $@ && ln -s $(PWD) $@ - -$(HOME)/.mutt/temp : - mkdir -p $@ - -$(HOME)/.mutt/cache : - mkdir -p $@ - -$(HOME)/.mutt/cache/bodies : - mkdir -p $@ - -clean : - rm -f $(TARGETS) diff --git a/.offlineimap/Makefile b/.offlineimap/Makefile deleted file mode 100644 index afb339c..0000000 --- a/.offlineimap/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -HOME=/home/urbain -TARGETS=$(HOME)/.offlineimaprc $(HOME)/.offlineimap.py - -all : $(TARGETS) - -$(HOME)/.offlineimaprc : - ln -s $(PWD)/offlineimaprc $@ - -$(HOME)/.offlineimap.py : - ln -s $(PWD)/offlineimap.py $@ - -clean : - rm -f $(TARGETS) diff --git a/.uzbl/Makefile b/.uzbl/Makefile deleted file mode 100644 index 1c45cec..0000000 --- a/.uzbl/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -HOME=/home/urbain -TARGETS=$(addprefix $(HOME)/,.config/uzbl .local/share/uzbl/bookmarks) - -all : $(TARGETS) - -$(HOME)/.config/uzbl : - rm -f $@ && ln -s $(PWD) $@ - -$(HOME)/.local/share/uzbl/bookmarks : - rm -f $@ && ln -s $(PWD)/bookmarks $@ - -clean : - rm -f $(TARGETS) diff --git a/.vim/Makefile b/.vim/Makefile deleted file mode 100644 index 6e07c30..0000000 --- a/.vim/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -HOME=/home/urbain -TARGETS=$(addprefix $(HOME)/,.vimrc .vim .vim/vimundo) - -all : $(TARGETS) - -$(HOME)/.vimrc : - rm -f $@ && ln -s $(PWD)/vimrc $@ - -$(HOME)/.vim : - rm -f $@ && ln -s $(PWD) $@ - -$(HOME)/.vim/vimundo : - mkdir -p $@ - -clean : - rm -f $(TARGETS) diff --git a/.zathura/Makefile b/.zathura/Makefile deleted file mode 100644 index c88ecfc..0000000 --- a/.zathura/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -HOME=/home/urbain -TARGET=$(HOME)/.config/zathura/zathurarc - -all : $(TARGET) - -$(HOME)/.config/zathura/zathurarc : - ln -sf $(PWD)/zathurarc $@ - -clean : - rm -f $(TARGET) diff --git a/.zathura/zathurarc b/.zathura/zathurarc deleted file mode 100644 index 543633d..0000000 --- a/.zathura/zathurarc +++ /dev/null @@ -1,2 +0,0 @@ -map scroll down -map scroll up diff --git a/.zathurarc b/.zathurarc new file mode 100644 index 0000000..543633d --- /dev/null +++ b/.zathurarc @@ -0,0 +1,2 @@ +map scroll down +map scroll up diff --git a/.zsh/Makefile b/.zsh/Makefile deleted file mode 100644 index 74a4bfc..0000000 --- a/.zsh/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -HOME=/home/urbain -TARGETS=$(addprefix $(HOME)/,.zsh .zshrc .zgen) - -all : $(TARGETS) - -$(HOME)/.zshrc : - rm -f $@ && ln -s $(PWD)/zshrc $@ - -$(HOME)/.zsh : - rm -f $@ && ln -s $(PWD) $@ - -$(HOME)/.zgen : $(PWD)/zgen - cp -r $(PWD)/zgen $@ - -clean : - rm -f $(HOME)/.zsh $(HOME)/.zshrc - rm -rf $(HOME)/.zgen diff --git a/Makefile b/Makefile deleted file mode 100644 index 0ee52ec..0000000 --- a/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -all : - ./bin/install - -clean : - ./bin/clean diff --git a/bin/dot b/bin/dot new file mode 100755 index 0000000..905e0c1 --- /dev/null +++ b/bin/dot @@ -0,0 +1,58 @@ +#!/usr/bin/env python + +import os +import sys +import yaml + +# Colors for terminal +from termcolor import colored + + +# Path of dotfiles +dotpath = '/home/urbain/dotfiles' + +# Load yaml configuration file +with open(dotpath + "/install.yaml", 'r') as stream: + config = yaml.load(stream) + +# Special symlinks +special_symlinks = set(config['special'].keys()) + +# All files in dir +normal_symlinks = set(os.listdir(dotpath)) - set(config['exclude']) + + +def perform(action): + + # Command to execute + command = config['commands'][action] + + for f in special_symlinks | normal_symlinks: + + # Print filename + print('[' + colored(f, 'green') + ']') + + if f in config['pre']: + print(config['pre'][f]) + os.system(config['pre'][f]) + + # Target of symlink + if f in special_symlinks: + t = config['special'][f] + elif f in normal_symlinks: + t = config['default'].format(file=f) + + if t != "": + # Formatted command + formatted = command.format(file=f, path=dotpath, target=t) + + # Print & execute command + print(formatted) + os.system(formatted) + + else: + print("Nothing to do!") + + print('\n') + +perform(sys.argv[1]) diff --git a/install.yaml b/install.yaml new file mode 100644 index 0000000..ee91571 --- /dev/null +++ b/install.yaml @@ -0,0 +1,47 @@ +exclude: + - '.personal' + - '.git' + - '.gitignore' + - 'install.yaml' + - 'README.md' + +# Commands to install / uninstall symlinks +commands: + up: rm -rf {target} && ln -s {path}/{file} {target} + down: rm -rf {target} + +# Default target +default: ~/{file} + +# Special targets +special: + + .i3: ~/.config/i3 + + .mr/mrconfig: ~/.mrconfig + .mr/mrtrust: ~/.mrtrust + + .offlineimap: "" + .offlineimap/offlineimaprc: ~/.offlineimaprc + .offlineimap/offlineimap.py: ~/.offlineimap.py + + .vim/.vimrc: ~/.vimrc + .zathurarc: ~/.config/zathura/zathurarc + + .zsh/zgen: ~/.zgen + .zsh/zshrc: ~/.zshrc + + .uzbl: ~/.config/uzbl + .uzbl/bookmarks: ~/.local/share/uzbl/bookmarks + + .passwords: ~/.password-store + +# Additional actions before symlink +pre: + .mutt: | + mkdir -p .mutt/temp + mkdir -p .mutt/cache + mkdir -p .mutt/bodies + + .vim: | + mkdir -p .vim/vimundo -- cgit v1.2.3