Skip to content

Commit 0c75992

Browse files
committed
Reworked init.sh script, some other minor improvements
1 parent 618de90 commit 0c75992

File tree

3 files changed

+207
-16
lines changed

3 files changed

+207
-16
lines changed

.bash_profile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
alias start='sway --unsupported-gpu'
2+
3+
export LANG=en_US.UTF-8
4+
export LANGUAGE=en_US

foot/foot.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[main]
2-
font=0xProto Nerd Font Propo:style=Regular:size=10
2+
font=0xProto Nerd Font Propo:style=Regular:size=14
33
term=xterm-256color
44
shell=/bin/bash
55
title=foot (%u@%h)

init.sh

Lines changed: 203 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,211 @@
1-
#/bin/bash
2-
# Simple script to setup environment
1+
#!/bin/bash
32

3+
# Arch Linux Setup Script
4+
# Sets up a new Arch machine with Sway WM and essential tools
45

5-
rm ~/.bashrc
6-
rm ~/.bash_profile
6+
set -e # Exit on any error
77

8-
ln -s ~/Dotfiles/.bashrc ~/.bashrc
9-
ln -s ~/Dotfiles/.bash_profile ~/.bash_profile
10-
ln -s ~/Dotfiles/sway ~/.config/sway
11-
ln -s ~/Dotfiles/nvim ~/.config/nvim
12-
ln -s ~/Dotfiles/foot ~/.config/foot
13-
ln -s ~/Dotfiles/waybar ~/.config/waybar
14-
ln -s ~/Dotfiles/blueman ~/.config/blueman
15-
sudo ln -s ~/Dotfiles/proto /usr/share/fonts/proto
8+
# Colors for output
9+
RED='\033[0;31m'
10+
GREEN='\033[0;32m'
11+
YELLOW='\033[1;33m'
12+
NC='\033[0m' # No Color
1613

17-
sudo pacman -S sway git neovim rust nodejs spotify-launcher foot lua clang gcc ripgrep fzf wget luarocks pavucontrol xorg-xwayland swaybg wmenu waybar networkmanager nm-connection-editor blueman pipewire pipewire-pulse pavucontrol wakatime network-manager-applet
14+
log() {
15+
echo -e "${GREEN}[INFO]${NC} $1"
16+
}
1817

