diff --git a/bin/omarchy-iso-make b/bin/omarchy-iso-make index 56c65e1..fbe4360 100755 --- a/bin/omarchy-iso-make +++ b/bin/omarchy-iso-make @@ -3,11 +3,40 @@ # Abort if anything fails set -e +# Parse command line arguments +BUILD_MODE="offline" +NO_CACHE="" +while [[ $# -gt 0 ]]; do + case $1 in + --online) + BUILD_MODE="online" + shift + ;; + --offline) + BUILD_MODE="offline" + shift + ;; + --no-cache) + NO_CACHE=1 + shift + ;; + --no-boot-offer) + NO_BOOT_OFFER=1 + shift + ;; + *) + echo "Unknown option: $1" + echo "Usage: $0 [--online|--offline] [--no-cache] [--no-boot-offer]" + exit 1 + ;; + esac +done + # Ensure we have the submodule checked out git submodule update --init --recursive --jobs=8 # Prepare build repo -BUILD_SCRIPT="builder/online.sh" +BUILD_SCRIPT="builder/build-iso.sh" BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..") BUILD_RELEASE_PATH="$BUILD_ROOT/release" mkdir -p "$BUILD_RELEASE_PATH" @@ -27,10 +56,12 @@ DOCKER_ARGS=( -e "OMARCHY_INSTALLER_REPO=$OMARCHY_INSTALLER_REPO" -e "OMARCHY_INSTALLER_REF=$OMARCHY_INSTALLER_REF" -e "OMARCHY_INSTALLER_URL=$OMARCHY_INSTALLER_URL" + -e "OMARCHY_BUILD_MODE=$BUILD_MODE" -v "$BUILD_RELEASE_PATH/:/out/" -v "$BUILD_ROOT/$BUILD_SCRIPT:/$BUILD_SCRIPT:ro" -v "$BUILD_ROOT/archiso:/archiso:ro" -v "$BUILD_ROOT/builder:/builder:ro" + -v "$BUILD_ROOT/configs:/configs:ro" ) # Use local pacman cache if you already have one on host to speed up repeat runs @@ -38,19 +69,27 @@ if [ -d "/var/cache/pacman/pkg" ]; then DOCKER_ARGS+=(-v "/var/cache/pacman/pkg:/var/cache/pacman/pkg") fi +# Mount the build cache directory where packages are downloaded for the offline repo +# Only applicable for offline builds and when --no-cache is not specified +if [[ "$BUILD_MODE" == "offline" && -z "$NO_CACHE" ]]; then + # using a dated dir on the host to refresh daily if building multiple times + BUILD_DATE=$(date +%Y-%m-%d) + OFFLINE_REPO_BUILD_CACHE_DIR="$HOME/.cache/omarchy/iso_${BUILD_DATE}/airootfs/var/cache/omarchy" + mkdir -p "$OFFLINE_REPO_BUILD_CACHE_DIR" + # Mount to /var/cache/airootfs/var/cache/omarchy since that's where repo packages go in the ISO + DOCKER_ARGS+=(-v "$OFFLINE_REPO_BUILD_CACHE_DIR:/var/cache/airootfs/var/cache/omarchy") +fi + # Run the builder with assembled args docker run "${DOCKER_ARGS[@]}" archlinux/archlinux:latest /$BUILD_SCRIPT -# Make iso accessible to all -sudo chmod 777 -R "$BUILD_RELEASE_PATH" - # Move as install ref latest_iso=$(\ls -t "$BUILD_RELEASE_PATH"/*.iso | head -n1) iso_ref="${latest_iso%.*}-$OMARCHY_INSTALLER_REF.iso" -mv "$latest_iso" "$iso_ref" +mv -f "$latest_iso" "$iso_ref" # Offer to boot the new build -if [[ $1 != "--no-boot-offer" ]]; then +if [[ -z "$NO_BOOT_OFFER" ]]; then echo gum confirm "Boot $iso_ref?" && omarchy-iso-boot "$iso_ref" fi diff --git a/builder/packages/archinstall.packages b/builder/archinstall.packages similarity index 78% rename from builder/packages/archinstall.packages rename to builder/archinstall.packages index d9c4a9a..5433f65 100644 --- a/builder/packages/archinstall.packages +++ b/builder/archinstall.packages @@ -28,3 +28,13 @@ vulkan-nouveau sddm efibootmgr intel-media-driver +amd-ucode +intel-ucode +sof-firmware +base +base-devel +linux-firmware +linux +limine +pipewire +snapper diff --git a/builder/build-iso.sh b/builder/build-iso.sh new file mode 100755 index 0000000..0a4c114 --- /dev/null +++ b/builder/build-iso.sh @@ -0,0 +1,157 @@ +#!/bin/bash + +set -e + +# Build mode: offline (default) or online │ │ +OMARCHY_BUILD_MODE="${OMARCHY_BUILD_MODE:-offline}" + +# Note that these are packages installed to the Arch container +# used to build the ISO. +pacman-key --init +pacman --noconfirm -Sy archlinux-keyring +pacman --noconfirm -Sy archiso git python-pip sudo base-devel jq + +build_cache_dir="/var/cache" +offline_mirror_dir="$build_cache_dir/airootfs/var/cache/omarchy/mirror/offline" +offline_ruby_dir="$build_cache_dir/airootfs/var/cache/omarchy/ruby" + +# We need to fiddle with pip settings +# in order to install to the correct place +# as well as ignore some errors to make this less verbose +export PIP_ROOT="$build_cache_dir/airootfs/" +export PIP_ROOT_USER_ACTION="ignore" +export PIP_NO_WARN_SCRIPT_LOCATION=1 +export PIP_BREAK_SYSTEM_PACKAGES=1 + +# These packages will be installed **into** the ISO, and +# won't be available to either archinstall or omarchy installer. +python_packages=( + terminaltexteffects +) +arch_packages=( + git + gum + jq + openssl + plymouth + tzupdate +) + +prepare_offline_mirror() { + # Certain packages in omarchy.packages are AUR packages. + # These needs to be pre-built and placed in https://pkgs.omarchy.org/$arch + echo "Reading and combining packages from all package files..." + + # Combine all packages into one array + # Start with base ISO packages (including our arch_packages already appended) + all_packages=($(cat "$build_cache_dir/packages.x86_64")) + + # Add packages from the omarchy installer's unified package list + all_packages+=($(grep -v '^#' "$build_cache_dir/airootfs/root/omarchy/install/omarchy-base.packages" | grep -v '^$')) + all_packages+=($(grep -v '^#' "$build_cache_dir/airootfs/root/omarchy/install/omarchy-other.packages" | grep -v '^$')) + + # Add archinstall needed packages + all_packages+=($(grep -v '^#' /builder/archinstall.packages | grep -v '^$')) + + if [ ${#all_packages[@]} -gt 0 ]; then + mkdir -p /tmp/offlinedb + + # Download all the packages to the offline mirror inside the ISO + echo "Downloading all packages (including AUR) to offline mirror: ${all_packages[@]}" + pacman --config /configs/pacman-online.conf \ + --noconfirm -Syw "${all_packages[@]}" \ + --cachedir $offline_mirror_dir/ \ + --dbpath /tmp/offlinedb + + repo-add --new "$offline_mirror_dir/offline.db.tar.gz" "$offline_mirror_dir/"*.pkg.tar.zst + + rm "$build_cache_dir/airootfs/etc/pacman.d/hooks/uncomment-mirrors.hook" + fi +} + +disable_reflector() { + # Avoid using reflector for mirror identification as we are relying on the global CDN + rm "$build_cache_dir/airootfs/etc/systemd/system/multi-user.target.wants/reflector.service" + rm -rf "$build_cache_dir/airootfs/etc/systemd/system/reflector.service.d" + rm -rf "$build_cache_dir/airootfs/etc/xdg/reflector" +} + +####################### +# Build process start +####################### + +mkdir -p $build_cache_dir/ +mkdir -p $offline_mirror_dir/ +mkdir -p $offline_ruby_dir/ + +# We base our ISO on the official arch ISO (releng) config +cp -r /archiso/configs/releng/* $build_cache_dir/ +rm "$build_cache_dir/airootfs/etc/motd" +disable_reflector + +# Bring in our configs +cp -r /configs/* $build_cache_dir/ + +# Clone Omarchy itself +git clone -b $OMARCHY_INSTALLER_REF https://github.com/$OMARCHY_INSTALLER_REPO.git "$build_cache_dir/airootfs/root/omarchy" + +# Make log uploader available in the ISO too +mkdir -p "$build_cache_dir/airootfs/usr/local/bin/" +cp "$build_cache_dir/airootfs/root/omarchy/bin/omarchy-upload-log" "$build_cache_dir/airootfs/usr/local/bin/omarchy-upload-log" + +# Copy the Omarchy Plymouth theme to the ISO +mkdir -p "$build_cache_dir/airootfs/usr/share/plymouth/themes/omarchy" +cp -r "$build_cache_dir/airootfs/root/omarchy/default/plymouth/"* "$build_cache_dir/airootfs/usr/share/plymouth/themes/omarchy/" + +# Download the configurator +mkdir -p "$build_cache_dir/airootfs/root" +curl -fsSL -o "$build_cache_dir/airootfs/root/configurator" \ + "https://raw.githubusercontent.com/$OMARCHY_CONFIGURATOR_REPO/$OMARCHY_CONFIGURATOR_REF/configurator" + +if [ "$OMARCHY_BUILD_MODE" = "online" ]; then + echo "$OMARCHY_INSTALLER_REPO" >$build_cache_dir/airootfs/root/omarchy_installer_repo.txt + echo "$OMARCHY_INSTALLER_REF" >$build_cache_dir/airootfs/root/omarchy_installer_ref.txt + echo "$OMARCHY_INSTALLER_URL" >$build_cache_dir/airootfs/root/omarchy_installer_url.txt + echo "online" >$build_cache_dir/airootfs/root/omarchy_install_mode.txt +else + echo "offline" >$build_cache_dir/airootfs/root/omarchy_install_mode.txt +fi + +# Add our additional packages to packages.x86_64 +printf '%s\n' "${arch_packages[@]}" >>"$build_cache_dir/packages.x86_64" + +if [ "$OMARCHY_BUILD_MODE" = "offline" ]; then + prepare_offline_mirror + + # Download Ruby tarball if not already cached + ruby_tarball="ruby-3.4.5-rails-8.0.2.1-x86_64.tar.gz" + if [ ! -f "$offline_ruby_dir/$ruby_tarball" ]; then + echo "Downloading Ruby tarball..." + curl -fsSL -o "$offline_ruby_dir/$ruby_tarball" \ + "https://pkgs.omarchy.org/ruby/$ruby_tarball" + else + echo "Ruby tarball already cached, skipping download" + fi + + # Create a symlink to the offline mirror instead of duplicating it. + # mkarchiso needs packages at /var/cache/omarchy/mirror/offline in the container, + # but they're actually in $build_cache_dir/airootfs/var/cache/omarchy/mirror/offline + mkdir -p /var/cache/omarchy/mirror + ln -s "$offline_mirror_dir" "/var/cache/omarchy/mirror/offline" +fi + +# Install Python packages for the installer into the ISO +# file system. +pip install "${python_packages[@]}" + +if [ "$OMARCHY_BUILD_MODE" = "online" ]; then + # Copy the online version so we use it for build and ISO boot + cp $build_cache_dir/pacman-online.conf $build_cache_dir/pacman.conf +fi + +# Copy the pacman.conf to the ISO's /etc directory so the live environment uses our +# same config when booted +cp $build_cache_dir/pacman.conf "$build_cache_dir/airootfs/etc/pacman.conf" + +# Finally, we assemble the entire ISO +mkarchiso -v -w "$build_cache_dir/work/" -o "/out/" "$build_cache_dir/" diff --git a/builder/cmds/autostart.sh b/builder/cmds/autostart.sh deleted file mode 100644 index c5f5957..0000000 --- a/builder/cmds/autostart.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -chroot_bash() { - HOME=/home/$OMARCHY_USER \ - arch-chroot -u $OMARCHY_USER /mnt/ \ - env OMARCHY_CHROOT_INSTALL=1 \ - OMARCHY_USER_NAME="$(/dev/null && umount -R /mnt - - # Install using files generated by the ./configurator - archinstall \ - --config user_configuration.json \ - --creds user_credentials.json \ - --silent - - # No need to ask for sudo during the installation (omarchy itself responsible for removing after install) - mkdir -p /mnt/etc/sudoers.d - cat >/mnt/etc/sudoers.d/99-omarchy-installer </dev/null || echo "https://omarchy.org/install") - chroot_bash -lc "curl -fsSL $OMARCHY_INSTALL_URL | bash || bash" -fi diff --git a/builder/offline.sh b/builder/offline.sh deleted file mode 100755 index a080620..0000000 --- a/builder/offline.sh +++ /dev/null @@ -1,223 +0,0 @@ -#!/bin/bash - -set -e - -# Note that these are packages installed to the Arch container -# used to build the ISO. -pacman-key --init -pacman --noconfirm -Sy archlinux-keyring -pacman --noconfirm -Sy archiso git python-pip sudo base-devel jq - -cache_dir=$(realpath --canonicalize-missing ~/.cache/omarchy/iso_$(date +%Y-%m-%d)) -offline_mirror_dir="$cache_dir/airootfs/var/cache/omarchy/mirror/offline" - -# We need to fiddle with pip settings -# in order to install to the correct place -# as well as ignore some errors to make this less verbose -export PIP_ROOT="$cache_dir/airootfs/" -export PIP_ROOT_USER_ACTION="ignore" -export PIP_NO_WARN_SCRIPT_LOCATION=1 -export PIP_BREAK_SYSTEM_PACKAGES=1 - -# These packages will be installed **into** the ISO, and -# won't be available to either archinstall or omarchy installer. -python_packages=( - terminaltexteffects -) -arch_packages=( - git - gum - openssl - tzupdate # This is technically an AUR package -) - -prepare_offline_mirror() { - # Certain packages in omarchy.packages are AUR packages. - # These needs to be pre-built and placed in https://omarchy.blyg.se/aur/os/x86_64/ - echo "Reading and combining packages from all package files..." - - # Combine all packages from both files into one array - all_packages=() - for package_file in omarchy.packages archinstall.packages; do - if [ -f "$package_file" ]; then - echo "Reading $package_file..." - while IFS= read -r package; do - # Skip empty lines and comments - [[ -z "$package" || "$package" =~ ^[[:space:]]*# ]] && continue - all_packages+=("$package") - done <"$package_file" - fi - done - - if [ ${#all_packages[@]} -gt 0 ]; then - # This assume we've manually built all the AUR packages - # and made them accessible "online" during the build process: - (cd $cache_dir/ && git apply /aur-mirror.patch) - - mkdir -p /tmp/offlinedb - - # Change DownloadUser from alpm to root to fix permission issues when downloading to cache dir - # TODO: We should move the build root from /root/.cache/omarchy/ into /var/cache instead. - # That way alpm:alpm will have access, which is the default pacman download user now days. - sed -i 's/^#*DownloadUser = alpm/DownloadUser = root/' /etc/pacman.conf - - # Download all the packages to the offline mirror inside the ISO - pacman --config $cache_dir/pacman.conf \ - --noconfirm -Syw "${all_packages[@]}" \ - --cachedir $offline_mirror_dir/ \ - --dbpath /tmp/offlinedb - - repo-add --new "$offline_mirror_dir/offline.db.tar.gz" "$offline_mirror_dir/"*.pkg.tar.zst - - rm "$cache_dir/airootfs/etc/pacman.d/hooks/uncomment-mirrors.hook" - - # Revert the "online" AUR patch, as we'll replace it with the proper - # offline patched mirror for the ISO later. - (cd $cache_dir && git apply -R /builder/patches/offline/aur-mirror.patch) - fi -} - -make_archiso_offline() { - # This function will simply disable any online activity we have. - # for instance the reflector.service which tries to optimize - # mirror order by fetching the latest mirror list by default. - # - # We'll leave some things online, like NTP as that won't - # interfere with anything, on the flip side it will help if we do - # have internet connectivity. - - rm "$cache_dir/airootfs/etc/systemd/system/multi-user.target.wants/reflector.service" - rm -rf "$cache_dir/airootfs/etc/systemd/system/reflector.service.d" - rm -rf "$cache_dir/airootfs/etc/xdg/reflector" -} - -mkdir -p $cache_dir/ -mkdir -p $offline_mirror_dir/ - -# We base our ISO on the official arch ISO (releng) config -cp -r archiso/configs/releng/* $cache_dir/ - -prepare_offline_mirror -make_archiso_offline - -# Insert the configurator in the root users home folder (default user in the official releng ISO profile). -curl -fsSL -o "airootfs/root/configurator" \ - "https://raw.githubusercontent.com/$OMARCHY_CONFIGURATOR_REPO/$OMARCHY_CONFIGURATOR_REF/configurator" - -# Clone Omarchy itself -git clone -b dev --single-branch https://github.com/basecamp/omarchy.git "$cache_dir/airootfs/root/omarchy" - -# We add in our auto-start applications -# First we'll check for an active internet connection -# Then we'll start the omarchy installer -cat <<-_EOF_ | tee $cache_dir/airootfs/root/.automated_script.sh - #!/usr/bin/env bash - - if [[ \$(tty) == "/dev/tty1" ]]; then - sh ./check_connectivity.sh && \ - sh ./installer && \ - archinstall \ - --config user_configuration.json \ - --creds user_credentials.json \ - --silent && \ - export OMARCHY_USER=\`ls /mnt/home/\` && \ - - mkdir -p /mnt/home/\$OMARCHY_USER/.local/share/ && \ - cp -r /root/omarchy "/mnt/home/\$OMARCHY_USER/.local/share/" && \ - chown -R 1000:1000 "/mnt/home/\$OMARCHY_USER/.local/" && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/apps/mimetypes.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/apps/webapps.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/apps/xtras.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/config/detect-keyboard-layout.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/config/fix-fkeys.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/config/network.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/config/nvidia.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/config/power.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/config/timezones.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/config/config.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/config/identification.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/config/increase-sudo-tries.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/config/login.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/desktop/asdcontrol.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/desktop/bluetooth.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/desktop/fonts.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/desktop/hyprlandia.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/desktop/printer.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/desktop/theme.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/desktop/desktop.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/development/development.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/development/nvim.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/development/ruby.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/development/docker.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/development/firewall.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/development/terminal.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/preflight/migrations.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/preflight/aur.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/preflight/guard.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/preflight/gum.sh && \ - chmod +x /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/preflight/tte.sh && \ - echo '' > /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/preflight/tte.sh && \ - echo '' > /mnt/home/\$OMARCHY_USER/.local/share/omarchy/install/preflight/gum.sh && \ - - # Copy sudoers config to target system for passwordless sudo in chroot - mkdir -p /mnt/etc/sudoers.d && \ - cp /etc/sudoers.d/99-omarchy-installer /mnt/etc/sudoers.d/ && \ - echo "\$OMARCHY_USER ALL=(ALL:ALL) NOPASSWD: ALL" >> /mnt/etc/sudoers.d/99-omarchy-installer && \ - - HOME=/home/\$OMARCHY_USER arch-chroot -u \$OMARCHY_USER /mnt/ /bin/bash -c "source /home/\$OMARCHY_USER/.local/share/omarchy/install.sh" - fi -_EOF_ - -# We patch permissions, grub and efi loaders to our liking: -(cd $cache_dir/ && git apply /builder/patches/offline/permissions.patch) -(cd $cache_dir/ && git apply /builder/patches/grub-autoboot.patch) -(cd $cache_dir/ && git apply /builder/patches/efi-autoboot.patch) -# We could also use: -# patch -p1 < aur-mirror.patch -# patch -p1 < permissions.patch -# patch -p1 < grub-autoboot.patch -# patch -p1 < efi-autoboot.patch - -# Remove the default motd -rm "$cache_dir/airootfs/etc/motd" - -# Install Python packages for the installer into the ISO -# file system. -pip install "${python_packages[@]}" - -# Add our needed packages to packages.x86_64 -printf '%s\n' "${arch_packages[@]}" >>"$cache_dir/packages.x86_64" - -# We have to do this, because `mkarchiso` copies in the pacman.conf -# in use during the build process - so it needs to be made offline. -(cd "$cache_dir" && git apply /offline-mirror.patch) -cp $cache_dir/pacman.conf "$cache_dir/airootfs/etc/pacman.conf" - -# And we also need to duplicate the offline mirror. -# Because inside the ISO it will look for packages in /var/cache/omarchy/mirror/offline -# but that means the build of the ISO itself will also look at this location -# but in the container. -mkdir -p /var/cache/omarchy/mirror -cp -r "$offline_mirror_dir" "/var/cache/omarchy/mirror/" - -# Because this weird glitch with archiso, we also need to sync down -# all the packages we need to build the ISO, but we'll do that in the -# "host" mirror location, as we don't want them inside the ISO taking up space. -# We'll also remove tzupdate as it won't be found in upstream mirrors. -iso_packages=($(cat "$cache_dir/packages.x86_64")) - -mkdir -p /tmp/cleandb - -echo "Populating host offline mirror with ISO packages: ${iso_packages[@]}" -# And we have to use the hosts pacman.conf since all other pacman.conf -# files are prepped for offline use by this point. -pacman --config /etc/pacman.conf \ - --noconfirm -Syw $(echo "${iso_packages[@]}" | sed 's/tzupdate//g') \ - --cachedir "/var/cache/omarchy/mirror/offline/" \ - --dbpath /tmp/cleandb - -repo-add --new "/var/cache/omarchy/mirror/offline/offline.db.tar.gz" "/var/cache/omarchy/mirror/offline/"*.pkg.tar.zst - -# Finally, we assemble the entire ISO -mkarchiso -v -w "$cache_dir/work/" -o "/out/" "$cache_dir/" diff --git a/builder/online.sh b/builder/online.sh deleted file mode 100755 index f3cf857..0000000 --- a/builder/online.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -set -e - -# Note that these are packages installed to the Arch container used to build the ISO. -pacman-key --init -pacman --noconfirm -Sy archlinux-keyring archiso sudo base-devel git - -# Packages needed for the Omarchy configurator (installer will fetch its own) -arch_packages=(git gum openssl iw jq) - -# We build our iso here -cache_dir=$(realpath --canonicalize-missing ~/.cache/omarchy/iso_$(date +%Y-%m-%d)) -mkdir -p $cache_dir -cd $cache_dir - -# We base our ISO on the official arch ISO (releng) config -cp -r /archiso/configs/releng/* . - -# Add our needed packages to packages.x86_64 -printf '%s\n' "${arch_packages[@]}" >>"packages.x86_64" - -# Retrieve the latest configurator for setting up user and selecting install disk. -curl -fsSL -o "airootfs/root/configurator" \ - "https://raw.githubusercontent.com/$OMARCHY_CONFIGURATOR_REPO/$OMARCHY_CONFIGURATOR_REF/configurator" - -echo "$OMARCHY_INSTALLER_REPO" >airootfs/root/omarchy_installer_repo.txt -echo "$OMARCHY_INSTALLER_REF" >airootfs/root/omarchy_installer_ref.txt -echo "$OMARCHY_INSTALLER_URL" >airootfs/root/omarchy_installer_url.txt - -# Avoid using reflector for mirror identification as we are relying on the global CDN -rm "airootfs/etc/systemd/system/multi-user.target.wants/reflector.service" -rm -rf "airootfs/etc/systemd/system/reflector.service.d" -rm -rf "airootfs/etc/xdg/reflector" - -# Ensure the Omarchy installer launches automatically on boot -cp /builder/cmds/autostart.sh airootfs/root/.automated_script.sh - -# Patch the default archiso install files -for patch in /builder/patches/*.patch; do - git apply "$patch" -done - -# Remove the default motd -rm airootfs/etc/motd - -# Finally, we assemble the entire ISO -mkarchiso -v -w "$cache_dir/work/" -o "/out/" "$cache_dir/" diff --git a/builder/packages/omarchy.packages b/builder/packages/omarchy.packages deleted file mode 100644 index 58426a5..0000000 --- a/builder/packages/omarchy.packages +++ /dev/null @@ -1,141 +0,0 @@ -1password-beta -1password-cli -alacritty -base -base-devel -bash-completion -bat -blueberry -brightnessctl -btop -btrfs-progs -chromium -clang -cups -cups-browsed -cups-filters -cups-pdf -docker -docker-buildx -docker-compose -evince -eza -fastfetch -fcitx5 -fcitx5-gtk -fcitx5-qt -fd -ffmpegthumbnailer -fzf -gcc14 -git -github-cli -gnome-calculator -gnome-keyring -gnome-themes-extra -grub -gst-plugin-pipewire -gum -gvfs-mtp -hypridle -hyprland -hyprland-qtutils -hyprlock -hyprpicker -hyprshot -hyprsunset -imagemagick -impala -imv -inetutils -iwd -jq -kdenlive -kvantum-qt5 -lazydocker -lazygit -less -libpulse -libqalculate -libreoffice-fresh -linux -linux-firmware -llvm -localsend -luarocks -mako -man-db -mariadb-libs -mise -mpv -nautilus -neovim -noto-fonts -noto-fonts-cjk -noto-fonts-emoji -noto-fonts-extra -nss-mdns -obs-studio -obsidian -pamixer -# pinta -pipewire -pipewire-alsa -pipewire-jack -pipewire-pulse -playerctl -plocate -plymouth -polkit-gnome -postgresql-libs -power-profiles-daemon -python-terminaltexteffects -ripgrep -satty -signal-desktop -slurp -spotify -sushi -swaybg -swayosd -system-config-printer -tldr -tree-sitter-cli -ttf-cascadia-mono-nerd -ttf-ia-writer -ttf-jetbrains-mono -typora -tzupdate -ufw -ufw-docker -unzip -uwsm -walker -waybar -whois -wiremix -wireplumber -wl-clip-persist -wl-clipboard -wl-screenrec -woff2-font-awesome -xdg-desktop-portal-gtk -xdg-desktop-portal-hyprland -xmlstarlet -xournalpp -yaru-icon-theme -yay -yay-debug -zoom -zoxide -zram-generator -webp-pixbuf-loader -autoconf-archive -intltool -gtk4-layer-shell -sassc -libsass -dart -qt5-remoteobjects -dust -starship diff --git a/builder/patches/efi-autoboot.patch b/builder/patches/efi-autoboot.patch deleted file mode 100644 index b09b983..0000000 --- a/builder/patches/efi-autoboot.patch +++ /dev/null @@ -1,8 +0,0 @@ ---- a/efiboot/loader/loader.conf -+++ b/efiboot/loader/loader.conf -@@ -1,3 +1,3 @@ --timeout 15 -+timeout 0 - default 01-archiso-x86_64-linux.conf --beep on -+beep off diff --git a/builder/patches/grub-autoboot.patch b/builder/patches/grub-autoboot.patch deleted file mode 100644 index f256722..0000000 --- a/builder/patches/grub-autoboot.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/grub/grub.cfg -+++ b/grub/grub.cfg -@@ -45,8 +45,8 @@ fi - - # Set default menu entry - default=archlinux --timeout=15 --timeout_style=menu -+timeout=0 -+timeout_style=hidden - - - # Menu entries diff --git a/builder/patches/offline/aur-mirror.patch b/builder/patches/offline/aur-mirror.patch deleted file mode 100644 index fc0478e..0000000 --- a/builder/patches/offline/aur-mirror.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/pacman.conf -+++ b/pacman.conf -@@ -98,3 +98,7 @@ Include = /etc/pacman.d/mirrorlist - #[custom] - #SigLevel = Optional TrustAll - #Server = file:///home/custompkgs -+ -+[aur] -+SigLevel = Optional TrustAll -+Server = https://omarchy.blyg.se/$repo/os/$arch/ diff --git a/builder/patches/offline/offline-mirror.patch b/builder/patches/offline/offline-mirror.patch deleted file mode 100644 index c0d1941..0000000 --- a/builder/patches/offline/offline-mirror.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- a/pacman.conf -+++ b/pacman.conf -@@ -75,14 +75,14 @@ LocalFileSigLevel = Optional - #[core-testing] - #Include = /etc/pacman.d/mirrorlist - --[core] --Include = /etc/pacman.d/mirrorlist -+# [core] -+# Include = /etc/pacman.d/mirrorlist - - #[extra-testing] - #Include = /etc/pacman.d/mirrorlist - --[extra] --Include = /etc/pacman.d/mirrorlist -+# [extra] -+# Include = /etc/pacman.d/mirrorlist - - # If you want to run 32 bit applications on your x86_64 system, - # enable the multilib repositories as required here. -@@ -98,3 +98,7 @@ Include = /etc/pacman.d/mirrorlist - #[custom] - #SigLevel = Optional TrustAll - #Server = file:///home/custompkgs -+ -+[offline] -+SigLevel = Optional TrustAll -+Server = file:///var/cache/omarchy/mirror/offline/ diff --git a/builder/patches/offline/permissions.patch b/builder/patches/offline/permissions.patch deleted file mode 100644 index 6e7dee8..0000000 --- a/builder/patches/offline/permissions.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/profiledef.sh -+++ b/profiledef.sh -@@ -21,7 +21,10 @@ file_permissions=( - ["/root"]="0:0:750" - ["/root/.automated_script.sh"]="0:0:755" - ["/root/.gnupg"]="0:0:700" -+ ["/root/configurator"]="0:0:755" -+ ["/var/cache/omarchy/mirror/offline/"]="0:0:775" -+ ["/root/check_connectivity.sh"]="0:0:755" - ["/usr/local/bin/choose-mirror"]="0:0:755" -- ["/usr/local/bin/Installation_guide"]="0:0:755" -- ["/usr/local/bin/livecd-sound"]="0:0:755" -+ ["/usr/bin/tte"]="0:0:755" -+ ["/usr/lib/omarchy-installer"]="0:0:755" - ) diff --git a/builder/patches/profiledef.patch b/builder/patches/profiledef.patch deleted file mode 100644 index 0181cb8..0000000 --- a/builder/patches/profiledef.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/profiledef.sh -+++ b/profiledef.sh -@@ -1,10 +1,10 @@ - #!/usr/bin/env bash - # shellcheck disable=SC2034 - --iso_name="archlinux" -+iso_name="omarchy" - iso_label="ARCH_$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y%m)" --iso_publisher="Arch Linux " --iso_application="Arch Linux Live/Rescue DVD" -+iso_publisher="Omarchy " -+iso_application="Omarchy Installer" - iso_version="$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y.%m.%d)" - install_dir="arch" - buildmodes=('iso') -@@ -22,6 +22,5 @@ file_permissions=( - ["/root/.automated_script.sh"]="0:0:755" - ["/root/.gnupg"]="0:0:700" - ["/usr/local/bin/choose-mirror"]="0:0:755" -- ["/usr/local/bin/Installation_guide"]="0:0:755" -- ["/usr/local/bin/livecd-sound"]="0:0:755" -+ ["/root/configurator"]="0:0:755" - ) - diff --git a/configs/airootfs/etc/mkinitcpio.conf.d/archiso.conf b/configs/airootfs/etc/mkinitcpio.conf.d/archiso.conf new file mode 100644 index 0000000..26438a1 --- /dev/null +++ b/configs/airootfs/etc/mkinitcpio.conf.d/archiso.conf @@ -0,0 +1,2 @@ +# Configuration for archiso with Plymouth +HOOKS=(base udev plymouth modconf archiso archiso_loop_mnt archiso_pxe_common archiso_pxe_nbd archiso_pxe_http archiso_pxe_nfs archiso_kms block filesystems keyboard) \ No newline at end of file diff --git a/configs/airootfs/etc/plymouth/plymouthd.conf b/configs/airootfs/etc/plymouth/plymouthd.conf new file mode 100644 index 0000000..fbdb629 --- /dev/null +++ b/configs/airootfs/etc/plymouth/plymouthd.conf @@ -0,0 +1,3 @@ +[Daemon] +Theme=omarchy +ShowDelay=0 \ No newline at end of file diff --git a/configs/airootfs/root/.automated_script.sh b/configs/airootfs/root/.automated_script.sh new file mode 100644 index 0000000..447ff65 --- /dev/null +++ b/configs/airootfs/root/.automated_script.sh @@ -0,0 +1,149 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Set Tokyo Night color scheme for the terminal +set_tokyo_night_colors() { + if [[ $(tty) == "/dev/tty"* ]]; then + # Tokyo Night color palette + echo -en "\e]P01a1b26" # black (background) + echo -en "\e]P1f7768e" # red + echo -en "\e]P29ece6a" # green + echo -en "\e]P3e0af68" # yellow + echo -en "\e]P47aa2f7" # blue + echo -en "\e]P5bb9af7" # magenta + echo -en "\e]P67dcfff" # cyan + echo -en "\e]P7a9b1d6" # white + echo -en "\e]P8414868" # bright black + echo -en "\e]P9f7768e" # bright red + echo -en "\e]PA9ece6a" # bright green + echo -en "\e]PBe0af68" # bright yellow + echo -en "\e]PC7aa2f7" # bright blue + echo -en "\e]PDbb9af7" # bright magenta + echo -en "\e]PE7dcfff" # bright cyan + echo -en "\e]PFc0caf5" # bright white (foreground) + + # Set default foreground and background + echo -en "\033[0m" + clear + fi +} + +run_configurator() { + set -euo pipefail + + # Check if this is an online or offline build + if [ "${OMARCHY_INSTALL_MODE:-offline}" = "online" ]; then + ./configurator + else + NETWORK_NOT_NEEDED=true ./configurator + fi + + # Get username from installer config for reliable error recovery + export OMARCHY_USER="$(jq -r '.users[0].username' user_credentials.json)" +} + +install_base_system() { + set -euo pipefail + + # Initialize and populate the keyring + pacman-key --init + pacman-key --populate archlinux + + # Sync the offline database so pacman can find packages + pacman -Sy --noconfirm + + # Ensure that no mounts exist from past install attempts + findmnt -R /mnt >/dev/null && umount -R /mnt + + # Install using files generated by the ./configurator + # Skip NTP and WKD sync since we're offline (keyring is pre-populated in ISO) + archinstall \ + --config user_configuration.json \ + --creds user_credentials.json \ + --silent \ + --skip-ntp \ + --skip-wkd + + # After archinstall sets up the base system but before our installer runs, + # we need to ensure the offline pacman.conf is in place + cp /etc/pacman.conf /mnt/etc/pacman.conf + + # Mount the offline mirror so it's accessible in the chroot + mkdir -p /mnt/var/cache/omarchy/mirror/offline + mount --bind /var/cache/omarchy/mirror/offline /mnt/var/cache/omarchy/mirror/offline + + # Mount the ruby directory so it's accessible in the chroot + mkdir -p /mnt/var/cache/omarchy/ruby + mount --bind /var/cache/omarchy/ruby /mnt/var/cache/omarchy/ruby + + # No need to ask for sudo during the installation (omarchy itself responsible for removing after install) + mkdir -p /mnt/etc/sudoers.d + cat >/mnt/etc/sudoers.d/99-omarchy-installer </dev/null || true +} + +chroot_bash() { + HOME=/home/$OMARCHY_USER \ + arch-chroot -u $OMARCHY_USER /mnt/ \ + env OMARCHY_CHROOT_INSTALL=1 \ + OMARCHY_INSTALL_MODE="${OMARCHY_INSTALL_MODE:-offline}" \ + OMARCHY_USER_NAME="$(&1 | sed -u 's/\x1b\[[0-9;]*[a-zA-Z]//g' >>"$OMARCHY_INSTALL_LOG_FILE" + stop_log_output + show_cursor + + # Get username from the config file after installation + OMARCHY_USER="$(jq -r '.users[0].username' user_credentials.json)" + + # Install gum early so we have it for formatting + chroot_bash -lc "sudo pacman -S --noconfirm --needed gum" >/dev/null + + # Run Omarchy installer directly (skip boot.sh since it would try to clone again) + chroot_bash -lc "source /home/$OMARCHY_USER/.local/share/omarchy/install.sh || bash" +fi diff --git a/configs/efiboot/loader/entries/01-archiso-x86_64-linux.conf b/configs/efiboot/loader/entries/01-archiso-x86_64-linux.conf new file mode 100644 index 0000000..a22511b --- /dev/null +++ b/configs/efiboot/loader/entries/01-archiso-x86_64-linux.conf @@ -0,0 +1,5 @@ +title Arch Linux install medium (x86_64, UEFI) +sort-key 01 +linux /%INSTALL_DIR%/boot/x86_64/vmlinuz-linux +initrd /%INSTALL_DIR%/boot/x86_64/initramfs-linux.img +options archisobasedir=%INSTALL_DIR% archisosearchuuid=%ARCHISO_UUID% quiet splash \ No newline at end of file diff --git a/configs/efiboot/loader/loader.conf b/configs/efiboot/loader/loader.conf new file mode 100644 index 0000000..d92d6a4 --- /dev/null +++ b/configs/efiboot/loader/loader.conf @@ -0,0 +1,3 @@ +timeout 0 +default 01-archiso-x86_64-linux.conf +beep off diff --git a/configs/grub/grub.cfg b/configs/grub/grub.cfg new file mode 100644 index 0000000..9755f29 --- /dev/null +++ b/configs/grub/grub.cfg @@ -0,0 +1,108 @@ +# Load partition table and file system modules +insmod part_gpt +insmod part_msdos +insmod fat +insmod iso9660 +insmod ntfs +insmod ntfscomp +insmod exfat +insmod udf + +# Use graphics-mode output +if loadfont "${prefix}/fonts/unicode.pf2" ; then + insmod all_video + set gfxmode="auto" + terminal_input console + terminal_output console +fi + +# Enable serial console +insmod serial +insmod usbserial_common +insmod usbserial_ftdi +insmod usbserial_pl2303 +insmod usbserial_usbdebug +if serial --unit=0 --speed=115200; then + terminal_input --append serial + terminal_output --append serial +fi + +# Get a human readable platform identifier +if [ "${grub_platform}" == 'efi' ]; then + archiso_platform='UEFI' + if [ "${grub_cpu}" == 'x86_64' ]; then + archiso_platform="x64 ${archiso_platform}" + elif [ "${grub_cpu}" == 'i386' ]; then + archiso_platform="IA32 ${archiso_platform}" + else + archiso_platform="${grub_cpu} ${archiso_platform}" + fi +elif [ "${grub_platform}" == 'pc' ]; then + archiso_platform='BIOS' +else + archiso_platform="${grub_cpu} ${grub_platform}" +fi + +# Set default menu entry +default=archlinux +timeout=0 +timeout_style=hidden + + +# Menu entries + +menuentry "Arch Linux install medium (%ARCH%, ${archiso_platform})" --class arch --class gnu-linux --class gnu --class os --id 'archlinux' { + set gfxpayload=keep + linux /%INSTALL_DIR%/boot/%ARCH%/vmlinuz-linux archisobasedir=%INSTALL_DIR% archisosearchuuid=%ARCHISO_UUID% quiet splash + initrd /%INSTALL_DIR%/boot/%ARCH%/initramfs-linux.img +} + +menuentry "Arch Linux install medium with speakup screen reader (%ARCH%, ${archiso_platform})" --hotkey s --class arch --class gnu-linux --class gnu --class os --id 'archlinux-accessibility' { + set gfxpayload=keep + linux /%INSTALL_DIR%/boot/%ARCH%/vmlinuz-linux archisobasedir=%INSTALL_DIR% archisosearchuuid=%ARCHISO_UUID% accessibility=on + initrd /%INSTALL_DIR%/boot/%ARCH%/initramfs-linux.img +} + + +if [ "${grub_platform}" == 'efi' -a "${grub_cpu}" == 'x86_64' -a -f '/boot/memtest86+/memtest.efi' ]; then + menuentry 'Run Memtest86+ (RAM test)' --class memtest86 --class memtest --class gnu --class tool { + set gfxpayload=800x600,1024x768 + linux /boot/memtest86+/memtest.efi + } +fi +if [ "${grub_platform}" == 'pc' -a -f '/boot/memtest86+/memtest' ]; then + menuentry 'Run Memtest86+ (RAM test)' --class memtest86 --class memtest --class gnu --class tool { + set gfxpayload=800x600,1024x768 + linux /boot/memtest86+/memtest + } +fi +if [ "${grub_platform}" == 'efi' ]; then + if [ "${grub_cpu}" == 'x86_64' -a -f '/shellx64.efi' ]; then + menuentry 'UEFI Shell' --class efi { + chainloader /shellx64.efi + } + elif [ "${grub_cpu}" == "i386" -a -f '/shellia32.efi' ]; then + menuentry 'UEFI Shell' --class efi { + chainloader /shellia32.efi + } + fi + + menuentry 'UEFI Firmware Settings' --id 'uefi-firmware' { + fwsetup + } +fi + +menuentry 'System shutdown' --class shutdown --class poweroff { + echo 'System shutting down...' + halt +} + +menuentry 'System restart' --class reboot --class restart { + echo 'System rebooting...' + reboot +} + + +# GRUB init tune for accessibility +play 600 988 1 1319 4 + diff --git a/configs/pacman-online.conf b/configs/pacman-online.conf new file mode 100644 index 0000000..ad37f14 --- /dev/null +++ b/configs/pacman-online.conf @@ -0,0 +1,40 @@ +# +# /etc/pacman.conf +# +# See the pacman.conf(5) manpage for option and repository directives + +[options] +HoldPkg = pacman glibc +Architecture = auto +ParallelDownloads = 5 + +# By default, pacman accepts packages signed by keys that its local keyring +# trusts (see pacman-key and its man page), as well as unsigned packages. +SigLevel = Required DatabaseOptional +LocalFileSigLevel = Optional + +[core] +Server = https://mirror.omarchy.org/$repo/os/$arch +Server = https://mirror.rackspace.com/archlinux/$repo/os/$arch +Server = https://geo.mirror.pkgbuild.com/$repo/os/$arch +Include = /etc/pacman.d/mirrorlist + +[extra] +Server = https://mirror.omarchy.org/$repo/os/$arch +Server = https://mirror.rackspace.com/archlinux/$repo/os/$arch +Server = https://geo.mirror.pkgbuild.com/$repo/os/$arch +Include = /etc/pacman.d/mirrorlist + +[multilib] +Server = https://mirror.omarchy.org/$repo/os/$arch +Server = https://mirror.rackspace.com/archlinux/$repo/os/$arch +Server = https://geo.mirror.pkgbuild.com/$repo/os/$arch +Include = /etc/pacman.d/mirrorlist + +[omarchy] +SigLevel = Optional TrustAll +Server = https://pkgs.omarchy.org/$arch + +[arch-mact2] +Server = https://mirror.omarchy.org/$repo/$arch +SigLevel = Never diff --git a/configs/pacman.conf b/configs/pacman.conf new file mode 100644 index 0000000..45051ad --- /dev/null +++ b/configs/pacman.conf @@ -0,0 +1,18 @@ +# +# /etc/pacman.conf +# +# See the pacman.conf(5) manpage for option and repository directives +[options] +HoldPkg = pacman glibc +Architecture = auto +NoProgressBar +ParallelDownloads = 5 + +# By default, pacman accepts packages signed by keys that its local keyring +# trusts (see pacman-key and its man page), as well as unsigned packages. +SigLevel = Required DatabaseOptional +LocalFileSigLevel = Optional + +[offline] +SigLevel = Optional TrustAll +Server = file:///var/cache/omarchy/mirror/offline/ diff --git a/configs/profiledef.sh b/configs/profiledef.sh new file mode 100644 index 0000000..20cf7fa --- /dev/null +++ b/configs/profiledef.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# shellcheck disable=SC2034 + +iso_name="omarchy" +iso_label="ARCH_$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y%m)" +iso_publisher="Omarchy " +iso_application="Omarchy Installer" +iso_version="$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y.%m.%d)" +install_dir="arch" +buildmodes=('iso') +bootmodes=('bios.syslinux.mbr' 'bios.syslinux.eltorito' + 'uefi-ia32.systemd-boot.esp' 'uefi-x64.systemd-boot.esp' + 'uefi-ia32.systemd-boot.eltorito' 'uefi-x64.systemd-boot.eltorito') +arch="x86_64" +pacman_conf="pacman.conf" +airootfs_image_type="squashfs" +airootfs_image_tool_options=('-comp' 'xz' '-Xbcj' 'x86' '-b' '1M' '-Xdict-size' '1M') +bootstrap_tarball_compression=('zstd' '-c' '-T0' '--auto-threads=logical' '--long' '-19') +file_permissions=( + ["/etc/shadow"]="0:0:400" + ["/root"]="0:0:750" + ["/root/.automated_script.sh"]="0:0:755" + ["/root/.gnupg"]="0:0:700" + ["/usr/local/bin/choose-mirror"]="0:0:755" + ["/root/configurator"]="0:0:755" + ["/var/cache/omarchy/mirror/offline/"]="0:0:775" + ["/usr/bin/tte"]="0:0:755" + ["/usr/local/bin/omarchy-upload-log"]="0:0:755" +)