ArchySP/scripts/_build-alarm.sh

63 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# This script runs inside an aarch64 Arch Linux container and creates a
# rootfs tarball with X11, RetroArch, and all dependencies for ES-DE.
set -e
target="$(mktemp -d)"
trap 'rm -rf "$target"' 0
# Initialize pacman keyring
pacman-key --init
pacman-key --populate archlinuxarm || true
# Install base system + emulation stack
pacstrap -c "$target" \
base \
linux-firmware \
networkmanager \
openssh \
sudo \
mesa \
xorg-server \
xorg-xinit \
xf86-video-fbdev \
retroarch \
retroarch-assets \
libretro-core-info \
exfatprogs \
fuse2 \
wget \
unzip \
htop \
nano
# Configure hostname
echo "h700" > "$target/etc/hostname"
# Configure locale
echo "en_US.UTF-8 UTF-8" > "$target/etc/locale.gen"
chroot "$target" locale-gen
echo "LANG=en_US.UTF-8" > "$target/etc/locale.conf"
# Enable services
chroot "$target" systemctl enable NetworkManager
chroot "$target" systemctl enable sshd
# Create emulation user
chroot "$target" useradd -m -G wheel,video,audio,input -s /bin/bash emulation
echo "emulation:emulation" | chroot "$target" chpasswd
# Allow wheel group sudo
echo "%wheel ALL=(ALL:ALL) NOPASSWD: ALL" > "$target/etc/sudoers.d/wheel"
# Set DNS fallback
echo "nameserver 8.8.8.8" > "$target/etc/resolv.conf"
# MOTD
cat > "$target/etc/motd" << '__EOF__'
ALARM H700 Emulation Image
SSH is available. Default user: emulation / emulation
__EOF__
tar cf "${1:-/tmp/rootfs.tar}" -C "$target" .