-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
75 lines (60 loc) · 2.62 KB
/
install.sh
File metadata and controls
75 lines (60 loc) · 2.62 KB
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
#!/usr/bin/env bash
set -e
echo "🙏 Deep breaths, everything will (probably) be fine!"
echo ""
# location of the *full repo* (defaults to ~/.dotfiles)
DOTFILES="${DOTFILES:-"$HOME/.dotfiles"}"
# location of this script (should be right next to all the other files, but we handle that next if it's not)
INSTALLER_PATH="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
# if this is a codespace, link automatically cloned dotfiles repo to the expected DOTFILES
# https://docs.github.com/en/codespaces/troubleshooting/troubleshooting-personalization-for-codespaces#troubleshooting-dotfiles
if [[ "$CODESPACES" = "true" ]] && [[ -d /workspaces/.codespaces/.persistedshare/dotfiles ]]; then
ln -sf /workspaces/.codespaces/.persistedshare/dotfiles "$DOTFILES"
fi
# # clone this repo if this script is all by itself and/or we're not in the expected location
if [[ "$INSTALLER_PATH" != "$DOTFILES" ]] && [[ ! -d "$DOTFILES" ]]; then
git clone https://github.com/filoupegase/dotfiles.git "$DOTFILES"
echo "Successfully cloned the full repo to '$DOTFILES'"
echo "Run install.sh from that directory to continue. Exiting now..."
exit 0
fi
# set up symlinks from various default paths to files in this repo
if [[ ! -d ~/.config ]]; then
mkdir -p ~/.config
fi
if [[ ! -d ~/.ssh ]]; then
mkdir -p ~/.ssh && chmod 700 ~/.ssh
fi
ln -sf "$DOTFILES/zsh/.zshrc" ~/.zshrc
ln -sf "$DOTFILES/zsh/.zprofile" ~/.zprofile
ln -sf "$DOTFILES/bash/.bash_profile" ~/.bash_profile
ln -sf "$DOTFILES/ssh/.ssh/config" ~/.ssh/config
ln -sf "$DOTFILES/git/.gitconfig" ~/.gitconfig
ln -sf "$DOTFILES/git/.gitignore_global" ~/.gitignore
ln -sf "$DOTFILES/starship/config.toml" ~/.config/starship.toml
ln -sf "$DOTFILES/vim/.vimrc" ~/.vimrc
# this file will be sourced by .zshrc for more sensitive variables/settings
touch ~/.zshrc.local
# prepare zinit manually
ZINIT_HOME="${ZINIT_HOME:-"${XDG_DATA_HOME:-"${HOME}/.local/share"}/zinit/zinit.git"}"
if [[ ! -d "$ZINIT_HOME" ]]; then
mkdir -p "$(dirname "$ZINIT_HOME")"
git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
fi
# the remainder of the setup tasks are OS-specific
if [[ "$OSTYPE" = darwin* ]]; then
ln -sf "$DOTFILES/Brewfile" ~/Brewfile
# suppress terminal login banners
touch ~/.hushlogin
# disable bash session restoration
touch ~/.bash_sessions_disable
source "$DOTFILES/macos/macos.sh"
elif [[ "$OSTYPE" = linux-gnu* ]] && [[ -z "$CODESPACES" ]]; then
source "$DOTFILES/linux/linux.sh"
else
echo "I don't recognize this OS... skipping extra steps."
fi
# wow
echo ""
echo "🤯 It actually worked!"
echo "Log out and log back in (or just restart) to finish installing all ZSH features."