Files
OrionOS/iso/build-base.sh
T
2026-07-23 12:14:34 -04:00

168 lines
4.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# SkyOS base system builder
# Builds a bootable ISO from an Arch Linux base with the SkyWM desktop.
# Run this on an existing Arch Linux install or in a Docker container.
#
# Usage: sudo ./build-base.sh
# Output: skyos.iso
set -euo pipefail
WORK=/tmp/skyos-build
ISO_NAME=skyos.iso
SKYOS_PKGS=(
# base
base linux linux-firmware
# bootloader (EFI + BIOS — covers Intel Macs via rEFInd)
grub efibootmgr refind
# X11 stack (no display manager, just startx)
xorg-server xorg-xinit xorg-xrandr xorg-xsetroot
xterm
# fonts
ttf-dejavu ttf-liberation noto-fonts
# hardware support for Intel Macs
broadcom-wl-dkms # WiFi
xf86-video-intel # GPU (older iGPU Macs)
xf86-input-libinput
alsa-utils # audio
# tools
thunar # file manager
mousepad # text editor (GTK, lightweight)
feh # desktop wallpaper setter
picom # compositor (optional shadows)
networkmanager # networking
sudo git nano
)
echo ">>> Creating chroot at $WORK"
mkdir -p "$WORK"
echo ">>> Bootstrapping Arch base"
pacstrap "$WORK" "${SKYOS_PKGS[@]}"
echo ">>> Configuring system"
arch-chroot "$WORK" /bin/bash -s <<'CHROOT'
# locale
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
# hostname
echo "skyos" > /etc/hostname
cat > /etc/hosts <<EOF
127.0.0.1 localhost
::1 localhost
127.0.1.1 skyos.localdomain skyos
EOF
# timezone
ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
hwclock --systohc
# default user
useradd -m -G wheel,audio,video,storage -s /bin/bash sky
echo "sky:skyos" | chpasswd
echo "%wheel ALL=(ALL) ALL" >> /etc/sudoers
# enable services
systemctl enable NetworkManager
# initramfs
mkinitcpio -P
CHROOT
echo ">>> Installing SkyWM & Deskbar binaries"
cp "$(dirname "$0")/../wm/skywm" "$WORK/usr/local/bin/skywm"
cp "$(dirname "$0")/../deskbar/skydeskbar" "$WORK/usr/local/bin/skydeskbar"
chmod 755 "$WORK/usr/local/bin/skywm" "$WORK/usr/local/bin/skydeskbar"
echo ">>> Writing xinitrc"
cat > "$WORK/home/sky/.xinitrc" <<'XINITRC'
#!/bin/sh
# Set wallpaper (restores saved choice, or uses default)
skywallpaper
# Apply GTK theme
export GTK_THEME=SkyOS
export GTK2_RC_FILES="$HOME/.gtkrc-2.0"
cat > "$HOME/.gtkrc-2.0" <<EOF
include "/usr/share/themes/SkyOS/gtk-2.0/gtkrc"
EOF
mkdir -p "$HOME/.config/gtk-3.0"
cat > "$HOME/.config/gtk-3.0/settings.ini" <<EOF
[Settings]
gtk-theme-name=SkyOS
gtk-font-name=Sans 10
gtk-icon-theme-name=Adwaita
gtk-cursor-theme-name=DMZ-White
gtk-button-images=false
gtk-menu-images=false
EOF
# Compositor (subtle shadows, fast fade)
picom --config /etc/skyos/picom.conf &
# Alt+F1 global hotkey for launcher (via xbindkeys)
xbindkeys &
# Launch Deskbar
skydeskbar &
# Launch window manager (last, takes over the session)
exec skywm
XINITRC
chmod 755 "$WORK/home/sky/.xinitrc"
arch-chroot "$WORK" chown sky:sky /home/sky/.xinitrc
echo ">>> Writing xbindkeys config (Alt+F1 = launcher)"
cat > "$WORK/home/sky/.xbindkeysrc" <<'XBK'
"skylauncher"
Mod1 + F1
XBK
arch-chroot "$WORK" chown sky:sky /home/sky/.xbindkeysrc
echo ">>> Installing picom config"
mkdir -p "$WORK/etc/skyos"
cp "$(dirname "$0")/../themes/picom.conf" "$WORK/etc/skyos/picom.conf"
echo ">>> Installing GTK theme"
mkdir -p "$WORK/usr/share/themes"
cp -r "$(dirname "$0")/../themes/SkyOS" "$WORK/usr/share/themes/"
echo ">>> Installing skywallpaper helper"
cp "$(dirname "$0")/../themes/skywallpaper" "$WORK/usr/local/bin/skywallpaper"
chmod 755 "$WORK/usr/local/bin/skywallpaper"
echo ">>> Generating default wallpaper"
mkdir -p "$WORK/usr/share/skyos/wallpapers"
(cd "$WORK/usr/share/skyos/wallpapers" && bash "$(dirname "$0")/../themes/wallpapers/generate-default.sh") || true
echo ">>> Installing rEFInd bootloader config for Intel Macs"
mkdir -p "$WORK/boot/EFI/refind"
cat > "$WORK/boot/EFI/refind/refind.conf" <<'REFIND'
timeout 5
use_graphics_for linux
scanfor manual
menuentry "SkyOS" {
icon /EFI/refind/icons/os_linux.png
volume "SkyOS"
loader /boot/vmlinuz-linux
initrd /boot/initramfs-linux.img
options "root=LABEL=SkyOS rw quiet splash"
}
REFIND
echo ">>> Creating ISO"
# mkarchiso requires archiso package
if command -v mkarchiso &>/dev/null; then
# Minimal archiso profile pointing to our chroot
mkarchiso -v -w /tmp/skyos-iso-work -o . "$WORK"
mv *.iso "$ISO_NAME"
else
echo "WARNING: archiso not installed. To build the ISO:"
echo " pacman -S archiso && rerun this script"
echo " OR: use the chroot at $WORK to install manually."
fi
echo ">>> Done. Output: $ISO_NAME (or chroot at $WORK)"