Files
labwc-alpine/alpine_install.sh
T

528 lines
12 KiB
Bash
Raw Normal View History

2026-09-06 14:31:15 +06:00
#!/bin/sh
# ============================================================
2026-09-08 09:49:25 +06:00
# Alpine Linux + labwc Desktop Installer
# Wayland / labwc / seatd / greetd / NetworkManager / PipeWire
2026-09-06 14:31:15 +06:00
# ============================================================
2026-09-08 09:49:25 +06:00
echo "=============================================="
echo " Alpine Linux -> labwc Desktop"
echo "=============================================="
2026-09-06 14:31:15 +06:00
echo
2026-09-08 09:49:25 +06:00
# ------------------------------------------------------------
# Check root
# ------------------------------------------------------------
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
if [ "$(id -u)" != "0" ]; then
echo "ERROR: run this script as root."
2026-09-06 14:31:15 +06:00
exit 1
fi
2026-09-08 09:49:25 +06:00
# ------------------------------------------------------------
# Check Alpine
# ------------------------------------------------------------
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
if [ ! -f /etc/alpine-release ]; then
echo "ERROR: this script is intended for Alpine Linux."
2026-09-06 14:31:15 +06:00
exit 1
fi
2026-09-08 09:49:25 +06:00
ALPINE_VERSION="$(cut -d'.' -f1,2 /etc/alpine-release)"
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
echo "Alpine version: $ALPINE_VERSION"
2026-09-06 14:31:15 +06:00
echo
2026-09-08 09:49:25 +06:00
# ------------------------------------------------------------
# Repositories
# ------------------------------------------------------------
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
echo "➜ Configure Alpine repositories"
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
cat > /etc/apk/repositories << EOF
https://dl-cdn.alpinelinux.org/alpine/v${ALPINE_VERSION}/main
https://dl-cdn.alpinelinux.org/alpine/v${ALPINE_VERSION}/community
EOF
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
apk update
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
# ------------------------------------------------------------
# Desktop user
# ------------------------------------------------------------
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
USER="user"
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
echo "➜ Create desktop user: $USER"
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
if ! id "$USER" >/dev/null 2>&1; then
adduser -D "$USER"
2026-09-06 14:31:15 +06:00
fi
2026-09-08 09:49:25 +06:00
# sudo
apk add sudo
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
cat > "/etc/sudoers.d/$USER" << EOF
$USER ALL=(ALL) NOPASSWD: ALL
EOF
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
chmod 0440 "/etc/sudoers.d/$USER"
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
echo "✓ User $USER created"
2026-09-06 14:31:15 +06:00
echo
2026-09-08 09:49:25 +06:00
# ------------------------------------------------------------
# Basic desktop infrastructure
# ------------------------------------------------------------
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
echo "➜ Install desktop infrastructure"
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
apk add \
dbus \
dbus-x11 \
eudev \
seatd \
seatd-openrc \
polkit \
polkit-elogind \
font-dejavu \
font-noto \
font-noto-cjk
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
# ------------------------------------------------------------
# User groups
# ------------------------------------------------------------
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
echo "➜ Configure user groups"
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
addgroup "$USER" seat 2>/dev/null || true
addgroup "$USER" audio 2>/dev/null || true
addgroup "$USER" video 2>/dev/null || true
addgroup "$USER" input 2>/dev/null || true
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
# ------------------------------------------------------------
# Wayland / labwc
# ------------------------------------------------------------
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
echo "★ Install labwc"
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
apk add \
labwc \
xwayland
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
# ------------------------------------------------------------
# Useful Wayland desktop applications
# ------------------------------------------------------------
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
echo "➜ Install Wayland utilities"
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
apk add \
foot \
rofi \
swaybg \
swayidle \
swaylock \
waybar \
wl-clipboard \
grim \
slurp
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
# ------------------------------------------------------------
# File manager / removable devices
# ------------------------------------------------------------
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
echo "➜ Install filesystem / removable device support"
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
apk add \
gvfs \
gvfs-fuse \
gvfs-smb \
udisks2 \
udisks2-openrc \
fuse-openrc
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
# ------------------------------------------------------------
# NetworkManager
# ------------------------------------------------------------
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
echo "➜ Install NetworkManager"
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
apk add \
networkmanager \
networkmanager-openrc \
networkmanager-tui
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
rc-update add networkmanager default
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
# ------------------------------------------------------------
# Seat management
# ------------------------------------------------------------
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
echo "➜ Configure seatd"
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
rc-update add seatd default
2026-09-06 14:31:15 +06:00
# ------------------------------------------------------------
2026-09-08 09:49:25 +06:00
# D-Bus
2026-09-06 14:31:15 +06:00
# ------------------------------------------------------------
2026-09-08 09:49:25 +06:00
echo "➜ Configure D-Bus"
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
rc-update add dbus default
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
# ------------------------------------------------------------
# PipeWire
# ------------------------------------------------------------
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
echo "★ Install PipeWire audio"
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
apk add \
pipewire \
pipewire-pulse \
pipewire-alsa \
pipewire-tools \
pipewire-spa-bluez \
pipewire-pulse-openrc \
wireplumber \
wireplumber-openrc
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
# ------------------------------------------------------------
# ALSA
# ------------------------------------------------------------
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
echo "➜ Install ALSA utilities"
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
apk add \
alsa-utils \
alsaconf \
alsa-lib
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
addgroup "$USER" audio 2>/dev/null || true
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
# ------------------------------------------------------------
# Bluetooth
# ------------------------------------------------------------
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
echo "➜ Install Bluetooth support"
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
apk add \
bluez \
bluez-openrc \
blueman
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
rc-update add bluetooth default
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
# ------------------------------------------------------------
# Login manager
# ------------------------------------------------------------
2026-09-06 20:24:15 +06:00
2026-09-08 09:49:25 +06:00
echo "★ Install greetd"
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
apk add \
greetd \
greetd-openrc \
greetd-agreety
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
# ------------------------------------------------------------
# greetd configuration
# ------------------------------------------------------------
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
echo "➜ Configure greetd"
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
mkdir -p /etc/greetd
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
cat > /etc/greetd/config.toml << EOF
[terminal]
vt = 7
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
[default_session]
command = "agreety --cmd labwc"
user = "greetd"
EOF
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
# greetd needs access to seatd
addgroup greetd seat 2>/dev/null || true
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
# Make greetd wait for seatd
if [ -f /etc/conf.d/greetd ]; then
if ! grep -q '^rc_need=".*seatd' /etc/conf.d/greetd 2>/dev/null; then
echo 'rc_need="seatd"' >> /etc/conf.d/greetd
fi
fi
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
rc-update add greetd default
2026-09-06 14:31:15 +06:00
# ------------------------------------------------------------
2026-09-08 09:49:25 +06:00
# XDG user directories
2026-09-06 14:31:15 +06:00
# ------------------------------------------------------------
2026-09-08 09:49:25 +06:00
echo "➜ Create XDG user directories"
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
apk add xdg-user-dirs
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
su - "$USER" -c "xdg-user-dirs-update" 2>/dev/null || true
2026-09-06 14:31:15 +06:00
# ------------------------------------------------------------
2026-09-08 09:49:25 +06:00
# labwc configuration
2026-09-06 14:31:15 +06:00
# ------------------------------------------------------------
2026-09-08 09:49:25 +06:00
echo "➜ Create labwc configuration"
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
mkdir -p "/home/$USER/.config/labwc"
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
cat > "/home/$USER/.config/labwc/autostart" << 'EOF'
#!/bin/sh
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
# D-Bus user session
if command -v dbus-update-activation-environment >/dev/null 2>&1; then
dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
2026-09-06 14:31:15 +06:00
fi
2026-09-08 09:49:25 +06:00
# Wallpaper
if command -v swaybg >/dev/null 2>&1; then
swaybg -c 202020 &
2026-09-06 14:31:15 +06:00
fi
2026-09-08 09:49:25 +06:00
# Panel
2026-09-06 14:31:15 +06:00
if command -v waybar >/dev/null 2>&1; then
waybar &
fi
2026-09-08 09:49:25 +06:00
# NetworkManager tray
if command -v nm-applet >/dev/null 2>&1; then
nm-applet &
2026-09-06 14:31:15 +06:00
fi
2026-09-08 09:49:25 +06:00
# Bluetooth tray
if command -v blueman-applet >/dev/null 2>&1; then
blueman-applet &
2026-09-06 14:31:15 +06:00
fi
EOF
2026-09-08 09:49:25 +06:00
chmod +x "/home/$USER/.config/labwc/autostart"
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
# ------------------------------------------------------------
# Basic labwc menu
# ------------------------------------------------------------
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
cat > "/home/$USER/.config/labwc/menu.xml" << 'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<openbox_menu>
<menu id="root-menu" label="labwc">
<item label="Terminal">
<action name="Execute">
<command>foot</command>
</action>
</item>
<item label="Application launcher">
<action name="Execute">
<command>rofi -show drun</command>
</action>
</item>
<separator />
<item label="Reload labwc">
<action name="Reconfigure"/>
</item>
<item label="Exit">
<action name="Exit"/>
</item>
</menu>
</openbox_menu>
EOF
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
# ------------------------------------------------------------
# Basic keyboard shortcuts
# ------------------------------------------------------------
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
cat > "/home/$USER/.config/labwc/rc.xml" << 'EOF'
<?xml version="1.0" encoding="UTF-8"?>
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
<labwc_config>
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
<keyboard>
<default />
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
<keybind key="W-Return">
<action name="Execute">
<command>foot</command>
</action>
</keybind>
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
<keybind key="W-d">
<action name="Execute">
<command>rofi -show drun</command>
</action>
</keybind>
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
<keybind key="W-l">
<action name="Execute">
<command>swaylock</command>
</action>
</keybind>
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
<keybind key="W-q">
<action name="Close"/>
</keybind>
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
</keyboard>
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
</labwc_config>
2026-09-06 14:31:15 +06:00
EOF
2026-09-08 09:49:25 +06:00
# ------------------------------------------------------------
# Waybar configuration
# ------------------------------------------------------------
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
mkdir -p "/home/$USER/.config/waybar"
cat > "/home/$USER/.config/waybar/config" << 'EOF'
[
{
"layer": "top",
"position": "top",
"modules-left": [
"wlr/workspaces"
],
"modules-center": [
"clock"
],
"modules-right": [
"network",
"pulseaudio",
"battery"
]
}
]
2026-09-06 14:31:15 +06:00
EOF
2026-09-08 09:49:25 +06:00
cat > "/home/$USER/.config/waybar/style.css" << 'EOF'
* {
border: none;
border-radius: 0;
font-family: sans-serif;
font-size: 13px;
}
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
window#waybar {
background: rgba(30, 30, 30, 0.95);
color: #ffffff;
}
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
#workspaces button {
padding: 0 8px;
color: #aaaaaa;
}
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
#workspaces button.active {
color: #ffffff;
background: #444444;
}
2026-09-06 18:40:23 +06:00
2026-09-08 09:49:25 +06:00
#clock,
#network,
#pulseaudio,
#battery {
padding: 0 10px;
}
2026-09-06 18:40:23 +06:00
EOF
2026-09-08 09:49:25 +06:00
# ------------------------------------------------------------
# Permissions
# ------------------------------------------------------------
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
echo "➜ Fix user permissions"
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
chown -R "$USER:$USER" "/home/$USER/.config"
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
# ------------------------------------------------------------
# Useful software
# ------------------------------------------------------------
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
echo "★ Install basic software"
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
apk add \
htop \
neofetch \
curl \
wget \
git \
nano \
less \
file \
unzip \
zip
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
# ------------------------------------------------------------
# Optional browser
# ------------------------------------------------------------
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
# Uncomment if required:
#
# apk add firefox
#
# or:
#
# apk add chromium
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
# ------------------------------------------------------------
# Enable services
# ------------------------------------------------------------
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
echo "➜ Enable desktop services"
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
rc-update add dbus default
rc-update add seatd default
rc-update add networkmanager default
rc-update add bluetooth default
rc-update add greetd default
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
# ------------------------------------------------------------
# Start services when possible
# ------------------------------------------------------------
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
echo "➜ Start services"
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
rc-service dbus start 2>/dev/null || true
rc-service seatd start 2>/dev/null || true
rc-service networkmanager start 2>/dev/null || true
rc-service bluetooth start 2>/dev/null || true
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
# Do NOT start greetd here.
# It will start automatically after reboot.
2026-09-06 14:31:15 +06:00
2026-09-08 09:49:25 +06:00
# ------------------------------------------------------------
# Final information
# ------------------------------------------------------------
2026-09-06 14:31:15 +06:00
echo
2026-09-08 09:49:25 +06:00
echo "=============================================="
echo " ★★★ Alpine + labwc installation complete ★★★"
echo "=============================================="
2026-09-06 14:31:15 +06:00
echo
2026-09-08 09:49:25 +06:00
echo "Desktop user: $USER"
2026-09-06 14:31:15 +06:00
echo
2026-09-08 09:49:25 +06:00
echo "IMPORTANT:"
2026-09-06 14:31:15 +06:00
echo
2026-09-08 09:49:25 +06:00
echo "Set a password for the desktop user:"
2026-09-06 14:31:15 +06:00
echo
2026-09-08 09:49:25 +06:00
echo " passwd $USER"
2026-09-06 14:31:15 +06:00
echo
2026-09-08 09:49:25 +06:00
echo "Then reboot:"
2026-09-06 14:31:15 +06:00
echo
echo " reboot"
echo
2026-09-08 09:49:25 +06:00
echo "After reboot:"
2026-09-06 14:31:15 +06:00
echo
2026-09-08 09:49:25 +06:00
echo " greetd -> labwc"
2026-09-06 14:31:15 +06:00
echo
2026-09-08 09:49:25 +06:00
echo "Wayland compositor : labwc"
echo "Seat manager : seatd"
echo "Login manager : greetd"
echo "Audio : PipeWire + WirePlumber"
echo "Network : NetworkManager"
2026-09-06 14:31:15 +06:00
echo
2026-09-08 09:49:25 +06:00
echo "=============================================="