-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·92 lines (70 loc) · 2.51 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·92 lines (70 loc) · 2.51 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env bash
set -euo pipefail
DOTFILES="$PWD"
BOLD=$(tput bold)
NORMAL=$(tput sgr0)
line=$(printf '%.0s-' {1..40})
function printHeadline { echo -e "\n\n${line}\n${BOLD}$1${NORMAL}\n${line}"; }
function printBold { echo "${BOLD}$1${NORMAL}"; }
function link {
printf "%-50s" "$3"
if ln -sf "$1" "$2" 2>/dev/null; then
printf " - ${BOLD}Done${NORMAL}\n"
else
printf " - ${BOLD}Link exists${NORMAL}\n"
fi
}
### Git check ###
if [ ! -d ".git" ]; then
printBold "No git repository found! Clone the repo first. Exiting."
exit 1
fi
### Welcome ###
printBold "WELCOME TO TIMMY THE TINY INSTALLER, HAVE A NICE STAY! <3"
printf "Ready"; sleep 1
printf " Set"; sleep 0.25
for (( i=0; i<=4; i++ )); do sleep 0.25; printf "."; done
printf " ${BOLD}BAKE!${NORMAL}\n"; sleep 1
### Common dirs ###
USER_CONFIG="$HOME/.config"
mkdir -p "$HOME/code" "$HOME/clones" "$USER_CONFIG"
### Create default configs if not present ###
cp "$DOTFILES/starship/starship-gruvbox-dark.toml" "$DOTFILES/starship/starship.toml" 2>/dev/null || true
cp "$DOTFILES/ghostty/config-gruvbox-dark" "$DOTFILES/ghostty/config" 2>/dev/null || true
### Symlinks ###
printHeadline "Linking stuff!"
ZSH="$DOTFILES/zsh"
TMUX="$DOTFILES/tmux"
TMUXREPO="$TMUX/tmux_gpakosz"
TPM="$TMUX/tpm"
[ -f "$HOME/.zshrc" ] && [ ! -f "$HOME/.zshrc.pre-dotfiles" ] && mv "$HOME/.zshrc" "$HOME/.zshrc.pre-dotfiles"
link "$ZSH/.zshrc" "$HOME/.zshrc" "Linking .zshrc"
link "$TMUXREPO/.tmux.conf" "$HOME/.tmux.conf" "Linking TMUX config"
link "$TMUX/.tmux.conf.local" "$HOME/.tmux.conf.local" "Linking local TMUX config"
link "$DOTFILES/nvim" "$USER_CONFIG/nvim" "Linking NVIM config"
link "$DOTFILES/starship/starship.toml" "$USER_CONFIG/starship.toml" "Linking Starship config"
mkdir -p "$HOME/.tmux/plugins/tpm"
link "$TPM" "$HOME/.tmux/plugins/tpm" "Linking TPM"
if command -v ghostty >/dev/null 2>&1; then
mkdir -p "$USER_CONFIG/ghostty"
link "$DOTFILES/ghostty/config" "$USER_CONFIG/ghostty/config" "Linking Ghostty config"
fi
### OS-specific install ###
case "$(uname)" in
Darwin)
printHeadline "macOS detected"
# shellcheck source=packages/macos/install.sh
source "$DOTFILES/packages/macos/install.sh"
;;
Linux)
printHeadline "Linux detected"
# shellcheck source=packages/linux/install.sh
source "$DOTFILES/packages/linux/install.sh"
;;
*)
echo "Unsupported OS, exiting"
exit 1
;;
esac
### Goodbye ###
printBold "Thank you, come again!"