diff options
Diffstat (limited to 'install.sh')
-rwxr-xr-x | install.sh | 158 |
1 files changed, 2 insertions, 156 deletions
@@ -4,120 +4,6 @@ home=/home/urbain dir=$home/dotfiles olddir=$home/dotfiles_old -declare -A repodirs -repodirs[alols/xcape]=$home/xcape -repodirs[Anthony25/gnome-terminal-colors-solarized]=$home/github/gnome-terminal-colors-solarized -repodirs[altercation/mutt-colors-solarized]=$home/github/mutt-colors-solarized -repodirs[seebi/dircolors-solarized]=$home/github/dircolors-solarized -repodirs[uvaes/fzf-marks]=$home/github/fzf-marks -repodirs[atweiden/fzf-extras]=$home/github/fzf-extras -repodirs[rupa/z]=$home/github/z -repodirs[junegunn/fzf]=$home/.fzf -repodirs[icholy/ttygif]=$home/github/ttygif -repodirs[tmux-plugins/tpm]=$home/.tmux/plugins/tpm -repodirs[junegunn/vim-plug]=$dir/vim/vim-plug -repodirs[tarjoilija/zgen]=$home/.zgen - -function after_vimplug { - cd .. - rm -rf autoload - mkdir -p autoload - cd autoload - ln -s ../vim-plug/plug.vim; -} - -declare -A actions -actions[Anthony25/gnome-terminal-colors-solarized]='' -actions[alols/xcape]='make' -actions[altercation/mutt-colors-solarized]='' -actions[icholy/ttygif]='make' -actions[junegunn/fzf]='./install' -actions[rupa/z]='make' -actions[atweiden/fzf-extras]='' -actions[junegunn/vim-plug]='after_vimplug' -actions[seebi/dircolors-solarized]='' -actions[tmux-plugins/tpm]='' -actions[uvaes/fzf-marks]='' - -function fetch_repo { - cd $1 - echo "Fetching origin of git repository stored in $1 ..." - git fetch -q origin master -} - -function clone_repo { - githubDir=https://github.com/$1 - echo "Cloning $repo in $2" - git clone -q $githubDir $2 - cd $2 -} - -function waitjobs { - for job in `jobs -p` - do - wait $job - done -} - -function install_repos { - echo -e "\n*** \e[1mInstalling git repositories\e[0m ***" - - for repo in "${!repodirs[@]}"; do - - repodir=${repodirs[$repo]} - action=${actions[$repo]} - - if [ ! -d $repodir ]; then - clone_repo $repo $repodir $action & - else - echo -e "\e[0mRepository $repo already installed in ${repodir}.\e[0m" - fi - done - waitjobs - echo "--> Done!"; echo - - echo -e "*** \e[1mExectutiong actions after installation\e[0m ***" - for repo in "${!repodirs[@]}"; do - cd ${repodirs[$repo]} - eval ${actions[$repo]} - done -} - -function update_repos { - echo -e "\n*** \e[1mUpdating git repositories\e[0m ***" - - for repo in "${!repodirs[@]}"; do - - repodir=${repodirs[$repo]} - - if [ -d $repodir ]; then - fetch_repo $repodir & - fi - done - - waitjobs - echo "--> Done!"; echo - - for repo in "${!repodirs[@]}"; do - - repodir=${repodirs[$repo]} - - if [ -d $repodir ]; then - cd $repodir - echo "Merging upstream updates of git repository stored in ${repo}..." - cat <(git log --reverse --pretty=format:"-- %h %s (%cr)" -4); echo -e "\e[36m" - output=$(git log HEAD..origin) - if [[ ! -z $output ]]; then - cat <(git log --reverse --pretty=format:"-- %h %s (%cr)" HEAD..origin); echo -e "\e[0m" - else - echo -e "-- No updates since last pull\e[0m" - fi - git merge -q origin/master - echo - fi - done -} - function install_dotfiles { echo -e "\n*** \e[1mInstalling dotfiles\e[0m ***" @@ -145,12 +31,6 @@ function install_dotfiles { } function clean { - echo -e "\n*** \e[1mCleaning repositories\e[0m ***" - for repo in "${!repodirs[@]}"; do - echo "Cleaning $repo in ${repodirs[$repo]}" - rm -rf ${repodirs[$repo]} - done - echo -e "\n*** \e[1mCleaning dotfiles\e[0m ***" for file in `ls`; do rm -rfv ~/.$file @@ -180,39 +60,5 @@ function update_dotfiles { fi } -if [[ $# = 0 ]]; then - update_dotfiles - install_dotfiles - update_repos -fi - -while [[ $# > 0 ]] -do - key="$1" - case $key in - -d|--dotfiles) - install_dotfiles - ;; - -i|--repositories) - install_repos - ;; - -u|--repositories) - update_repos - ;; - -p|--packages) - install_packages - ;; - -c|--clean) - clean - ;; - -a|--all) - clean - install_dotfiles - install_repos - update_repos - ;; - *) - ;; - esac - shift -done +update_dotfiles +install_dotfiles |