rice

personal dot files and scripts for linux and macOS
Log | Files | Refs | README | LICENSE

install (2067B)


      1 #!/bin/sh -e
      2 
      3 rice_dir=$HOME/.config/rice
      4 
      5 copy() {
      6     printf "%-30s %s\n" "$1" "$2/$(basename $1)"
      7     if test -d "$1"; then
      8         cp -r "$1" "$2"
      9     else
     10         cp "$1" "$2"
     11     fi
     12 }
     13 
     14 shared() {
     15     # Dotfiles used on all operating systems
     16     copy dots/.config/emacs    $HOME/.config
     17     copy dots/.config/lf       $HOME/.config
     18     copy dots/.config/zsh      $HOME/.config
     19     copy dots/.config/aliasrc  $HOME/.config
     20     copy dots/.local/bin       $HOME/.local
     21 }
     22 
     23 linux() {
     24     # Linux specific dotfiles
     25     copy dots/.ssh/config               $HOME/.ssh
     26     copy dots/.config/compton           $HOME/.config
     27     copy dots/.config/dunst             $HOME/.config
     28     copy dots/.config/git/config.linux  $HOME/.config/git/config
     29     copy dots/.config/mpd               $HOME/.config
     30     copy dots/.config/ncmpcpp           $HOME/.config
     31     copy dots/.config/notmuch           $HOME/.config
     32     copy dots/.config/offlineimap       $HOME/.config
     33     copy dots/.config/mimeapps.list     $HOME/.config
     34     copy dots/.config/vis               $HOME/.config
     35     copy dots/.config/x11               $HOME/.config
     36 
     37     copy dots/.local/share/gnupg/gpg-agent.conf.linux  $HOME/.local/share/gnupg/gpg-agent.conf
     38     copy dots/.local/share/emacs/signature.linux       $HOME/.local/share/emacs/signature
     39 }
     40 
     41 macos() {
     42     # macOS specific dotfiles
     43     copy dots/.config/git/config.macos  $HOME/.config/git/config
     44     copy dots/.zshenv                   $HOME
     45 
     46     copy dots/.local/share/gnupg/gpg-agent.conf.macos  $HOME/.local/share/gnupg/gpg-agent.conf
     47     copy dots/.local/share/emacs/signature.macos       $HOME/.local/share/emacs/signature
     48 }
     49 
     50 openbsd() {
     51     return
     52 }
     53 
     54 if [ -d "$rice_dir" ]; then
     55     cd "$rice_dir"
     56     git pull --ff-only
     57 else
     58     mkdir -p ~/.config
     59     git clone https://github.com/mjfeller/rice "$rice_dir"
     60 fi
     61 
     62 if [ ! -d ~/.ssh ]; then
     63     mkdir ~/.ssh
     64 fi
     65 
     66 cd "$rice_dir"
     67 case "$(uname -s)" in
     68     Linux*)   shared; linux ;;
     69     Darwin*)  shared; macos ;;
     70     OpenBSD*) shared; openbsd ;;
     71     *)        echo "Could not detect OS"; exit 1 ;;
     72 esac