18+
warn() {
19+
echo -e "${YELLOW}[WARN]${NC} $1"
20+
}
21+
22+
error() {
23+
echo -e "${RED}[ERROR]${NC} $1"
24+
}
25+
26+
# Check if running as root
27+
if [[ $EUID -eq 0 ]]; then
28+
error "This script should not be run as root"
29+
exit 1
30+
fi
31+
32+
# Check if Dotfiles directory exists
33+
if [[ ! -d "$HOME/Dotfiles" ]]; then
34+
error "Dotfiles directory not found at $HOME/Dotfiles"
35+
exit 1
36+
fi
37+
38+
log "Starting Arch Linux setup..."
39+
40+
# ==================== DOTFILES SETUP ====================
41+
log "Setting up dotfiles..."
42+
43+
# Backup existing configs
44+
backup_dir="$HOME/.config_backup_$(date +%Y%m%d_%H%M%S)"
45+
mkdir -p "$backup_dir"
46+
47+
# Backup and remove existing configs
48+
configs=(.bashrc .bash_profile .config/sway .config/nvim .config/foot .config/waybar .config/blueman)
49+
for config in "${configs[@]}"; do
50+
if [[ -e "$HOME/$config" ]]; then
51+
mv "$HOME/$config" "$backup_dir/"
52+
log "Backed up $config to $backup_dir"
53+
fi
54+
done
55+
56+
# Create symlinks
57+
log "Creating symlinks..."
58+
ln -sf "$HOME/Dotfiles/.bashrc" "$HOME/.bashrc"
59+
ln -sf "$HOME/Dotfiles/.bash_profile" "$HOME/.bash_profile"
60+
ln -sf "$HOME/Dotfiles/sway" "$HOME/.config/sway"
61+
ln -sf "$HOME/Dotfiles/nvim" "$HOME/.config/nvim"
62+
ln -sf "$HOME/Dotfiles/foot" "$HOME/.config/foot"
63+
ln -sf "$HOME/Dotfiles/waybar" "$HOME/.config/waybar"
64+
ln -sf "$HOME/Dotfiles/blueman" "$HOME/.config/blueman"
65+
66+
# Install custom fonts
67+
if [[ -d "$HOME/Dotfiles/proto" ]]; then
68+
sudo mkdir -p /usr/share/fonts/proto
69+
sudo cp -r "$HOME/Dotfiles/proto"/* /usr/share/fonts/proto/
70+
sudo fc-cache -f
71+
log "Installed custom fonts"
72+
fi
73+
74+
# ==================== PACKAGE INSTALLATION ====================
75+
log "Installing packages..."
76+
77+
# Core packages
78+
packages=(
79+
# Window manager and display
80+
sway swaybg wmenu waybar xorg-xwayland
81+
82+
# Terminal and shell
83+
foot bash-completion
84+
85+
# Development tools
86+
git neovim rust nodejs npm
87+
base-devel clang gcc
88+
89+
# CLI utilities
90+
ripgrep fzf wget curl tree htop
91+
luarocks lua
92+
93+
# Audio
94+
pipewire pipewire-pulse pavucontrol
95+
96+
# Network
97+
networkmanager nm-connection-editor network-manager-applet
98+
99+
# Bluetooth
100+
blueman
101+
102+
# File manager
103+
thunar thunar-archive-plugin
104+
105+
# System utilities
106+
wl-clipboard xdg-utils
107+
108+
# Applications
109+
spotify-launcher firefox
110+
111+
# Fonts
112+
ttf-dejavu ttf-liberation noto-fonts
113+
114+
# Development extras
115+
wakatime
116+
)
117+
118+
# Install packages
119+
sudo pacman -S --needed "${packages[@]}"
120+
121+
# ==================== SYSTEM SERVICES ====================
122+
log "Enabling system services..."
123+
124+
# Enable services
19125
sudo systemctl enable --now NetworkManager.service
20126
sudo systemctl enable --now bluetooth.service
21-
systemctl --user enable --now pipewire.service pipewire-pulse.service
22127

23-
mkdir -p ~/AUR
128+
# Enable user services
129+
systemctl --user enable --now pipewire.service
130+
systemctl --user enable --now pipewire-pulse.service
131+
132+
# ==================== THUNAR CONFIGURATION ====================
133+
log "Configuring Thunar..."
134+
135+
# Set foot as default terminal for Thunar
136+
xfconf-query -c thunar -p /misc-terminal-emulator -n -t string -s foot 2>/dev/null || \
137+
xfconf-query -c thunar -p /misc-terminal-emulator -s foot
138+
139+
xfconf-query -c thunar -p /misc-use-terminal -n -t bool -s true 2>/dev/null || \
140+
xfconf-query -c thunar -p /misc-use-terminal -s true
141+
142+
# ==================== AUR PACKAGES ====================
143+
log "Installing AUR packages..."
144+
145+
# Create AUR directory
146+
mkdir -p "$HOME/AUR"
147+
cd "$HOME/AUR"
148+
149+
# AUR packages to install
150+
aur_packages=(
151+
"jellyfin-media-player"
152+
"zoom"
153+
"paru" # Better AUR helper
154+
)
155+
156+
install_aur_package() {
157+
local package=$1
158+
log "Installing $package from AUR..."
159+
160+
if [[ -d "$package" ]]; then
161+
rm -rf "$package"
162+
fi
163+
164+
git clone "https://aur.archlinux.org/$package.git"
165+
cd "$package"
166+
makepkg -si --noconfirm
167+
cd ..
168+
}
169+
170+
for package in "${aur_packages[@]}"; do
171+
install_aur_package "$package"
172+
done
173+
174+
# ==================== FINAL SETUP ====================
175+
log "Performing final setup..."
176+
177+
# Create common directories
178+
mkdir -p "$HOME/Documents/Projects"
179+
mkdir -p "$HOME/Downloads"
180+
mkdir -p "$HOME/Pictures/Screenshots"
181+
182+
# Set up Git (if not already configured)
183+
if ! git config --global user.name >/dev/null 2>&1; then
184+
warn "Git user.name not configured. Set it with: git config --global user.name 'Your Name'"
185+
fi
186+
187+
if ! git config --global user.email >/dev/null 2>&1; then
188+
warn "Git user.email not configured. Set it with: git config --global user.email '[email protected]'"
189+
fi
190+
191+
# Source the new bashrc
192+
source "$HOME/.bashrc" 2>/dev/null || true
193+
194+
log "Setup complete! 🎉"
195+
log "Backup of old configs saved to: $backup_dir"
196+
log "Please reboot or log out and back in for all changes to take effect."
197+
198+
# ==================== POST-INSTALL NOTES ====================
199+
echo
200+
echo "=========================="
201+
echo "POST-INSTALL CHECKLIST:"
202+
echo "=========================="
203+
echo "• Configure Git: git config --global user.name/user.email"
204+
echo "• Set up SSH keys for GitHub/GitLab"
205+
echo "• Configure Sway keybindings in ~/.config/sway/config"
206+
echo "• Install Rust tools: cargo install exa bat fd-find"
207+
echo "• Set up development environment (nvm, rustup, etc.)"
208+
echo "• Configure firewall: sudo ufw enable"
209+
echo "• Install additional fonts if needed"
210+
echo "• Configure Waybar modules"
211+
echo "• Set up backup solution"

0 commit comments

Comments
 (0)