#!/usr/bin/env bash # OrionOS 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: orionos.iso set -euo pipefail WORK=/tmp/orionos-build ISO_NAME=orionos.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 "orionos" > /etc/hostname cat > /etc/hosts <> /etc/sudoers # enable services systemctl enable NetworkManager # initramfs mkinitcpio -P CHROOT echo ">>> Installing SkyWM & Deskbar binaries" cp "$(dirname "$0")/../wm/orionwm" "$WORK/usr/local/bin/orionwm" cp "$(dirname "$0")/../deskbar/oriondeskbar" "$WORK/usr/local/bin/oriondeskbar" chmod 755 "$WORK/usr/local/bin/orionwm" "$WORK/usr/local/bin/oriondeskbar" 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=OrionOS export GTK2_RC_FILES="$HOME/.gtkrc-2.0" cat > "$HOME/.gtkrc-2.0" < "$HOME/.config/gtk-3.0/settings.ini" <>> Writing xbindkeys config (Alt+F1 = launcher)" cat > "$WORK/home/sky/.xbindkeysrc" <<'XBK' "orionlauncher" 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/orionos/picom.conf" echo ">>> Installing GTK theme" mkdir -p "$WORK/usr/share/themes" cp -r "$(dirname "$0")/../themes/OrionOS" "$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/orionos/wallpapers" (cd "$WORK/usr/share/orionos/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 "OrionOS" { icon /EFI/refind/icons/os_linux.png volume "OrionOS" loader /boot/vmlinuz-linux initrd /boot/initramfs-linux.img options "root=LABEL=OrionOS 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/orionos-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)"