1ff4110b70
SamiOS CI / lint-and-test (push) Successful in 10s
- Add VERSION at repo root (canonical) + airootfs mirror - Refactor samios CLI, voice-bridge, installer, profiledef, desktop-setup, PKGBUILD to derive VERSION from canonical file via walk-up or conditional read (no embedded release-version literals) - Makefile targets: version-set NEW=X (single file change), version-sync - tests/test_version.sh: 55 assertions locking the invariants Verified end-to-end: make version-set NEW=0.3.0-rc2 → all 7 components see 0.3.0-rc2; PKGBUILD transforms hyphen to underscore for Arch. Codex verdict: B (0 blocking issues, shippable).
536 lines
14 KiB
Bash
536 lines
14 KiB
Bash
#!/bin/bash
|
|
# SamiOS WSL Desktop Setup - Complete automated build script
|
|
# Runs inside Arch WSL as root
|
|
# Installs: KDE Plasma desktop, Windows 11 theme, SamiOS branding, fonts
|
|
set -ex
|
|
|
|
LOG="/var/log/samios-setup.log"
|
|
exec > >(tee -a "$LOG") 2>&1
|
|
echo "=== SamiOS Desktop Setup started $(date) ==="
|
|
|
|
# ============================================================
|
|
# PHASE 1: Unregister old Arch, import fresh with 100GB VHD
|
|
# ============================================================
|
|
# This script assumes it runs AFTER the export/import is done
|
|
# If running standalone, skip to Phase 2
|
|
|
|
# ============================================================
|
|
# PHASE 2: Base system prep
|
|
# ============================================================
|
|
echo "--- Phase 2: Base system prep ---"
|
|
|
|
# Ensure sudo installed
|
|
pacman -S --noconfirm --needed sudo
|
|
|
|
# Ensure user sami exists with sudo
|
|
if ! id sami &>/dev/null; then
|
|
useradd -m -G wheel -s /bin/bash sami
|
|
fi
|
|
echo 'sami ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/sami
|
|
chmod 440 /etc/sudoers.d/sami
|
|
|
|
# wsl.conf
|
|
cat > /etc/wsl.conf << 'EOF'
|
|
[boot]
|
|
systemd=true
|
|
|
|
[automount]
|
|
enabled=true
|
|
mountFsTab=true
|
|
|
|
[user]
|
|
default=sami
|
|
EOF
|
|
|
|
# Locale
|
|
sed -i 's/^#en_US.UTF-8/en_US.UTF-8/' /etc/locale.gen
|
|
locale-gen
|
|
echo 'LANG=en_US.UTF-8' > /etc/locale.conf
|
|
|
|
# Hostname
|
|
echo samios > /etc/hostname
|
|
|
|
# ============================================================
|
|
# PHASE 3: Install desktop packages
|
|
# ============================================================
|
|
echo "--- Phase 3: Installing desktop packages ---"
|
|
|
|
# Refresh mirrors
|
|
reflector --country "United States" --age 12 --protocol https --sort rate --save /etc/pacman.d/mirrorlist 2>/dev/null || true
|
|
|
|
# Remove conflicting jack2 first
|
|
pacman -R --noconfirm jack2 2>/dev/null || true
|
|
|
|
pacman -Syu --noconfirm --needed \
|
|
xorg-server xorg-xinit \
|
|
pipewire pipewire-pulse pipewire-alsa pipewire-jack wireplumber \
|
|
dbus \
|
|
polkit \
|
|
mesa \
|
|
plasma-desktop plasma-workspace plasma-pa plasma-nm \
|
|
sddm \
|
|
dolphin konsole kate kfind \
|
|
firefox \
|
|
ark \
|
|
spectacle \
|
|
ttf-dejavu ttf-liberation noto-fonts \
|
|
kvantum \
|
|
git \
|
|
base-devel
|
|
|
|
echo "--- Phase 3 complete ---"
|
|
|
|
# ============================================================
|
|
# PHASE 4: Windows 11 Theme
|
|
# ============================================================
|
|
echo "--- Phase 4: Windows 11 Theme ---"
|
|
|
|
# Install Lightly (Windows 11 style window decoration for KDE)
|
|
# We'll use the lightly-git package from AUR
|
|
sudo -u sami bash -c '
|
|
cd /tmp
|
|
git clone https://aur.archlinux.org/lightly-git.git 2>/dev/null || true
|
|
cd lightly-git
|
|
makepkg -si --noconfirm --skippgpcheck 2>&1 | tail -10
|
|
' || echo "Lightly install failed (non-critical)"
|
|
|
|
# Download Windows 11 color scheme for KDE
|
|
mkdir -p /usr/share/color-schemes
|
|
cat > /usr/share/color-schemes/Win11Dark.colors << 'SCHEME'
|
|
[Desktop Entry]
|
|
Name=Windows 11 Dark
|
|
X-KDE-PluginInfo-Author=SamiOS
|
|
X-KDE-PluginInfo-Name=Win11Dark
|
|
X-KDE-PluginInfo-License=GPL
|
|
|
|
[ColorEffects:Disabled]
|
|
Color=56,56,56
|
|
ColorAmount=0
|
|
ColorAmount=0.1
|
|
ContrastAmount=0.65
|
|
ContrastAmount=0.65
|
|
Enabled=false
|
|
IntensityAmount=0.1
|
|
IntensityAmount=0.1
|
|
|
|
[Colors:Button]
|
|
BackgroundAlternate=30,30,30
|
|
BackgroundNormal=32,32,32
|
|
DecorationFocus=0,120,212
|
|
DecorationHover=0,120,212
|
|
ForegroundActive=0,120,212
|
|
ForegroundInactive=160,160,160
|
|
ForegroundLink=0,120,212
|
|
ForegroundNegative=240,71,71
|
|
ForegroundNeutral=255,196,0
|
|
ForegroundNormal=255,255,255
|
|
ForegroundPositive=0,200,83
|
|
ForegroundVisited=0,90,158
|
|
|
|
[Colors:Selection]
|
|
BackgroundAlternate=0,120,212
|
|
BackgroundNormal=0,120,212
|
|
DecorationFocus=0,120,212
|
|
DecorationHover=0,120,212
|
|
ForegroundNormal=255,255,255
|
|
|
|
[Colors:View]
|
|
BackgroundAlternate=37,37,37
|
|
BackgroundNormal=32,32,32
|
|
DecorationFocus=0,120,212
|
|
DecorationHover=0,120,212
|
|
ForegroundActive=0,120,212
|
|
ForegroundInactive=160,160,160
|
|
ForegroundLink=0,120,212
|
|
ForegroundNegative=240,71,71
|
|
ForegroundNeutral=255,196,0
|
|
ForegroundNormal=255,255,255
|
|
ForegroundPositive=0,200,83
|
|
ForegroundVisited=0,90,158
|
|
|
|
[Colors:Window]
|
|
BackgroundAlternate=30,30,30
|
|
BackgroundNormal=32,32,32
|
|
DecorationFocus=0,120,212
|
|
DecorationHover=0,120,212
|
|
ForegroundActive=0,120,212
|
|
ForegroundInactive=160,160,160
|
|
ForegroundLink=0,120,212
|
|
ForegroundNegative=240,71,71
|
|
ForegroundNeutral=255,196,0
|
|
ForegroundNormal=255,255,255
|
|
ForegroundPositive=0,200,83
|
|
ForegroundVisited=0,90,158
|
|
|
|
[General]
|
|
ColorScheme=Win11Dark
|
|
Name=Windows 11 Dark
|
|
shadeSortColumn=true
|
|
|
|
[KDE]
|
|
contrast=4
|
|
widgetStyle=Lightly
|
|
|
|
[WM]
|
|
activeBackground=32,32,32
|
|
activeBlend=32,32,32
|
|
activeForeground=255,255,255
|
|
inactiveBackground=24,24,24
|
|
inactiveBlend=24,24,24
|
|
inactiveForeground=160,160,160
|
|
SCHEME
|
|
|
|
# Win11 Light scheme
|
|
cat > /usr/share/color-schemes/Win11Light.colors << 'SCHEME2'
|
|
[Desktop Entry]
|
|
Name=Windows 11 Light
|
|
X-KDE-PluginInfo-Author=SamiOS
|
|
X-KDE-PluginInfo-Name=Win11Light
|
|
X-KDE-PluginInfo-License=GPL
|
|
|
|
[Colors:View]
|
|
BackgroundNormal=249,249,249
|
|
ForegroundNormal=0,0,0
|
|
DecorationFocus=0,120,212
|
|
DecorationHover=0,120,212
|
|
|
|
[Colors:Window]
|
|
BackgroundNormal=243,243,243
|
|
ForegroundNormal=0,0,0
|
|
|
|
[Colors:Selection]
|
|
BackgroundNormal=0,120,212
|
|
ForegroundNormal=255,255,255
|
|
|
|
[Colors:Button]
|
|
BackgroundNormal=255,255,255
|
|
ForegroundNormal=0,0,0
|
|
|
|
[General]
|
|
ColorScheme=Win11Light
|
|
Name=Windows 11 Light
|
|
|
|
[KDE]
|
|
widgetStyle=Lightly
|
|
SCHEME2
|
|
|
|
echo "--- Phase 4 complete ---"
|
|
|
|
# ============================================================
|
|
# PHASE 5: KDE Configuration for Windows-like experience
|
|
# ============================================================
|
|
echo "--- Phase 5: KDE Configuration ---"
|
|
|
|
# Create sami's KDE config directory
|
|
SAMHOME=$(getent passwd sami | cut -d: -f6)
|
|
KDEDIR="$SAMHOME/.config"
|
|
mkdir -p "$KDEDIR"
|
|
|
|
# Plasma Shell config — bottom panel, Win11 style
|
|
cat > "$KDEDIR/plasma-localerc" << 'EOF'
|
|
[Formats]
|
|
LANG=en_US.UTF-8
|
|
EOF
|
|
|
|
# Window Management — like Windows
|
|
cat > "$KDEDIR/kdeglobals" << 'EOF'
|
|
[General]
|
|
ColorScheme=Win11Dark
|
|
|
|
[KDE]
|
|
widgetStyle=Lightly
|
|
|
|
[Icons]
|
|
Theme=breeze
|
|
EOF
|
|
|
|
# KWin config — Windows-like window behavior
|
|
cat > "$KDEDIR/kwinrc" << 'EOF'
|
|
[Windows]
|
|
BorderlessMaximizedWindows=false
|
|
TitlebarDoubleClick=Maximize
|
|
ClickRaise=true
|
|
FocusPolicy=ClickFocus
|
|
|
|
[org.kde.kdecoration2]
|
|
library=org.kde.lightly
|
|
theme=
|
|
|
|
[TabBox]
|
|
LayoutName=covers
|
|
EOF
|
|
|
|
# SDDM config
|
|
mkdir -p /etc/sddm.conf.d
|
|
cat > /etc/sddm.conf.d/samios.conf << 'EOF'
|
|
[Theme]
|
|
Current=breeze
|
|
CursorTheme=breeze_cursors
|
|
EOF
|
|
|
|
echo "--- Phase 5 complete ---"
|
|
|
|
# ============================================================
|
|
# PHASE 6: SamiOS Branding
|
|
# ============================================================
|
|
echo "--- Phase 6: SamiOS Branding ---"
|
|
|
|
mkdir -p /usr/share/samios /usr/share/wallpapers/SamiOS
|
|
|
|
# Copy branding from C:\SamiOS\branding if available
|
|
if [ -d /mnt/c/SamiOS/branding ]; then
|
|
cp /mnt/c/SamiOS/branding/* /usr/share/samios/ 2>/dev/null || true
|
|
fi
|
|
|
|
# Version file — generate the display string from the canonical VERSION.
|
|
# Resolution order: walk-up from script dir to ./VERSION, then
|
|
# /etc/samios-version (canonical mirror installed by the installer),
|
|
# then a documented placeholder. Same fallback chain as the samios
|
|
# CLI's _lookup_version so the two never disagree on what counts as
|
|
# "unresolved".
|
|
_SAMIOS_DESK_VERSION=""
|
|
_d="$(cd "$(dirname "$0")" && pwd)"
|
|
while [ "$_d" != "/" ]; do
|
|
if [ -f "$_d/VERSION" ]; then
|
|
_SAMIOS_DESK_VERSION="$(head -n1 "$_d/VERSION")"
|
|
break
|
|
fi
|
|
_d="$(dirname "$_d")"
|
|
done
|
|
if [ -z "$_SAMIOS_DESK_VERSION" ] && [ -r /etc/samios-version ]; then
|
|
_SAMIOS_DESK_VERSION="$(head -n1 /etc/samios-version)"
|
|
fi
|
|
[ -z "$_SAMIOS_DESK_VERSION" ] && _SAMIOS_DESK_VERSION="0.0.0-unknown"
|
|
unset _d
|
|
echo "SamiOS ${_SAMIOS_DESK_VERSION} (WSL Desktop)" > /usr/share/samios/version
|
|
unset _SAMIOS_DESK_VERSION
|
|
|
|
# SDDM theme override
|
|
mkdir -p /usr/share/sddm/themes/breeze
|
|
cat > /usr/share/sddm/themes/breeze/theme.conf << 'EOF'
|
|
[General]
|
|
background=/usr/share/wallpapers/SamiOS/samios-wallpaper.png
|
|
EOF
|
|
|
|
echo "--- Phase 6 complete ---"
|
|
|
|
# ============================================================
|
|
# PHASE 7: Font Management
|
|
# ============================================================
|
|
echo "--- Phase 7: Fonts ---"
|
|
|
|
mkdir -p /usr/share/fonts/samios
|
|
|
|
# Copy Sami's fonts from Windows (exclude any with 7777 in name)
|
|
if [ -d /mnt/c/Windows/Fonts ]; then
|
|
find /mnt/c/Windows/Fonts -type f \( -iname "*.ttf" -o -iname "*.otf" -o -iname "*.ttc" \) \
|
|
! -iname "*7777*" \
|
|
-exec cp {} /usr/share/fonts/samios/ \; 2>/dev/null
|
|
echo "Copied Windows fonts (excluding 7777)"
|
|
fi
|
|
|
|
# Also check C:\SamiOS\fonts
|
|
if [ -d /mnt/c/SamiOS/fonts ]; then
|
|
find /mnt/c/SamiOS/fonts -type f \( -iname "*.ttf" -o -iname "*.otf" \) \
|
|
! -iname "*7777*" \
|
|
-exec cp {} /usr/share/fonts/samios/ \; 2>/dev/null
|
|
echo "Copied C:\\SamiOS\\fonts (excluding 7777)"
|
|
fi
|
|
|
|
# Rebuild font cache
|
|
fc-cache -f
|
|
FONT_COUNT=$(fc-list | wc -l)
|
|
echo "Total fonts installed: $FONT_COUNT"
|
|
|
|
# Verify no 7777 fonts
|
|
if fc-list | grep -i "7777"; then
|
|
echo "WARNING: 7777 fonts detected!"
|
|
else
|
|
echo "OK: No 7777 fonts present"
|
|
fi
|
|
|
|
echo "--- Phase 7 complete ---"
|
|
|
|
# ============================================================
|
|
# PHASE 8: WSLg + Plasma launch script
|
|
# ============================================================
|
|
echo "--- Phase 8: Launch script ---"
|
|
|
|
mkdir -p /usr/local/bin
|
|
cat > /usr/local/bin/start-samios << 'EOF'
|
|
#!/bin/bash
|
|
# Start SamiOS Plasma desktop in WSLg
|
|
export DISPLAY=:0
|
|
export WAYLAND_DISPLAY=wayland-0
|
|
export XDG_RUNTIME_DIR=/mnt/wslg/runtime-dir
|
|
export PULSE_SERVER=/mnt/wslg/PulseServer
|
|
export XDG_SESSION_TYPE=x11
|
|
export XDG_CURRENT_DESKTOP=KDE
|
|
|
|
# Start dbus
|
|
if ! pgrep -x dbus-daemon >/dev/null; then
|
|
dbus-launch --sh-syntax > /tmp/dbus-env
|
|
source /tmp/dbus-env
|
|
fi
|
|
|
|
# Start pipewire
|
|
if ! pgrep -x pipewire >/dev/null; then
|
|
pipewire &
|
|
pipewire-pulse &
|
|
wireplumber &
|
|
fi
|
|
|
|
echo "Starting KDE Plasma..."
|
|
startplasma-x11 2>/tmp/plasma.log &
|
|
echo "Plasma started. Check /tmp/plasma.log for errors."
|
|
EOF
|
|
chmod +x /usr/local/bin/start-samios
|
|
|
|
# Create a Windows-side shortcut script
|
|
cat > /mnt/c/SamiOS/start-samios.bat << 'EOF'
|
|
@echo off
|
|
echo Starting SamiOS Desktop...
|
|
wsl -d Arch -u sami -- /usr/local/bin/start-samios
|
|
EOF
|
|
|
|
echo "--- Phase 8 complete ---"
|
|
|
|
# ============================================================
|
|
# PHASE 9: SamiOS CLI tool
|
|
# ============================================================
|
|
echo "--- Phase 9: SamiOS CLI ---"
|
|
|
|
cat > /usr/local/bin/samios << 'EOF'
|
|
#!/bin/bash
|
|
# SamiOS CLI (WSL desktop variant) — installed by samios-desktop-setup.sh
|
|
# No embedded VERSION literal: walks up to /etc/samios-version at runtime.
|
|
set -e
|
|
|
|
_lookup_version() {
|
|
local d
|
|
d="$(cd "$(dirname "$0")" && pwd)"
|
|
while [ "$d" != "/" ]; do
|
|
if [ -f "$d/VERSION" ]; then
|
|
head -n1 "$d/VERSION"
|
|
return 0
|
|
fi
|
|
d="$(dirname "$d")"
|
|
done
|
|
if [ -r /etc/samios-version ]; then
|
|
head -n1 /etc/samios-version
|
|
return 0
|
|
fi
|
|
echo "0.0.0-unknown"
|
|
}
|
|
VERSION="$(_lookup_version)"
|
|
unset -f _lookup_version
|
|
|
|
cmd_help() {
|
|
cat << HELPEOF
|
|
SamiOS CLI v${VERSION}
|
|
|
|
Commands:
|
|
version Show version
|
|
status Show system status
|
|
desktop Start KDE Plasma desktop
|
|
update Update system packages
|
|
install <pkg> Install a package
|
|
remove <pkg> Remove a package
|
|
fonts Check fonts and policy
|
|
help Show this help
|
|
HELPEOF
|
|
}
|
|
|
|
cmd_version() {
|
|
echo "SamiOS v${VERSION}"
|
|
echo "Kernel: $(uname -r)"
|
|
echo "Desktop: KDE Plasma on WSLg"
|
|
}
|
|
|
|
cmd_status() {
|
|
echo "=== SamiOS System Status ==="
|
|
echo "Version: ${VERSION}"
|
|
echo "Hostname: $(hostname)"
|
|
echo "Kernel: $(uname -r)"
|
|
echo "Uptime: $(uptime -p)"
|
|
echo
|
|
echo "=== Disk ==="
|
|
df -h / | tail -1
|
|
echo
|
|
echo "=== Memory ==="
|
|
free -h | grep "Mem:"
|
|
echo
|
|
echo "=== Network ==="
|
|
ip -br addr show 2>/dev/null | grep -v "lo" || echo "no interfaces"
|
|
}
|
|
|
|
cmd_desktop() {
|
|
/usr/local/bin/start-samios
|
|
}
|
|
|
|
cmd_update() {
|
|
sudo pacman -Syu --noconfirm
|
|
}
|
|
|
|
cmd_install() {
|
|
[ -z "$1" ] && echo "Usage: samios install <package>" && exit 1
|
|
sudo pacman -S --noconfirm "$1"
|
|
}
|
|
|
|
cmd_remove() {
|
|
[ -z "$1" ] && echo "Usage: samios remove <package>" && exit 1
|
|
sudo pacman -R --noconfirm "$1"
|
|
}
|
|
|
|
cmd_fonts() {
|
|
echo "=== Installed Fonts ==="
|
|
fc-list | wc -l
|
|
echo "fonts installed"
|
|
echo
|
|
echo "=== Font Policy ==="
|
|
echo "Excluded: fonts with '7777' in name (personal branding)"
|
|
echo
|
|
if fc-list | grep -iq "7777"; then
|
|
echo "WARNING: Found fonts with '7777' in name:"
|
|
fc-list | grep -i "7777"
|
|
else
|
|
echo "OK: No forbidden fonts detected"
|
|
fi
|
|
}
|
|
|
|
case "${1:-}" in
|
|
version) cmd_version ;;
|
|
status) cmd_status ;;
|
|
desktop) cmd_desktop ;;
|
|
update) cmd_update ;;
|
|
install) shift; cmd_install "$@" ;;
|
|
remove) shift; cmd_remove "$@" ;;
|
|
fonts) cmd_fonts ;;
|
|
help|--help|-h|"") cmd_help ;;
|
|
*) echo "Unknown command: $1"; echo "Run 'samios help'"; exit 1 ;;
|
|
esac
|
|
EOF
|
|
chmod +x /usr/local/bin/samios
|
|
|
|
echo "--- Phase 9 complete ---"
|
|
|
|
# ============================================================
|
|
# PHASE 10: Fix ownership
|
|
# ============================================================
|
|
echo "--- Phase 10: Fix ownership ---"
|
|
chown -R sami:sami "$SAMHOME/.config" 2>/dev/null || true
|
|
echo "--- Phase 10 complete ---"
|
|
|
|
echo ""
|
|
echo "============================================"
|
|
echo "=== SamiOS Desktop Setup COMPLETE ==="
|
|
echo "============================================"
|
|
echo ""
|
|
echo "To start the desktop:"
|
|
echo " 1. Open Command Prompt or Terminal"
|
|
echo " 2. Run: C:\\SamiOS\\start-samios.bat"
|
|
echo " Or inside WSL: samios desktop"
|
|
echo ""
|
|
echo "To check system status: samios status"
|
|
echo ""
|