irongit

fix: fzf checks for ~/.fzf

huncholanehuncholaneauthored
parent fb8e936commit 678aee713905101877a99c849465b6db886c1bbaBrowse files

1 file changed, +57 -55

+57-55install.sh
@@ -5,34 +5,34 @@ mkdir -p "$STORAGE"
55
66 # Select installer
77 if command -v pacman &>/dev/null; then
8- INSTALL='sudo pacman -S --noconfirm'
8+ INSTALL='sudo pacman -S --noconfirm'
99 elif command -v apt &>/dev/null; then
10- INSTALL='sudo apt install -y'
10+ INSTALL='sudo apt install -y'
1111 elif command -v dnf &>/dev/null; then
12- INSTALL='sudo dnf install -y'
12+ INSTALL='sudo dnf install -y'
1313 elif command -v brew &>/dev/null; then
14- INSTALL='brew install'
14+ INSTALL='brew install'
1515 fi
1616 echo "Using $INSTALL for installations"
1717
1818 # Pass in command to invoke and installation name
1919 install() {
20- if ! command -v "$1" &>/dev/null; then
21- echo -e "\e[33mInstalling $1 using '$INSTALL $2'\e[0m"
22- $INSTALL $2
23- else
24- echo -e "\e[32m$1 is already installed. Skipping.\e[0m"
25- fi
20+ if ! command -v "$1" &>/dev/null; then
21+ echo -e "\e[33mInstalling $1 using '$INSTALL $2'\e[0m"
22+ $INSTALL $2
23+ else
24+ echo -e "\e[32m$1 is already installed. Skipping.\e[0m"
25+ fi
2626 }
2727
2828 # Pass in command to invoke and installation command
2929 custominstall() {
30- if ! command -v "$1" &>/dev/null; then
31- echo -e "\e[33mInstalling $1 using $2\e[0m"
32- eval "$2"
33- else
34- echo -e "\e[32m$1 is already installed. Skipping.\e[0m"
35- fi
30+ if ! command -v "$1" &>/dev/null; then
31+ echo -e "\e[33mInstalling $1 using $2\e[0m"
32+ eval "$2"
33+ else
34+ echo -e "\e[32m$1 is already installed. Skipping.\e[0m"
35+ fi
3636 }
3737
3838 # Install useful tools
@@ -42,75 +42,77 @@ install nvim neovim
4242 install tmux tmux
4343 install hostname inetutils
4444 if command -v pacman &>/dev/null; then
45- install gh github-cli
45+ install gh github-cli
4646 else
47- install gh gh
47+ install gh gh
4848 fi
4949 install crontab cronie
5050 if command -v systemctl &>/dev/null; then
51- sudo systemctl enable --now cronie
51+ sudo systemctl enable --now cronie
5252 fi
5353 if command -v pacman &>/dev/null; then
54- install docker docker
54+ install docker docker
5555 else
56- custominstall docker 'curl -fsSL https://get.docker.com | sh'
56+ custominstall docker 'curl -fsSL https://get.docker.com | sh'
5757 fi
5858 custominstall fnm 'curl -fsSL https://fnm.vercel.app/install | bash'
5959 custominstall cargo "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh" && . "$HOME/.cargo/env"
6060 custominstall lsd 'cargo install lsd'
6161 custominstall lazygit 'go install github.com/jesseduffield/lazygit@latest'
62-custominstall fzf 'git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
63-~/.fzf/install'
62+if [ ! -d "$HOME/.fzf" ]; then
63+ git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
64+ ~/.fzf/install
65+fi
6466
6567 # Initialize git setup
6668 if [[ -z $(git config --global user.name) ]]; then
67- read -rp "Git username: " username </dev/tty
68- git config --global user.name "$username"
69+ read -rp "Git username: " username </dev/tty
70+ git config --global user.name "$username"
6971 fi
7072 if [[ -z $(git config --global user.email) ]]; then
71- read -rp "Git email: " email </dev/tty
72- git config --global user.email "$email"
73+ read -rp "Git email: " email </dev/tty
74+ git config --global user.email "$email"
7375 fi
7476
7577 # Install dotzsh
7678 read -rp "Are you sure you want to replace your current config? (y/n): " yn </dev/tty
7779 if [[ "$yn" == "y" ]]; then
78- oldenv="$(cat "$HOME/.zshenv" 2>/dev/null)"
79- echo 'export ZDOTDIR=$HOME/.config/zsh' >"$HOME/.zshenv"
80- if cp -r "$HOME/.config/zsh" "$STORAGE/backup" &>/dev/null; then
81- echo "Stored $HOME/.config/zsh into $STORAGE/backup"
82- fi
83- rm -rf "$HOME/.config/zsh" &>/dev/null
84- if ! git clone https://github.com/huncholane/dotzsh "$HOME/.config/zsh" 2>/dev/null; then
85- echo "Clone failed"
86- if cp -r "$STORAGE/backup" "$HOME/.config/zsh" &>/dev/null; then
87- echo "Reverted $HOME/.config/zsh to original"
80+ oldenv="$(cat "$HOME/.zshenv" 2>/dev/null)"
81+ echo 'export ZDOTDIR=$HOME/.config/zsh' >"$HOME/.zshenv"
82+ if cp -r "$HOME/.config/zsh" "$STORAGE/backup" &>/dev/null; then
83+ echo "Stored $HOME/.config/zsh into $STORAGE/backup"
84+ fi
85+ rm -rf "$HOME/.config/zsh" &>/dev/null
86+ if ! git clone https://github.com/huncholane/dotzsh "$HOME/.config/zsh" 2>/dev/null; then
87+ echo "Clone failed"
88+ if cp -r "$STORAGE/backup" "$HOME/.config/zsh" &>/dev/null; then
89+ echo "Reverted $HOME/.config/zsh to original"
90+ fi
91+ else
92+ echo "$oldenv" >"$HOME/.config/zsh/env.sh"
93+ git clone --depth=1 https://github.com/mattmc3/antidote.git "$HOME/.config/zsh/.antidote"
8894 fi
89- else
90- echo "$oldenv" >"$HOME/.config/zsh/env.sh"
91- git clone --depth=1 https://github.com/mattmc3/antidote.git "$HOME/.config/zsh/.antidote"
92- fi
9395 fi
9496
9597 # Register update check cron job (every 6 hours)
9698 CRON_CMD="0 */6 * * * $HOME/.config/zsh/updates.sh # dotzsh-update-check"
9799 if ! crontab -l 2>/dev/null | grep -q "dotzsh/monitor_updates.sh"; then
98- (
99- crontab -l 2>/dev/null
100- echo "$CRON_CMD"
101- ) | crontab -
102- echo "Registered update check cron job"
100+ (
101+ crontab -l 2>/dev/null
102+ echo "$CRON_CMD"
103+ ) | crontab -
104+ echo "Registered update check cron job"
103105 fi
104106
105107 # Arch specific installations
106108 if [ -f /etc/arch-release ]; then
107- echo "Arch detected"
108- # Install paru
109- if ! command -v paru &>/dev/null; then
110- echo "Installing paru"
111- sudo pacman -S --needed base-devel
112- git clone https://aur.archlinux.org/paru.git /tmp/paru
113- (cd /tmp/paru && makepkg -si)
114- rm -rf /tmp/paru
115- fi
109+ echo "Arch detected"
110+ # Install paru
111+ if ! command -v paru &>/dev/null; then
112+ echo "Installing paru"
113+ sudo pacman -S --needed base-devel
114+ git clone https://aur.archlinux.org/paru.git /tmp/paru
115+ (cd /tmp/paru && makepkg -si)
116+ rm -rf /tmp/paru
117+ fi
116118 fi