1
1
Fork 0

setup.sh: Clean up a little

This commit is contained in:
Jonathan Schleifer 2020-08-30 12:03:32 +00:00
parent 2ded84d157
commit 9c142c87b6

View file

@ -2,6 +2,10 @@
rel_dir="${PWD#$HOME/}" rel_dir="${PWD#$HOME/}"
echo "Configs relative to home in $rel_dir." echo "Configs relative to home in $rel_dir."
have() {
which $1 >/dev/null 2>&1
}
link_file() { link_file() {
if [ ! -e "$HOME/$2" ]; then if [ ! -e "$HOME/$2" ]; then
echo "Symlinking $HOME/$2 -> $3$rel_dir/$1" echo "Symlinking $HOME/$2 -> $3$rel_dir/$1"
@ -12,32 +16,32 @@ link_file() {
} }
mkdir -p $HOME/.config mkdir -p $HOME/.config
which cvs >/dev/null 2>&1 && link_file cvsrc .cvsrc have cvs && link_file cvsrc .cvsrc
which fish >/dev/null 2>&1 && link_file fish .config/fish ../ have fish && link_file fish .config/fish ../
if which fossil >/dev/null 2>&1; then if have fossil; then
echo "Setting global fossil settings…" echo "Setting global fossil settings…"
fossil set --global autosync 0 fossil set --global autosync 0
fossil set --global editor 'vim -c "se ft=gitcommit"' fossil set --global editor 'vim -c "se ft=gitcommit"'
fossil set --global mv-rm-files 1 fossil set --global mv-rm-files 1
gpg_args="-u 35E1AF8B --clearsign -o" gpg_args="-u 35E1AF8B --clearsign -o"
if which gpg2 >/dev/null 2>&1; then if have gpg2; then
fossil set --global clearsign 1 fossil set --global clearsign 1
fossil set --global pgp-command "gpg2 $gpg_args" fossil set --global pgp-command "gpg2 $gpg_args"
elif which gpg >/dev/null 2>&1; then elif have gpg; then
fossil set --global clearsign 1 fossil set --global clearsign 1
fossil set --global pgp-command "gpg $gpg_args" fossil set --global pgp-command "gpg $gpg_args"
fi fi
fi fi
which git >/dev/null 2>&1 && link_file git .config/git ../ have git && link_file git .config/git ../
if which gpg >/dev/null 2>&1 || which gpg2 >/dev/null 2>&1; then if have gpg || have gpg2; then
mkdir -p $HOME/.local/share/gnupg mkdir -p $HOME/.local/share/gnupg
link_file gpg.conf .local/share/gnupg/gpg.conf ../../../ link_file gpg.conf .local/share/gnupg/gpg.conf ../../../
fi fi
which tmux >/dev/null 2>&1 && link_file tmux .config/tmux ../ have tmux && link_file tmux .config/tmux ../
which vim >/dev/null 2>&1 && link_file vim .config/vim ../ have vim && link_file vim .config/vim ../
which youtube-dl >/dev/null 2>&1 && link_file youtube-dl .config/youtube-dl ../ have youtube-dl && link_file youtube-dl .config/youtube-dl ../
which zsh >/dev/null 2>&1 && link_file zshrc .zshrc have zsh && link_file zshrc .zshrc
if test x"$(uname -s)" = x"Darwin"; then if test x"$(uname -s)" = x"Darwin"; then
dest="$HOME/Library/Keyboard Layouts/eu_US.keylayout" dest="$HOME/Library/Keyboard Layouts/eu_US.keylayout"
@ -48,7 +52,7 @@ if test x"$(uname -s)" = x"Darwin"; then
else else
echo "$dest already exists, skipping…" echo "$dest already exists, skipping…"
fi fi
elif which startx >/dev/null 2>&1; then elif have startx; then
link_file Xdefaults .Xdefaults link_file Xdefaults .Xdefaults
link_file Xmodmap .Xmodmap link_file Xmodmap .Xmodmap
link_file xinitrc .xinitrc link_file xinitrc .xinitrc