rice

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

commit a7d77b6d0f361604cf980e196c8d0486e055b3f7
parent ae1266f36bd5a74363fff301407a91d0dc0d1044
Author: Mark Feller <mfeller@squareup.com>
Date:   Mon, 15 Aug 2022 14:21:14 -0600

combine copy and copy_file in the install script

Diffstat:
Minstall | 100++++++++++++++++++++++++++++++++++++-------------------------------------------
1 file changed, 46 insertions(+), 54 deletions(-)

diff --git a/install b/install @@ -2,79 +2,71 @@ rice_dir=$HOME/.config/rice -copy() -{ - printf "%-30s %s\n" "$1" "$2/$(basename $1)" - cp -r "$1" "$2" +copy() { + printf "%-30s %s\n" "$1" "$2/$(basename $1)" + if test -d "$1"; then + cp -r "$1" "$2" + else + cp "$1" "$2" + fi } -copy_file() -{ - printf "%-30s %s\n" "$1" "$2/$(basename $1)" - cp "$1" "$2" +shared() { + # Dotfiles used on all operating systems + copy dots/.config/emacs $HOME/.config + copy dots/.config/lf $HOME/.config + copy dots/.config/zsh $HOME/.config + copy dots/.config/aliasrc $HOME/.config + copy dots/.local/bin $HOME/.local } -shared() -{ - # Dotfiles used on all operating systems - copy dots/.config/emacs $HOME/.config - copy dots/.config/lf $HOME/.config - copy dots/.config/zsh $HOME/.config - copy dots/.config/aliasrc $HOME/.config - copy dots/.local/bin $HOME/.local -} - -linux() -{ - # Linux specific dotfiles - copy dots/.ssh/config $HOME/.ssh - copy dots/.config/compton $HOME/.config - copy dots/.config/dunst $HOME/.config - copy dots/.config/git/config.linux $HOME/.config/git/config - copy dots/.config/mpd $HOME/.config - copy dots/.config/ncmpcpp $HOME/.config - copy dots/.config/notmuch $HOME/.config - copy dots/.config/offlineimap $HOME/.config - copy dots/.config/mimeapps.list $HOME/.config - copy dots/.config/vis $HOME/.config - copy dots/.config/x11 $HOME/.config +linux() { + # Linux specific dotfiles + copy dots/.ssh/config $HOME/.ssh + copy dots/.config/compton $HOME/.config + copy dots/.config/dunst $HOME/.config + copy dots/.config/git/config.linux $HOME/.config/git/config + copy dots/.config/mpd $HOME/.config + copy dots/.config/ncmpcpp $HOME/.config + copy dots/.config/notmuch $HOME/.config + copy dots/.config/offlineimap $HOME/.config + copy dots/.config/mimeapps.list $HOME/.config + copy dots/.config/vis $HOME/.config + copy dots/.config/x11 $HOME/.config - copy_file dots/.local/share/gnupg/gpg-agent.conf.linux $HOME/.local/share/gnupg/gpg-agent.conf - copy_file dots/.local/share/emacs/signature.linux $HOME/.local/share/emacs/signature + copy dots/.local/share/gnupg/gpg-agent.conf.linux $HOME/.local/share/gnupg/gpg-agent.conf + copy dots/.local/share/emacs/signature.linux $HOME/.local/share/emacs/signature } -macos() -{ - # macOS specific dotfiles - copy dots/.config/alacritty $HOME/.config - copy dots/.config/git/config.macos $HOME/.config/git/config - copy dots/.zshenv $HOME +macos() { + # macOS specific dotfiles + copy dots/.config/git/config.macos $HOME/.config/git/config + copy dots/.zshenv $HOME - copy_file dots/.local/share/gnupg/gpg-agent.conf.macos $HOME/.local/share/gnupg/gpg-agent.conf - copy_file dots/.local/share/emacs/signature.macos $HOME/.local/share/emacs/signature + copy dots/.local/share/gnupg/gpg-agent.conf.macos $HOME/.local/share/gnupg/gpg-agent.conf + copy dots/.local/share/emacs/signature.macos $HOME/.local/share/emacs/signature } -openbsd() -{ - return +openbsd() { + return } if [ -d "$rice_dir" ]; then - cd "$rice_dir" - # git pull --ff-only + cd "$rice_dir" + # git pull --ff-only else - mkdir -p ~/.config - git clone https://github.com/mjfeller/rice "$rice_dir" + mkdir -p ~/.config + git clone https://github.com/mjfeller/rice "$rice_dir" fi if [ ! -d ~/.ssh ]; then - mkdir ~/.ssh + mkdir ~/.ssh fi cd "$rice_dir" case "$(uname -s)" in - Linux*) shared; linux ;; - Darwin*) shared; macos ;; - OpenBSD*) shared; openbsd ;; - *) echo "Could not detect OS"; exit 1 ;; + Linux*) shared; linux ;; + Darwin*) shared; macos ;; + OpenBSD*) shared; openbsd ;; + *) echo "Could not detect OS"; exit 1 ;; esac