-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·103 lines (81 loc) · 3.2 KB
/
install.sh
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/usr/bin/env zsh
NODE_VERSION=$(cat home/.node-version)
NPM_GLOBAL_PACKAGES=(chrome-remote-interface@0.33.2 zx@8.1.8)
if uname | grep >/dev/null Darwin; then
echo "Detected Darwin"
export IS_MACOS=true
fi
if uname -a | grep >/dev/null -- -rpi- || grep &>/dev/null -i "raspberry pi" /sys/firmware/devicetree/base/model; then
echo "Detected raspi"
export IS_RASPI=true
fi
if [[ ! -z "$IS_MACOS" ]]; then
echo "Attempting to use GNU coreutils path on macOS"
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
fi
echo -n "Installing home dir files..."
cp -prsT --update=none $(realpath home)/ ~/
mkdir -p ~/.vim/backups ~/.vim/swaps ~/.vim/undo
echo "Done"
echo -n "Installing base16-shell..."
ln -fnsT $(realpath base16-shell) ~/.config/base16-shell
echo "Done"
echo -n "Installing vim-pathogen..."
mkdir -p ~/.vim/autoload ~/.vim/bundle
ln -fnsT $(realpath vim-pathogen/autoload/pathogen.vim) ~/.vim/autoload/pathogen.vim
echo "Done"
echo -n "Installing vim-plug..."
mkdir -p ~/.local/share/nvim/site/autoload
ln -fnsT $(realpath vim-plug/plug.vim) ~/.local/share/nvim/site/autoload/plug.vim
echo "Done"
echo -n "Setting up fnm/npm..."
zsh -i -c "fnm install $NODE_VERSION && fnm use $NODE_VERSION && npm i -g $NPM_GLOBAL_PACKAGES"
echo "Done"
if [[ -z "$IS_RASPI" ]]; then
echo -n "Setting up Rust..."
rustup install stable && rustup default stable && rustup component add rls-preview rust-analysis rust-src rustfmt && cargo install --locked prcs cargo-insta cargo-outdated cargo-watch cross
echo "Done"
fi
echo -n "Setting up vim..."
nvim -c 'PlugInstall' -c "source $(realpath snapshot.vim)" -c 'VimProcInstall' -c 'qa!'
echo "Done"
if [[ ! -z "$IS_MACOS" ]]; then
echo -n "Downloading grml-zsh-config..."
if [[ ! -d ~/.grml.zsh ]]; then
curl -L > ~/.grml.zsh https://git.grml.org/f/grml-etc-core/etc/zsh/zshrc
fi
echo "Done"
if [[ ! -d ~/.powerlevel10k ]]; then
echo -n "Downloading powerlevel10k..."
git clone https://github.com/romkatv/powerlevel10k ~/.powerlevel10k
echo "Done"
fi
echo -n "Linking VSCode files..."
mkdir -p "$HOME/Library/Application Support/Code/User"
ln -fst "$HOME/Library/Application Support/Code/User" ~/.config/Code/User/*
echo "Done"
echo -n "Running list exports once..."
npm ls -g --depth=0 2>/dev/null >$HOME/docs/tech/npm-global-list/$HOST.txt
PKG_LIST=$HOME/docs/tech/pkg-list/$HOST.txt
brew list >$PKG_LIST
echo >>$PKG_LIST
brew cask list >>$PKG_LIST
ls $HOME/.vscode/extensions/ >$HOME/docs/tech/vscode-ext-list/$HOST.txt
echo "Done"
fi
if [[ "$1" == "-a" ]] && uname | grep >/dev/null Linux; then
echo -n "Installing systemd files..."
sudo cp -prT $(realpath systemd)/ /etc/systemd/
echo "Done"
echo -n "Installing udev files..."
sudo cp -prT $(realpath udev)/ /etc/udev/
echo "Done"
fi
DANGLING_SYMLINKS_CMD='find ~ -maxdepth 4 -xtype l ! -path "*/.config/BraveSoftware/*" ! -path "*/.thunderbird/*" ! -path "*/.config/discord/*" ! -path "*/.config/Signal/*" ! -path "*/.mozilla/firefox/*" ! -path "*/.steampath"'
DANGLING_SYMLINKS=`eval $DANGLING_SYMLINKS_CMD`
if [ -n "$DANGLING_SYMLINKS" ]; then
echo "Dangling symlinks:"
echo $DANGLING_SYMLINKS
echo "To remove, use:"
echo "$DANGLING_SYMLINKS_CMD -delete"
fi