~charles/dotfiles

dotfiles/install-full.sh -rwxr-xr-x 2.1 KiB
ca364fe3Charles Daniels add oshrc 11 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/sh

check_prog() {
	if [ ! -x "$(which "$1")" ] ; then
		echo "ERROR: could not find '$1' in PATH" 1>&2
		exit 1
	fi
}

set -u

check_prog curl

# install overlay
cd "$(dirname "$0")"
DOTFILES_DIR="$(pwd)"
OVERLAY_DIR="$DOTFILES_DIR/overlay.full"
DEST_DIR="$HOME"

mkdir -p ~/.vimbak

cd "$OVERLAY_DIR"

find -L . -type f | while read -r target ; do
	target_relparent="$(dirname "$target")"
	dest_parent="$DEST_DIR/$target_relparent"
	dest_file="$DEST_DIR/$target"
	rm -f "$dest_file"
	mkdir -p "$dest_parent"
	cp "$target" "$dest_file"
	chmod "$(stat -L -c "%a" "$target")" "$dest_file"
done

# setup gitconfig
git_username="$(git config --get user.name)"
git_email="$(git config --get user.email)"
git_config_file="$HOME/.gitconfig"
rm -f "$git_config_file"
echo '[user]' >> "$git_config_file"
echo "    name = $git_username" >> "$git_config_file"
echo "    email = $git_email" >> "$git_config_file"
echo "" >> "$git_config_file"
cat "$DOTFILES_DIR/gitconfig" >> "$git_config_file"


# vim-plug
curl -SsfLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
curl -SsfLo ~/.vim/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

# packer.nvim
if [ ! -e  ~/.local/share/nvim/site/pack/packer/start/packer.nvim ] ; then
	git clone https://github.com/wbthomason/packer.nvim \
	    ~/.local/share/nvim/site/pack/packer/start/packer.nvim
fi


# Eisvogel
if [ ! -e "$HOME/.pandoc/templates/eisvogel.tex" ] ; then
	mkdir -p "$HOME/.pandoc/templates"
	curl -LSs "https://raw.githubusercontent.com/Wandmalfarbe/pandoc-latex-template/master/eisvogel.tex" > "$HOME/.pandoc/templates/eisvogel.tex"
	curl -LSs "https://raw.githubusercontent.com/Wandmalfarbe/pandoc-latex-template/master/eisvogel.tex" > "$HOME/.pandoc/templates/eisvogel.latex"
fi

# Detect if we are on the Framework and do HiDPI stuff if so
FRAMEWORK=NO
if lsusb | grep -q 27c6:609c ; then
	FRAMEWORK=YES
fi

if [ "$FRAMEWORK" = "YES" ] ; then
	echo "Xcursor.size: 32" >> ~/.Xresources
fi

xrdb merge ~/.Xresources

BIN_DIR="$DEST_DIR/bin" ../utils/install.sh

exit 0