261 lines
5.6 KiB
Bash
Executable File
261 lines
5.6 KiB
Bash
Executable File
#!/bin/sh
|
|
set -e
|
|
|
|
# colors for output
|
|
GREEN='\033[0;32m'
|
|
BLUE='\033[0;34m'
|
|
RED='\033[0;31m'
|
|
NC='\033[0m'
|
|
|
|
# helpers
|
|
info() {
|
|
printf '%b\n' "${BLUE}>>$1${NC}"
|
|
}
|
|
|
|
success() {
|
|
printf '%b\n' "${GREEN}>>$1${NC}"
|
|
}
|
|
|
|
error() {
|
|
printf '%b\n' "${RED}>>ERROR: $1${NC}" >&2
|
|
}
|
|
|
|
|
|
# 0. Check environment
|
|
|
|
if [ "$(id -u)" -eq 0 ]; then
|
|
error "do not run this installer as root"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -f /etc/alpine-release ]; then
|
|
error "Alpine Linux is required"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -d "$HOME/labwc-alpine" ]; then
|
|
error "labwc-alpine directory not found in $HOME"
|
|
printf '%b\n' "${RED}>>Please clone the repository first:${NC}"
|
|
printf '%b\n' "${RED}>>git clone https://zenithcode.duckdns.org/s13bby/labwc-alpine.git${NC}"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -d "$HOME/labwc-alpine/.git" ]; then
|
|
error "$HOME/labwc-alpine is not a git repository"
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v sudo >/dev/null 2>&1; then
|
|
error "sudo is required"
|
|
exit 1
|
|
fi
|
|
|
|
|
|
# 1. Begin
|
|
|
|
echo "┌──────────────────────────────────────┐"
|
|
echo "│ zenithcode.duckdns.org │"
|
|
echo "│ welcome to installer labwc-alpine │"
|
|
echo "│ by s13bby │"
|
|
echo "└──────────────────────────────────────┘"
|
|
|
|
|
|
# 2. Update and upgrade system
|
|
|
|
info "updating distro repositories..."
|
|
sudo apk update
|
|
|
|
info "upgrading system packages..."
|
|
sudo apk upgrade
|
|
|
|
success "distro repositories and system are up-to-date"
|
|
|
|
|
|
# 3. Install needed packages
|
|
|
|
info "installing needed packages..."
|
|
|
|
sudo apk add \
|
|
gcc \
|
|
g++ \
|
|
kate \
|
|
mesa-dri-gallium \
|
|
bluetuith \
|
|
git \
|
|
curl \
|
|
util-linux \
|
|
cmake \
|
|
libcurl \
|
|
curl-dev \
|
|
opencv \
|
|
opencv-dev \
|
|
waybar \
|
|
mako \
|
|
swaybg \
|
|
wofi \
|
|
font-noto \
|
|
font-dejavu \
|
|
wl-clipboard \
|
|
xdg-desktop-portal \
|
|
xdg-desktop-portal-gtk \
|
|
pipewire \
|
|
wireplumber \
|
|
alsa-utils \
|
|
networkmanager \
|
|
nm-applet \
|
|
pcmanfm \
|
|
firefox \
|
|
swaylock \
|
|
playerctl \
|
|
font-jetbrains-mono
|
|
|
|
success "all packages installed"
|
|
|
|
|
|
# 4. Configure NetworkManager
|
|
|
|
info "configuring NetworkManager..."
|
|
|
|
if rc-update show default 2>/dev/null | grep -q "networkmanager"; then
|
|
success "networkmanager already configured"
|
|
else
|
|
sudo rc-update add networkmanager default
|
|
success "networkmanager added to default runlevel"
|
|
fi
|
|
|
|
if rc-service networkmanager status >/dev/null 2>&1; then
|
|
success "networkmanager is already running"
|
|
else
|
|
sudo rc-service networkmanager start
|
|
fi
|
|
|
|
|
|
# 5. Build zenith-cli
|
|
|
|
if [ -d "$HOME/zenith-cli/.git" ]; then
|
|
info "zenith-cli already exists, updating..."
|
|
|
|
cd "$HOME/zenith-cli"
|
|
git pull
|
|
else
|
|
if [ -e "$HOME/zenith-cli" ]; then
|
|
error "$HOME/zenith-cli exists but is not a git repository"
|
|
exit 1
|
|
fi
|
|
|
|
info "cloning zenith-cli repository..."
|
|
|
|
git clone \
|
|
https://zenithcode.duckdns.org/s13bby/zenith-cli.git \
|
|
"$HOME/zenith-cli"
|
|
fi
|
|
|
|
if [ ! -f "$HOME/zenith-cli/build.sh" ]; then
|
|
error "zenith-cli/build.sh not found"
|
|
exit 1
|
|
fi
|
|
|
|
info "making build script executable..."
|
|
chmod +x "$HOME/zenith-cli/build.sh"
|
|
|
|
info "building zenith-cli..."
|
|
sh "$HOME/zenith-cli/build.sh"
|
|
|
|
if [ ! -f "$HOME/zenith-cli/zenith-cli" ]; then
|
|
error "zenith-cli binary was not created"
|
|
exit 1
|
|
fi
|
|
|
|
info "installing zenith-cli to ~/.local/bin..."
|
|
|
|
mkdir -p "$HOME/.local/bin"
|
|
|
|
cp "$HOME/zenith-cli/zenith-cli" "$HOME/.local/bin/zenith-cli"
|
|
chmod +x "$HOME/.local/bin/zenith-cli"
|
|
|
|
if ! grep -Fq 'export PATH="$HOME/.local/bin:$PATH"' "$HOME/.profile" 2>/dev/null; then
|
|
echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$HOME/.profile"
|
|
success "added ~/.local/bin to PATH in .profile"
|
|
fi
|
|
|
|
# Make zenith-cli available in the current shell
|
|
export PATH="$HOME/.local/bin:$PATH"
|
|
|
|
success "zenith-cli ready to work"
|
|
|
|
|
|
# 6. Copy configs
|
|
|
|
info "creating config directory..."
|
|
|
|
mkdir -p "$HOME/.config"
|
|
|
|
info "copying dotfiles..."
|
|
|
|
for config in hypr labwc waybar wofi qt6ct alacritty; do
|
|
if [ -d "$HOME/labwc-alpine/configs/$config" ]; then
|
|
cp -r "$HOME/labwc-alpine/configs/$config" "$HOME/.config/"
|
|
else
|
|
error "config directory not found: $config"
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
if [ -d "$HOME/labwc-alpine/palettes" ]; then
|
|
cp -r "$HOME/labwc-alpine/palettes" "$HOME/.config/"
|
|
else
|
|
error "palettes directory not found"
|
|
exit 1
|
|
fi
|
|
|
|
success "dotfiles copied"
|
|
|
|
|
|
# 7. Copy fonts
|
|
|
|
info "creating fonts directory..."
|
|
|
|
mkdir -p "$HOME/.local/share/fonts"
|
|
|
|
if [ -d "$HOME/labwc-alpine/fonts" ]; then
|
|
cp -r "$HOME/labwc-alpine/fonts/"* "$HOME/.local/share/fonts/"
|
|
else
|
|
error "fonts directory not found"
|
|
exit 1
|
|
fi
|
|
|
|
info "updating font cache..."
|
|
fc-cache -fv >/dev/null
|
|
|
|
success "fonts copied"
|
|
|
|
|
|
# 8. Copy backgrounds
|
|
|
|
info "creating backgrounds directory..."
|
|
|
|
mkdir -p "$HOME/backgrounds/"
|
|
|
|
if [ -d "$HOME/labwc-alpine/backgrounds" ]; then
|
|
cp -r "$HOME/labwc-alpine/backgrounds/"* "$HOME/backgrounds/"
|
|
else
|
|
error "backgrounds directory not found"
|
|
exit 1
|
|
fi
|
|
|
|
success "backgrounds copied"
|
|
|
|
|
|
# 9. Done
|
|
|
|
echo
|
|
echo "┌──────────────────────────────────────┐"
|
|
echo "│ zenithcode.duckdns.org │"
|
|
echo "│ thanks for use my dotfiles │"
|
|
echo "│ mail: qaws3623@gmail.com by s13bby │"
|
|
echo "└──────────────────────────────────────┘"
|
|
|
|
printf '%b\n' "${GREEN}"
|
|
printf '%b\n' ">>please reboot system<<"
|
|
printf '%b\n' "${NC}"
|