dotfiles/run_once_after_50_clone-rep...

42 lines
1.3 KiB
Bash
Raw Normal View History

2021-02-15 21:20:53 -05:00
#! /bin/bash
## This script pulls all my git repos that I use in my config. It will only pull
## them if they don't exist. Rather than use the import approach suggested in
## the chezmoi howto, this doesn't require me to keep 'syncing' changes when I
## work in these repos directly. The tradeoff is that it will only pull the
## latest master, which is totally fine with me.
2021-02-15 21:20:53 -05:00
clone_maybe () {
2021-02-15 21:26:15 -05:00
if [ ! -d "$2" ]; then
2021-02-15 21:20:53 -05:00
echo cloning git repo: "$1"
git clone --recurse-submodules "$1" "$2"
else
echo git repo already exists: "$1"
fi
}
run_stack_in_dir () {
2021-03-13 18:19:17 -05:00
local cur
cur="$(pwd)"
cd "$1" || return 1
stack install
cd "$cur" || return 1
}
export STACK_ROOT="$XDG_DATA_HOME"/stack
2021-02-15 21:26:15 -05:00
clone_maybe https://github.com/ndwarshuis/conky.git "$HOME/.config/conky"
2021-02-15 21:20:53 -05:00
clone_maybe https://github.com/ndwarshuis/.emacs.d.git "$HOME/.config/emacs"
rofix_dir="$HOME/.config/rofi-extras"
clone_maybe https://github.com/ndwarshuis/rofi-extras.git "$rofix_dir"
run_stack_in_dir "$rofix_dir"
xman_dir="$HOME/.config/xman"
clone_maybe https://github.com/ndwarshuis/xman.git "$xman_dir"
run_stack_in_dir "$xman_dir"
xmonad_dir="$HOME/.config/xmonad"
clone_maybe https://github.com/ndwarshuis/xmonad-config.git "$xmonad_dir"
run_stack_in_dir "$xmonad_dir"