-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·188 lines (163 loc) · 5.23 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·188 lines (163 loc) · 5.23 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
#!/bin/bash
set -e # Exit on error
# Color definitions
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
MAGENTA='\033[0;35m'
CYAN='\033[0;36m'
BOLD='\033[1m'
RESET='\033[0m'
# Print functions
print_header() {
echo -e "${BOLD}${CYAN}=== $1 ===${RESET}"
}
print_success() {
echo -e "${GREEN}✓${RESET} $1"
}
print_warning() {
echo -e "${YELLOW}⚠${RESET} $1"
}
print_error() {
echo -e "${RED}✗${RESET} $1"
}
print_info() {
echo -e "${BLUE}→${RESET} $1"
}
print_header "Terminal Configuration Installer"
echo
# Detect OS and set package manager
print_info "Detecting operating system..."
if [ -f /etc/debian_version ]; then
OS="debian"
PM_INSTALL="sudo apt install -y"
PM_UPDATE="sudo apt update && sudo apt upgrade -y"
FONT_PKG="fonts-jetbrains-mono"
FETCH_PKG="neofetch"
elif [ -f /etc/arch-release ]; then
OS="arch"
PM_INSTALL="sudo pacman -S --noconfirm"
PM_UPDATE="sudo pacman -Syu --noconfirm"
FONT_PKG="ttf-jetbrains-mono"
FETCH_PKG="fastfetch" # neofetch is deprecated on Arch
elif [ -f /etc/fedora-release ]; then
OS="fedora"
PM_INSTALL="sudo dnf install -y"
PM_UPDATE="sudo dnf upgrade --refresh -y"
FONT_PKG="jetbrains-mono-fonts"
FETCH_PKG="neofetch"
else
print_error "Unsupported OS. This script supports Debian-based, Arch-based, and Fedora-based distributions."
exit 1
fi
print_success "Detected OS: ${BOLD}$OS${RESET}"
echo
# Update system
print_header "Updating system packages"
$PM_UPDATE
print_success "System updated"
echo
# Install core packages
print_header "Installing core packages"
print_info "Installing: fish, kitty, $FONT_PKG, doas, $FETCH_PKG"
$PM_INSTALL fish kitty $FONT_PKG doas $FETCH_PKG
print_success "Core packages installed"
echo
# Install uv (Python package manager)
print_header "Installing uv"
if ! command -v uv &> /dev/null; then
print_info "Downloading and installing uv..."
curl -LsSf https://astral.sh/uv/install.sh | sh
export PATH="$HOME/.cargo/bin:$PATH"
print_success "uv installed successfully"
else
print_warning "uv is already installed"
fi
echo
# Install thefuck
print_header "Installing thefuck"
if ! command -v thefuck &> /dev/null; then
print_info "Installing thefuck via package manager..."
$PM_INSTALL thefuck
print_success "thefuck installed successfully"
else
print_warning "thefuck is already installed"
fi
echo
# Copy configuration files
print_header "Installing configuration files"
mkdir -p ~/.config/fish
mkdir -p ~/.config/kitty
mkdir -p ~/.config/neofetch
mkdir -p ~/.config/fastfetch
print_info "Copying fish config..."
cp -r fish/* ~/.config/fish/
print_success "Fish config installed"
print_info "Copying kitty config..."
cp -r kitty/* ~/.config/kitty/
print_success "Kitty config installed"
print_info "Copying neofetch config..."
cp -r neofetch/* ~/.config/neofetch/
print_success "Neofetch config installed"
print_info "Copying fastfetch config..."
cp -r fastfetch/* ~/.config/fastfetch/
print_success "Fastfetch config installed"
echo
# Configure doas
print_header "Configuring doas"
print_info "Setting up doas permissions..."
sudo cp doas.conf /etc/doas.conf
sudo chown -c root:root /etc/doas.conf
sudo chmod -c 0600 /etc/doas.conf
print_success "doas.conf installed with correct permissions"
# Add user to wheel group if not already in it
if ! groups | grep -q wheel; then
print_info "Adding user to wheel group..."
sudo usermod -aG wheel $USER
print_warning "You need to log out and back in for wheel group membership to take effect"
else
print_success "User is already in wheel group"
fi
echo
# Set fish as default shell
print_header "Setting fish as default shell"
FISH_PATH=$(which fish)
print_info "Fish path: $FISH_PATH"
if ! grep -q "^$FISH_PATH$" /etc/shells 2>/dev/null; then
print_info "Adding fish to /etc/shells..."
echo "$FISH_PATH" | sudo tee -a /etc/shells > /dev/null
print_success "Fish added to /etc/shells"
fi
# Check if fish is already the default shell
CURRENT_SHELL=$(getent passwd $USER | cut -d: -f7)
if [ "$CURRENT_SHELL" != "$FISH_PATH" ]; then
print_info "Changing default shell to fish..."
if chsh -s "$FISH_PATH"; then
print_success "Default shell set to fish"
else
print_warning "Failed to change shell. You may need to run: chsh -s $FISH_PATH"
fi
else
print_success "Fish is already your default shell"
fi
echo
# Add to .profile for login shells
if ! grep -q "export SHELL=" ~/.profile 2>/dev/null; then
echo "export SHELL=$FISH_PATH" >> ~/.profile
print_success "Updated ~/.profile"
fi
print_header "Installation complete!"
echo
echo -e "${GREEN}✓${RESET} All configurations installed successfully!"
echo
echo -e "${BOLD}${YELLOW}Next steps:${RESET}"
echo -e " ${MAGENTA}1.${RESET} Log out and log back in for shell changes to take effect"
echo -e " ${MAGENTA}2.${RESET} Open kitty terminal to use your new configuration"
if [ "$OS" = "arch" ]; then
echo -e " ${MAGENTA}3.${RESET} Run ${CYAN}'fastfetch'${RESET} to see your system info (neofetch successor)"
else
echo -e " ${MAGENTA}3.${RESET} Run ${CYAN}'neofetch'${RESET} to see your system info"
fi
echo
echo -e "${BLUE}Note:${RESET} If you're currently in bash, run ${CYAN}'exec fish'${RESET} to switch to fish immediately."