Repository navigation
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·245 lines (219 loc) · 11 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·245 lines (219 loc) · 11 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
#!/usr/bin/env bash
# ==============================================================================
# Fedora LinuxScripts Setup & Configuration Manager
# ==============================================================================
# Interactive menu for installing/symlinking dotfiles and automation scripts.
# ==============================================================================
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
LIB_DIR="${SCRIPT_DIR}/scripts/lib"
BACKUP_DIR="${SCRIPT_DIR}/backups/$(date +%Y%m%d_%H%M%S)"
# Source shared modular libraries
if [[ -f "${LIB_DIR}/colors.sh" ]]; then
# shellcheck source=scripts/lib/colors.sh
. "${LIB_DIR}/colors.sh"
fi
if [[ -f "${LIB_DIR}/logger.sh" ]]; then
# shellcheck source=scripts/lib/logger.sh
. "${LIB_DIR}/logger.sh"
fi
if [[ -f "${LIB_DIR}/backup.sh" ]]; then
# shellcheck source=scripts/lib/backup.sh
. "${LIB_DIR}/backup.sh"
fi
print_header() {
clear 2>/dev/null || true
echo -e "${COLOR_CYAN}${COLOR_BOLD}"
echo "============================================================"
echo " Fedora LinuxScripts & Dotfiles Setup Manager "
echo "============================================================"
echo -e "${COLOR_RESET}"
}
install_config_item() {
local name="$1"
local src="$2"
local dest="$3"
mkdir -p "$(dirname "$dest")"
backup_path "$dest" "${BACKUP_DIR}"
rm -rf "$dest"
ln -sf "$src" "$dest"
echo -e " ${COLOR_GREEN}✔ Installed ${name}:${COLOR_RESET} $dest -> $src"
}
install_script_item() {
local name="$1"
local src="$2"
local dest_bin="${HOME}/.local/bin/${name}"
mkdir -p "${HOME}/.local/bin"
chmod +x "$src"
rm -f "$dest_bin"
ln -sf "$src" "$dest_bin"
echo -e " ${COLOR_GREEN}✔ Linked executable:${COLOR_RESET} ~/.local/bin/${name} -> $src"
}
print_statusline_activation_hint() {
echo -e "\n${COLOR_YELLOW}ℹ Claude Statusline installed, but it is not active yet.${COLOR_RESET}"
echo -e " Add this to ~/.claude/settings.json to enable it:"
echo -e " ${COLOR_CYAN}\"statusLine\": { \"type\": \"command\", \"command\": \"node ~/.claude/statusline.js\", \"padding\": 0, \"refreshInterval\": 1 }${COLOR_RESET}"
}
# ------------------------------------------------------------------------------
# Configuration Installation Menu
# ------------------------------------------------------------------------------
menu_install_configs() {
print_header
echo -e "${COLOR_BOLD}Select configurations to install (Symlink with auto-backup):${COLOR_RESET}\n"
echo " 1) All Configurations (Kitty, Starship, Bash, Claude, AGY)"
echo " 2) Kitty Terminal (~/.config/kitty/)"
echo " 3) Starship Prompt (~/.config/starship.toml)"
echo " 4) Bash Shell (~/.bashrc)"
echo " 5) Claude Code Statusline & Gemini Worker Skill (~/.claude/)"
echo " 6) Antigravity CLI Statusline (~/.gemini/antigravity-cli/statusline.js)"
echo " 7) Back to Main Menu"
echo ""
read -rp "Enter choice [1-7]: " config_choice
case "$config_choice" in
1)
echo -e "\n${COLOR_BOLD}Installing all configurations...${COLOR_RESET}"
install_config_item "Kitty (Full Package)" "${SCRIPT_DIR}/config/kitty" "${HOME}/.config/kitty"
install_config_item "Starship" "${SCRIPT_DIR}/config/starship/starship.toml" "${HOME}/.config/starship.toml"
install_config_item "Bash" "${SCRIPT_DIR}/config/bash/.bashrc" "${HOME}/.bashrc"
install_config_item "Claude Statusline" "${SCRIPT_DIR}/config/claude/statusline.js" "${HOME}/.claude/statusline.js"
install_config_item "Claude Statusline (Test)" "${SCRIPT_DIR}/config/claude/statusline.test.js" "${HOME}/.claude/statusline.test.js"
install_config_item "Claude Gemini Worker Skill" "${SCRIPT_DIR}/config/claude/skills/gemini-worker" "${HOME}/.claude/skills/gemini-worker"
install_config_item "Antigravity Statusline" "${SCRIPT_DIR}/config/agy/statusline.js" "${HOME}/.gemini/antigravity-cli/statusline.js"
install_config_item "Antigravity Statusline (Test)" "${SCRIPT_DIR}/config/agy/statusline.test.js" "${HOME}/.gemini/antigravity-cli/statusline.test.js"
print_statusline_activation_hint
;;
2)
echo -e "\n${COLOR_BOLD}Installing Kitty configuration...${COLOR_RESET}"
install_config_item "Kitty (Full Package)" "${SCRIPT_DIR}/config/kitty" "${HOME}/.config/kitty"
;;
3)
echo -e "\n${COLOR_BOLD}Installing Starship configuration...${COLOR_RESET}"
install_config_item "Starship" "${SCRIPT_DIR}/config/starship/starship.toml" "${HOME}/.config/starship.toml"
;;
4)
echo -e "\n${COLOR_BOLD}Installing Bash configuration...${COLOR_RESET}"
install_config_item "Bash" "${SCRIPT_DIR}/config/bash/.bashrc" "${HOME}/.bashrc"
;;
5)
echo -e "\n${COLOR_BOLD}Installing Claude Code Statusline & Gemini Worker Skill...${COLOR_RESET}"
install_config_item "Claude Statusline" "${SCRIPT_DIR}/config/claude/statusline.js" "${HOME}/.claude/statusline.js"
install_config_item "Claude Statusline (Test)" "${SCRIPT_DIR}/config/claude/statusline.test.js" "${HOME}/.claude/statusline.test.js"
install_config_item "Claude Gemini Worker Skill" "${SCRIPT_DIR}/config/claude/skills/gemini-worker" "${HOME}/.claude/skills/gemini-worker"
print_statusline_activation_hint
;;
6)
echo -e "\n${COLOR_BOLD}Installing Antigravity CLI Statusline...${COLOR_RESET}"
install_config_item "Antigravity Statusline" "${SCRIPT_DIR}/config/agy/statusline.js" "${HOME}/.gemini/antigravity-cli/statusline.js"
install_config_item "Antigravity Statusline (Test)" "${SCRIPT_DIR}/config/agy/statusline.test.js" "${HOME}/.gemini/antigravity-cli/statusline.test.js"
;;
7)
return 0
;;
*)
echo -e "\n${COLOR_RED}Invalid option selected.${COLOR_RESET}"
;;
esac
echo ""
read -rp "Press [Enter] to continue..."
}
# ------------------------------------------------------------------------------
# Script Installation Menu
# ------------------------------------------------------------------------------
menu_install_scripts() {
print_header
echo -e "${COLOR_BOLD}Select automation scripts to link to ~/.local/bin:${COLOR_RESET}\n"
echo " 1) All Scripts (update, check-updates, ezin)"
echo " 2) System Updater (update.sh -> ~/.local/bin/update)"
echo " 3) Update Checker (check-updates.sh -> ~/.local/bin/check-updates)"
echo " 4) Archive Installer (ezin.sh -> ~/.local/bin/ezin)"
echo " 5) Back to Main Menu"
echo ""
read -rp "Enter choice [1-5]: " script_choice
# Ensure scripts have execute permissions
chmod +x "${SCRIPT_DIR}/scripts/"*.sh
case "$script_choice" in
1)
echo -e "\n${COLOR_BOLD}Linking all scripts to ~/.local/bin...${COLOR_RESET}"
install_script_item "update" "${SCRIPT_DIR}/scripts/update.sh"
install_script_item "check-updates" "${SCRIPT_DIR}/scripts/check-updates.sh"
install_script_item "ezin" "${SCRIPT_DIR}/scripts/ezin.sh"
;;
2)
echo -e "\n${COLOR_BOLD}Linking update script...${COLOR_RESET}"
install_script_item "update" "${SCRIPT_DIR}/scripts/update.sh"
;;
3)
echo -e "\n${COLOR_BOLD}Linking check-updates script...${COLOR_RESET}"
install_script_item "check-updates" "${SCRIPT_DIR}/scripts/check-updates.sh"
;;
4)
echo -e "\n${COLOR_BOLD}Linking ezin installer...${COLOR_RESET}"
install_script_item "ezin" "${SCRIPT_DIR}/scripts/ezin.sh"
;;
5)
return 0
;;
*)
echo -e "\n${COLOR_RED}Invalid option selected.${COLOR_RESET}"
;;
esac
echo ""
read -rp "Press [Enter] to continue..."
}
# ------------------------------------------------------------------------------
# Full Setup (Both Configs & Scripts)
# ------------------------------------------------------------------------------
install_both() {
print_header
echo -e "${COLOR_BOLD}Performing Full Setup (Configurations + Scripts)...${COLOR_RESET}\n"
echo -e "${COLOR_BOLD}1. Installing configurations...${COLOR_RESET}"
install_config_item "Kitty (Full Package)" "${SCRIPT_DIR}/config/kitty" "${HOME}/.config/kitty"
install_config_item "Starship" "${SCRIPT_DIR}/config/starship/starship.toml" "${HOME}/.config/starship.toml"
install_config_item "Bash" "${SCRIPT_DIR}/config/bash/.bashrc" "${HOME}/.bashrc"
install_config_item "Claude Statusline" "${SCRIPT_DIR}/config/claude/statusline.js" "${HOME}/.claude/statusline.js"
install_config_item "Claude Statusline (Test)" "${SCRIPT_DIR}/config/claude/statusline.test.js" "${HOME}/.claude/statusline.test.js"
install_config_item "Claude Gemini Worker Skill" "${SCRIPT_DIR}/config/claude/skills/gemini-worker" "${HOME}/.claude/skills/gemini-worker"
install_config_item "Antigravity Statusline" "${SCRIPT_DIR}/config/agy/statusline.js" "${HOME}/.gemini/antigravity-cli/statusline.js"
install_config_item "Antigravity Statusline (Test)" "${SCRIPT_DIR}/config/agy/statusline.test.js" "${HOME}/.gemini/antigravity-cli/statusline.test.js"
print_statusline_activation_hint
echo -e "\n${COLOR_BOLD}2. Linking scripts to ~/.local/bin...${COLOR_RESET}"
chmod +x "${SCRIPT_DIR}/scripts/"*.sh
install_script_item "update" "${SCRIPT_DIR}/scripts/update.sh"
install_script_item "check-updates" "${SCRIPT_DIR}/scripts/check-updates.sh"
install_script_item "ezin" "${SCRIPT_DIR}/scripts/ezin.sh"
echo -e "\n${COLOR_GREEN}${COLOR_BOLD}✔ Full setup completed successfully!${COLOR_RESET}"
if [[ -d "${BACKUP_DIR:-}" ]]; then
echo -e " Backups saved to: ${COLOR_CYAN}${BACKUP_DIR}${COLOR_RESET}"
fi
echo ""
read -rp "Press [Enter] to continue..."
}
# ------------------------------------------------------------------------------
# Main Interactive Menu Loop
# ------------------------------------------------------------------------------
main_menu() {
while true; do
print_header
echo -e "${COLOR_BOLD}What would you like to install?${COLOR_RESET}\n"
echo " 1) Configurations (Kitty, Starship, Bash, Claude, AGY)"
echo " 2) Automation Scripts (Link to ~/.local/bin)"
echo " 3) Both (Full Installation)"
echo " 4) Exit"
echo ""
read -rp "Enter choice [1-4]: " main_choice
case "$main_choice" in
1) menu_install_configs ;;
2) menu_install_scripts ;;
3) install_both ;;
4)
echo -e "\n${COLOR_GREEN}Exiting setup. Goodbye!${COLOR_RESET}\n"
exit 0
;;
*)
echo -e "\n${COLOR_RED}Invalid choice. Please choose 1, 2, 3, or 4.${COLOR_RESET}"
sleep 1
;;
esac
done
}
main_menu