From b920816216cb161449dcf03ffe964c667c7b36c2 Mon Sep 17 00:00:00 2001 From: Urbain Vaes Date: Wed, 16 Sep 2015 15:38:58 +0100 Subject: Split install file --- install.sh | 105 ++++++++++--------------------------------------------------- 1 file changed, 16 insertions(+), 89 deletions(-) (limited to 'install.sh') diff --git a/install.sh b/install.sh index d165f5a..c06d497 100755 --- a/install.sh +++ b/install.sh @@ -1,101 +1,28 @@ -#!/bin/zsh +#! /bin/bash -HOME=/home/urbain -dotdir=$HOME/dotfiles +dotdir=/home/urbain/dotfiles -unset dotdirs install uninstall -declare -A dotdirs install uninstall -for file in `ls -A --ignore="install.sh" --ignore="README.md" --ignore=".git"`; do - dotdirs[$file]="$HOME/$file" - install[$file]='ln -s $dotdir/$file $(basename $dotdirs[$file])' - uninstall[$file]='rm -rf $dotdirs[$file]' -done - -install_offlineimap() { - ln -s $dotdir/.offlineimap/offlineimaprc .offlineimaprc - ln -s $dotdir/.offlineimap/offlineimap.py .offlineimap.py -} - -install_vim() { - ln -s $dotdir/.vim/vimrc .vimrc - ln -s $dotdir/.vim .vim - ln -s $dotdir/.vim/vimrc .nvimrc - ln -s $dotdir/.vim .nvim - - mkdir -p .vim/vimundo -} - -install_mutt() { - ln -s $dotdir/.mutt .mutt - mkdir -p .mutt/temp - mkdir -p .mutt/cache - mkdir -p .mutt/cache/bodies -} - -install_zsh() { - ln -s $dotdir/.zsh/zshrc .zshrc - ln -s $dotdir/.zsh .zsh -} - -install_uzbl() { - ln -s $dotdir/.uzbl uzbl - cd $HOME/.local/share/uzbl - ln -s $dotdir/.uzbl/bookmarks bookmarks -} - -uninstall_offlineimap() { - rm -f .offlineimaprc - rm -f .offlineimap.py -} - -uninstall_vim() { - rm -rf .vim .vimrc .nvim .nvimrc -} - -uninstall_zsh() { - rm -rf .zsh .zshrc -} - -uninstall_uzbl() { - rm -rf uzbl - rm -f $HOME/.local/share/uzbl/bookmarks +install_dotfiles() { + for file in `ls -A --ignore="install.sh" --ignore="README.md" --ignore=".git*"`; do + if [[ -f $file/Makefile ]]; then + cd $file && make && cd $dotdir + else + rm -f $HOME/$file && ln -s $dotdir/$file $HOME/$file + fi + done } -dotdirs[.uzbl]="$HOME/.config/uzbl" -dotdirs[.zathurarc]="$HOME/.config/zathura/zathurarc" - -install[.offlineimap]='install_offlineimap' -install[.vim]='install_vim' -install[.mutt]='install_mutt' -install[.zsh]='install_zsh' -install[.uzbl]='install_uzbl' - -uninstall[.offlineimap]='uninstall_offlineimap' -uninstall[.vim]='uninstall_vim' -uninstall[.zsh]='uninstall_zsh' -uninstall[.uzbl]='uninstall_uzbl' clean_dotfiles() { - for file in ${(@k)dotdirs}; do - echo "Cleaning $file" - cd $(dirname $dotdirs[$file]) - eval ${uninstall[$file]} + for file in `ls -A --ignore="install.sh" --ignore="README.md" --ignore=".git*"`; do + if [[ -f $file/Makefile ]]; then + cd $file && make clean && cd $dotdir + else + rm -f $HOME/$file + fi done } -install_dotfiles() { - for file in ${(@k)dotdirs}; do - echo "Installing $file" - cd $(dirname $dotdirs[$file]) - eval ${install[$file]} - done -} - -function install_packages { - sudo apt-get install ttyrec mutt msmtp offlineimap wmctrl rxvt-unicode-256color \ - tmux git gcc clang cmake make zathura feh chromium-browser zsh clang xcape -} - clean_dotfiles install_dotfiles -- cgit v1.2.3