From d5ed7bf0fd0f78198f123d1d514217bf56a7bc3d Mon Sep 17 00:00:00 2001 From: Torxed Date: Thu, 14 Aug 2025 00:17:29 +0200 Subject: [PATCH 1/6] Made the ISO offline-first by removing any online mirror syncs, local builds and mirror creation, as well as tweaked some AUR builds --- README.md | 2 + archinstall.packages | 28 ++++++ build_iso.sh | 199 +++++++++++++++++++++++++++++++++++-------- omarchy.packages | 133 +++++++++++++++++++++++++++++ 4 files changed, 326 insertions(+), 36 deletions(-) create mode 100644 archinstall.packages create mode 100644 omarchy.packages diff --git a/README.md b/README.md index ee8f4fc..9f83154 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,8 @@ $ docker run --rm \ -v "./permissions.patch:/permissions.patch:ro" \ -v "./aur-mirror.patch:/aur-mirror.patch:ro" \ -v "./check_connectivity.sh:/check_connectivity.sh:ro" \ + -v "./omarchy.packages:/omarchy.packages:ro" \ + -v "./archinstall.packages:/archinstall.packages:ro" \ archlinux/archlinux:latest /build_iso.sh ``` diff --git a/archinstall.packages b/archinstall.packages new file mode 100644 index 0000000..5f6cd4d --- /dev/null +++ b/archinstall.packages @@ -0,0 +1,28 @@ +nano +vim +openssh +htop +wireless_tools +wpa_supplicant +smartmontools +xdg-utils +dunst +kitty +dolphin +wofi +qt5-wayland +qt6-wayland +polkit-kde-agent +grim +xorg-server +xorg-xinit +mesa +xf86-video-amdgpu +xf86-video-ati +xf86-video-nouveau +libva-mesa-driver +libva-intel-driver +vulkan-radeon +vulkan-intel +vulkan-nouveau +sddm \ No newline at end of file diff --git a/build_iso.sh b/build_iso.sh index 227839f..d760da2 100755 --- a/build_iso.sh +++ b/build_iso.sh @@ -6,10 +6,11 @@ set -e # used to build the ISO. pacman-key --init pacman --noconfirm -Sy archlinux-keyring -pacman --noconfirm -Sy archiso git python-pip sudo base-devel +pacman --noconfirm -Sy archiso git python-pip sudo base-devel jq wget cache_dir=$(realpath --canonicalize-missing ~/.cache/omarchy/iso_$(date +%Y-%m-%d)) -aur_cache_dir="/var/cache/omarchy/mirror/aur" +offline_mirror_dir="$cache_dir/airootfs/var/cache/omarchy/mirror/offline" +aur_mirror_dir="/var/cache/omarchy/mirror/aur" # We need to fiddle with pip settings # in order to install to the correct place @@ -19,8 +20,17 @@ export PIP_ROOT_USER_ACTION="ignore" export PIP_NO_WARN_SCRIPT_LOCATION=1 export PIP_BREAK_SYSTEM_PACKAGES=1 -# Arch packages to add to the archiso profile packages -# As a base example (the TUI packages needs to be here) +# Function using the AUR web JSON RPC to query if a package exists in AUR +is_aur_package() { + resultcount=`wget -qO- "https://aur.archlinux.org/rpc/?v=5&type=info&arg=$1" 2>/dev/null | jq .resultcount` + [ "$resultcount" = "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 impala @@ -28,49 +38,173 @@ arch_packages=( openssl wget ) -# These are Python specific packages that will get installed -# onto the ISO -python_packages=( - terminaltexteffects -) aur_packages=( tzupdate ) -build_aur() { - PACKAGE=$1 - BUILDDEST=$2 +# The following package lists are what will be available +# in the ISO as "offline mirror packages". +offline_arch_packages=() +offline_aur_packages=() +prep_aur_builder() { mkdir -p /etc/sudoers.d/ useradd --create-home --shell /bin/bash aurbuilder echo "aurbuilder ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/aurbuilder +} - sudo -H -u aurbuilder git clone "https://aur.archlinux.org/$1.git" "/home/aurbuilder/$1" - - # TODO: We should add --sign here, to sign these packages - # with a key that we trust and want to use. It's only used internally in the ISO. - # but it would make sure we don't install unsigned packages even during our build process. - (cd "/home/aurbuilder/$1" && sudo -H -u aurbuilder makepkg --clean --cleanbuild --force --noconfirm --needed --syncdeps --rmdeps) - mv "/home/aurbuilder/$1/"*.pkg.tar.zst "$BUILDDEST/" - - rm -rf "/home/aurbuilder/$1" +cleanup_aur_builder() { + # Not sure why killall gpg-agent produces "gpg-agent(27): Operation not permitted" yet. + # so || true it is. + sudo -H -u aurbuilder killall gpg-agent 2>/dev/null || true + sudo -H -u aurbuilder killall dirmngr 2>/dev/null || true + sudo -H -u aurbuilder killall keyboxd 2>/dev/null || true rm /etc/sudoers.d/aurbuilder + + # Make sure no remaining processes are running under aurbuilder + # pkill -u aurbuilder + killall --user aurbuilder + + # Weirdly, certain processes will be hanging a while + # so we need to sleep before running userdel USERGROUPS_ENAB=yes userdel aurbuilder } -set_geo_mirror() { - # https://geo.mirror.pkgbuild.com/ - rm "$cache_dir/airootfs/etc/pacman.d/hooks/uncomment-mirrors.hook" - echo "Server = $1" > "$cache_dir/airootfs/etc/pacman.d/mirrorlist" +build_aur() { + local PACKAGE=$1 + local BUILDDEST=$2 + # Certain packages name, such as "yaru-icon-theme" differs from the actual + # package/build name, in this example it's "yaru" and we use PackageBase to approximate this. + local AUR_PKG_BASE=`wget -qO- "https://aur.archlinux.org/rpc/?v=5&type=info&arg=$PACKAGE" 2>/dev/null | jq -r .results[0].PackageBase` + + sudo -H -u aurbuilder git clone "https://aur.archlinux.org/$AUR_PKG_BASE.git" "/home/aurbuilder/$PACKAGE" + + # Import any GPG keys defined in the PKGBUILD + # This is normally now how you should treat AUR packages (blind trust). + # But it will be okay if we manually verify packages before each ISO build. + ( + cd "/home/aurbuilder/$PACKAGE" + source PKGBUILD + if [ -n "${validpgpkeys[*]}" ]; then + for key in "${validpgpkeys[@]}"; do + sudo -H -u aurbuilder gpg --recv-keys "$key" || true + done + fi + ) + + # TODO: We should add --sign here, to sign these packages + # with a key that we trust and want to use. It's only used internally in the ISO. + # but it would make sure we don't install unsigned packages even during our build process. + + (cd "/home/aurbuilder/$PACKAGE" && sudo -H -u aurbuilder makepkg --clean --cleanbuild --force --noconfirm --needed --syncdeps --rmdeps) + mv "/home/aurbuilder/$PACKAGE/"*.pkg.tar.zst "$BUILDDEST/" + + rm -rf "/home/aurbuilder/$PACKAGE" +} + +prepare_offline_mirror() { + # We have to build the AUR packages one by one + # and place them in a local mirror for the ISO build process. + # Otherwise the ISO won't be able to source them + + # So first we need to figure out if packages are AUR packages or not. + # As we will have to build the AUR before adding them to our mirror. + echo "Categorizing packages..." + for package_file in omarchy.packages archinstall.packages; do + if [ -f "$package_file" ]; then + echo "Processing $package_file..." + while IFS= read -r package; do + # Skip empty lines and comments + [[ -z "$package" || "$package" =~ ^[[:space:]]*# ]] && continue + + # Check if it exists in AUR + if is_aur_package "$package"; then + offline_aur_packages+=("$package") + echo " AUR: $package" + else + offline_arch_packages+=("$package") + echo " Arch: $package" + fi + done < "$package_file" + fi + done + + if [ ${#offline_aur_packages[@]} -gt 0 ]; then + prep_aur_builder + + for package in "${offline_aur_packages[@]}"; do + build_aur "$package" "$offline_mirror_dir/" + done + + cleanup_aur_builder + fi + + if [ ${#offline_arch_packages[@]} -gt 0 ]; then + mkdir -p /tmp/offlinedb + + # Download all our official packages + pacman --noconfirm -Syw "${offline_arch_packages[@]}" \ + --cachedir $offline_mirror_dir/ \ + --dbpath /tmp/offlinedb + fi + + # Apply offline mirror "patches" if we have any offline packages + # This will disable online mirrors completely, + # for now this is the best option to avoid errors trying to sync official mirrors. + if [ ${#offline_aur_packages[@]} -gt 0 ] || [ ${#offline_arch_packages[@]} -gt 0 ]; then + 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" + + # Comment out the [core] and [extra] repository sections to disable online repos + # Otherwise they might interfere + sed -i 's/^\[core\]/#\[core\]/' "$cache_dir/airootfs/etc/pacman.conf" + sed -i '/^\[core\]/,/^Include = \/etc\/pacman\.d\/mirrorlist$/ s/^Include = \/etc\/pacman\.d\/mirrorlist$/#Include = \/etc\/pacman\.d\/mirrorlist/' "$cache_dir/airootfs/etc/pacman.conf" + sed -i 's/^\[extra\]/#\[extra\]/' "$cache_dir/airootfs/etc/pacman.conf" + sed -i '/^\[extra\]/,/^Include = \/etc\/pacman\.d\/mirrorlist$/ s/^Include = \/etc\/pacman\.d\/mirrorlist$/#Include = \/etc\/pacman\.d\/mirrorlist/' "$cache_dir/airootfs/etc/pacman.conf" + + # Add offline repository to pacman.conf so the installers can do + # package lookups and installs + cat >> "$cache_dir/airootfs/etc/pacman.conf" << EOF + + [offline] + SigLevel = Optional TrustAll + Server = file:///var/cache/omarchy/mirror/offline/ +EOF + 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 $aur_cache_dir/ +mkdir -p $aur_mirror_dir/ # We base our ISO on the official arch ISO (releng) config cp -r archiso/configs/releng/* $cache_dir/ +mkdir -p $offline_mirror_dir/ + +# 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 + +prepare_offline_mirror +make_archiso_offline + # We clone the installer, and move it to the root users home folder # since this is the default user in the official releng ISO profile. git clone -b archinstall-syntax --single-branch https://github.com/Torxed/omarchy-installer "$cache_dir/airootfs/root/omarchy-installer" @@ -98,23 +232,18 @@ cat <<- _EOF_ | tee $cache_dir/airootfs/root/.automated_script.sh fi _EOF_ -# Add Arch packages to the archiso profile packages -for package in "${arch_packages[@]}"; do - echo "$package" >> "$cache_dir/packages.x86_64" -done - # We have to build the AUR packages one by one # and place them in a local mirror for the ISO build process. # Otherwise the ISO won't be able to source them if [ ${#aur_packages[@]} -gt 0 ]; then for package in "${aur_packages[@]}"; do - if build_aur "$package" "$aur_cache_dir/"; then + if build_aur "$package" "$aur_mirror_dir/"; then echo "$package" >> "$cache_dir/packages.x86_64" fi done - ls -l "$aur_cache_dir/" - repo-add --new "$aur_cache_dir/aur.db.tar.gz" "$aur_cache_dir/"*.pkg.tar.zst + ls -l "$aur_mirror_dir/" + repo-add --new "$aur_mirror_dir/aur.db.tar.gz" "$aur_mirror_dir/"*.pkg.tar.zst # And patch in the mirror to the pacman.conf to include our AUR repo (cd $cache_dir/ && git apply /aur-mirror.patch) @@ -137,6 +266,4 @@ rm "$cache_dir/airootfs/etc/motd" # file system. pip install "${python_packages[@]}" -set_geo_mirror "https://geo.mirror.pkgbuild.com/" - mkarchiso -v -w "$cache_dir/work/" -o "/out/" "$cache_dir/" \ No newline at end of file diff --git a/omarchy.packages b/omarchy.packages new file mode 100644 index 0000000..4261843 --- /dev/null +++ b/omarchy.packages @@ -0,0 +1,133 @@ +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-bin +lazygit +less +libpulse +libqalculate +libreoffice-fresh +linux +linux-firmware +llvm +localsend-bin +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-bin +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-bin +waybar +wget +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-bin +# TODO: Figure out how to dynamically find, build, and install -debug packages +# yay-bin-debug +zoom +zoxide +zram-generator \ No newline at end of file From d7e41d6926a3132d6bbfe544bf7cf9d14c1ac133 Mon Sep 17 00:00:00 2001 From: Torxed Date: Sun, 17 Aug 2025 17:35:24 +0200 Subject: [PATCH 2/6] First rc to completely offline installation process --- README.md | 1 + aur-mirror.patch | 4 +- build_iso.sh | 216 ++++++++++++++----------------------------- offline-mirror.patch | 29 ++++++ omarchy.packages | 25 +++-- permissions.patch | 4 +- 6 files changed, 120 insertions(+), 159 deletions(-) create mode 100644 offline-mirror.patch diff --git a/README.md b/README.md index 9f83154..ea7d9ed 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ $ docker run --rm \ -v "./efi-autoboot.patch:/efi-autoboot.patch:ro" \ -v "./permissions.patch:/permissions.patch:ro" \ -v "./aur-mirror.patch:/aur-mirror.patch:ro" \ + -v "./offline-mirror.patch:/offline-mirror.patch:ro" \ -v "./check_connectivity.sh:/check_connectivity.sh:ro" \ -v "./omarchy.packages:/omarchy.packages:ro" \ -v "./archinstall.packages:/archinstall.packages:ro" \ diff --git a/aur-mirror.patch b/aur-mirror.patch index 6a33d78..fc0478e 100644 --- a/aur-mirror.patch +++ b/aur-mirror.patch @@ -1,10 +1,10 @@ --- a/pacman.conf +++ b/pacman.conf -@@ -98,3 +98,7 @@ +@@ -98,3 +98,7 @@ Include = /etc/pacman.d/mirrorlist #[custom] #SigLevel = Optional TrustAll #Server = file:///home/custompkgs + +[aur] +SigLevel = Optional TrustAll -+Server = file:///var/cache/omarchy/mirror/aur/ ++Server = https://omarchy.blyg.se/$repo/os/$arch/ diff --git a/build_iso.sh b/build_iso.sh index d760da2..43dc69a 100755 --- a/build_iso.sh +++ b/build_iso.sh @@ -10,7 +10,6 @@ pacman --noconfirm -Sy archiso git python-pip sudo base-devel jq wget cache_dir=$(realpath --canonicalize-missing ~/.cache/omarchy/iso_$(date +%Y-%m-%d)) offline_mirror_dir="$cache_dir/airootfs/var/cache/omarchy/mirror/offline" -aur_mirror_dir="/var/cache/omarchy/mirror/aur" # We need to fiddle with pip settings # in order to install to the correct place @@ -20,12 +19,6 @@ export PIP_ROOT_USER_ACTION="ignore" export PIP_NO_WARN_SCRIPT_LOCATION=1 export PIP_BREAK_SYSTEM_PACKAGES=1 -# Function using the AUR web JSON RPC to query if a package exists in AUR -is_aur_package() { - resultcount=`wget -qO- "https://aur.archlinux.org/rpc/?v=5&type=info&arg=$1" 2>/dev/null | jq .resultcount` - [ "$resultcount" = "1" ] -} - # These packages will be installed **into** the ISO, and # won't be available to either archinstall or omarchy installer. python_packages=( @@ -37,141 +30,55 @@ arch_packages=( gum openssl wget + tzupdate # This is technically an AUR package ) -aur_packages=( - tzupdate -) - -# The following package lists are what will be available -# in the ISO as "offline mirror packages". -offline_arch_packages=() -offline_aur_packages=() - -prep_aur_builder() { - mkdir -p /etc/sudoers.d/ - useradd --create-home --shell /bin/bash aurbuilder - echo "aurbuilder ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/aurbuilder -} - -cleanup_aur_builder() { - # Not sure why killall gpg-agent produces "gpg-agent(27): Operation not permitted" yet. - # so || true it is. - sudo -H -u aurbuilder killall gpg-agent 2>/dev/null || true - sudo -H -u aurbuilder killall dirmngr 2>/dev/null || true - sudo -H -u aurbuilder killall keyboxd 2>/dev/null || true - - rm /etc/sudoers.d/aurbuilder - - # Make sure no remaining processes are running under aurbuilder - # pkill -u aurbuilder - killall --user aurbuilder - - # Weirdly, certain processes will be hanging a while - # so we need to sleep before running userdel - USERGROUPS_ENAB=yes userdel aurbuilder -} - -build_aur() { - local PACKAGE=$1 - local BUILDDEST=$2 - # Certain packages name, such as "yaru-icon-theme" differs from the actual - # package/build name, in this example it's "yaru" and we use PackageBase to approximate this. - local AUR_PKG_BASE=`wget -qO- "https://aur.archlinux.org/rpc/?v=5&type=info&arg=$PACKAGE" 2>/dev/null | jq -r .results[0].PackageBase` - - sudo -H -u aurbuilder git clone "https://aur.archlinux.org/$AUR_PKG_BASE.git" "/home/aurbuilder/$PACKAGE" - - # Import any GPG keys defined in the PKGBUILD - # This is normally now how you should treat AUR packages (blind trust). - # But it will be okay if we manually verify packages before each ISO build. - ( - cd "/home/aurbuilder/$PACKAGE" - source PKGBUILD - if [ -n "${validpgpkeys[*]}" ]; then - for key in "${validpgpkeys[@]}"; do - sudo -H -u aurbuilder gpg --recv-keys "$key" || true - done - fi - ) - - # TODO: We should add --sign here, to sign these packages - # with a key that we trust and want to use. It's only used internally in the ISO. - # but it would make sure we don't install unsigned packages even during our build process. - - (cd "/home/aurbuilder/$PACKAGE" && sudo -H -u aurbuilder makepkg --clean --cleanbuild --force --noconfirm --needed --syncdeps --rmdeps) - mv "/home/aurbuilder/$PACKAGE/"*.pkg.tar.zst "$BUILDDEST/" - - rm -rf "/home/aurbuilder/$PACKAGE" -} prepare_offline_mirror() { - # We have to build the AUR packages one by one - # and place them in a local mirror for the ISO build process. - # Otherwise the ISO won't be able to source them - - # So first we need to figure out if packages are AUR packages or not. - # As we will have to build the AUR before adding them to our mirror. - echo "Categorizing packages..." + # 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 "Processing $package_file..." + echo "Reading $package_file..." while IFS= read -r package; do # Skip empty lines and comments [[ -z "$package" || "$package" =~ ^[[:space:]]*# ]] && continue - - # Check if it exists in AUR - if is_aur_package "$package"; then - offline_aur_packages+=("$package") - echo " AUR: $package" - else - offline_arch_packages+=("$package") - echo " Arch: $package" - fi + all_packages+=("$package") done < "$package_file" fi done - if [ ${#offline_aur_packages[@]} -gt 0 ]; then - prep_aur_builder + 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) - for package in "${offline_aur_packages[@]}"; do - build_aur "$package" "$offline_mirror_dir/" - done - - cleanup_aur_builder - fi - - if [ ${#offline_arch_packages[@]} -gt 0 ]; then mkdir -p /tmp/offlinedb + + echo "$cache_dir/" + ls -l "$cache_dir/" - # Download all our official packages - pacman --noconfirm -Syw "${offline_arch_packages[@]}" \ + # 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 - fi - - # Apply offline mirror "patches" if we have any offline packages - # This will disable online mirrors completely, - # for now this is the best option to avoid errors trying to sync official mirrors. - if [ ${#offline_aur_packages[@]} -gt 0 ] || [ ${#offline_arch_packages[@]} -gt 0 ]; then + 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" - # Comment out the [core] and [extra] repository sections to disable online repos - # Otherwise they might interfere - sed -i 's/^\[core\]/#\[core\]/' "$cache_dir/airootfs/etc/pacman.conf" - sed -i '/^\[core\]/,/^Include = \/etc\/pacman\.d\/mirrorlist$/ s/^Include = \/etc\/pacman\.d\/mirrorlist$/#Include = \/etc\/pacman\.d\/mirrorlist/' "$cache_dir/airootfs/etc/pacman.conf" - sed -i 's/^\[extra\]/#\[extra\]/' "$cache_dir/airootfs/etc/pacman.conf" - sed -i '/^\[extra\]/,/^Include = \/etc\/pacman\.d\/mirrorlist$/ s/^Include = \/etc\/pacman\.d\/mirrorlist$/#Include = \/etc\/pacman\.d\/mirrorlist/' "$cache_dir/airootfs/etc/pacman.conf" - - # Add offline repository to pacman.conf so the installers can do - # package lookups and installs - cat >> "$cache_dir/airootfs/etc/pacman.conf" << EOF - - [offline] - SigLevel = Optional TrustAll - Server = file:///var/cache/omarchy/mirror/offline/ -EOF + # 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 /aur-mirror.patch) fi } @@ -190,18 +97,11 @@ make_archiso_offline() { } mkdir -p $cache_dir/ -mkdir -p $aur_mirror_dir/ +mkdir -p $offline_mirror_dir/ # We base our ISO on the official arch ISO (releng) config cp -r archiso/configs/releng/* $cache_dir/ -mkdir -p $offline_mirror_dir/ - -# 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 - prepare_offline_mirror make_archiso_offline @@ -212,6 +112,8 @@ mv "$cache_dir/airootfs/root/omarchy-installer/installer" "$cache_dir/airootfs/r mv "$cache_dir/airootfs/root/omarchy-installer/logo.txt" "$cache_dir/airootfs/root/logo.txt" rm -rf "$cache_dir/airootfs/root/omarchy-installer" +git clone -b dev git@github.com:basecamp/omarchy.git "$cache_dir/airootfs/root/omarchy" + # Copy in the connectivity check script cp /check_connectivity.sh "$cache_dir/airootfs/root/check_connectivity.sh" @@ -228,27 +130,13 @@ cat <<- _EOF_ | tee $cache_dir/airootfs/root/.automated_script.sh --config user_configuration.json \ --creds user_credentials.json \ --silent && \ - wget -qO- https://omarchy.org/install | bash + export OMARCHY_USER=\$(ls /home/) && \ + cp -r /root/omarchy "/home/\$OMARCHY_USER/" && \ + chown \$OMARCHY_USER "/home/\$OMARCHY_USER/omarchy" \ + su - \$OMARCHY_USER -c "source /home/\$OMARCHY_USER/omarchy/install.sh" fi _EOF_ -# We have to build the AUR packages one by one -# and place them in a local mirror for the ISO build process. -# Otherwise the ISO won't be able to source them -if [ ${#aur_packages[@]} -gt 0 ]; then - for package in "${aur_packages[@]}"; do - if build_aur "$package" "$aur_mirror_dir/"; then - echo "$package" >> "$cache_dir/packages.x86_64" - fi - done - - ls -l "$aur_mirror_dir/" - repo-add --new "$aur_mirror_dir/aur.db.tar.gz" "$aur_mirror_dir/"*.pkg.tar.zst - - # And patch in the mirror to the pacman.conf to include our AUR repo - (cd $cache_dir/ && git apply /aur-mirror.patch) -fi - # We patch permissions, grub and efi loaders to our liking: (cd $cache_dir/ && git apply /permissions.patch) (cd $cache_dir/ && git apply /grub-autoboot.patch) @@ -266,4 +154,38 @@ rm "$cache_dir/airootfs/etc/motd" # 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/" \ No newline at end of file diff --git a/offline-mirror.patch b/offline-mirror.patch new file mode 100644 index 0000000..c0d1941 --- /dev/null +++ b/offline-mirror.patch @@ -0,0 +1,29 @@ +--- 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/omarchy.packages b/omarchy.packages index 4261843..b186434 100644 --- a/omarchy.packages +++ b/omarchy.packages @@ -52,7 +52,7 @@ iwd jq kdenlive kvantum-qt5 -lazydocker-bin +lazydocker lazygit less libpulse @@ -61,7 +61,7 @@ libreoffice-fresh linux linux-firmware llvm -localsend-bin +localsend luarocks mako man-db @@ -76,9 +76,9 @@ noto-fonts-emoji noto-fonts-extra nss-mdns obs-studio -obsidian-bin +obsidian pamixer -pinta +# pinta pipewire pipewire-alsa pipewire-jack @@ -110,7 +110,7 @@ ufw ufw-docker unzip uwsm -walker-bin +walker waybar wget whois @@ -125,9 +125,16 @@ xdg-desktop-portal-hyprland xmlstarlet xournalpp yaru-icon-theme -yay-bin -# TODO: Figure out how to dynamically find, build, and install -debug packages -# yay-bin-debug +yay +yay-debug zoom zoxide -zram-generator \ No newline at end of file +zram-generator +webp-pixbuf-loader +autoconf-archive +intltool +gtk4-layer-shell +sassc +libsass +dart +qt5-remoteobjects \ No newline at end of file diff --git a/permissions.patch b/permissions.patch index 43104db..c032fa2 100644 --- a/permissions.patch +++ b/permissions.patch @@ -1,13 +1,15 @@ --- a/profiledef.sh +++ b/profiledef.sh -@@ -21,7 +21,8 @@ +@@ -21,7 +21,10 @@ file_permissions=( ["/root"]="0:0:750" ["/root/.automated_script.sh"]="0:0:755" ["/root/.gnupg"]="0:0:700" + ["/root/installer"]="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" ) From 2a789b954aadf6a4f3cf9a2fbb81f30b22e06872 Mon Sep 17 00:00:00 2001 From: Torxed Date: Sun, 17 Aug 2025 17:38:01 +0200 Subject: [PATCH 3/6] Placed the omarchy installer in the correct folder under the new user --- build_iso.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/build_iso.sh b/build_iso.sh index 43dc69a..2a0d179 100755 --- a/build_iso.sh +++ b/build_iso.sh @@ -112,7 +112,7 @@ mv "$cache_dir/airootfs/root/omarchy-installer/installer" "$cache_dir/airootfs/r mv "$cache_dir/airootfs/root/omarchy-installer/logo.txt" "$cache_dir/airootfs/root/logo.txt" rm -rf "$cache_dir/airootfs/root/omarchy-installer" -git clone -b dev git@github.com:basecamp/omarchy.git "$cache_dir/airootfs/root/omarchy" +git clone -b dev --single-branch https://github.com/basecamp/omarchy.git "$cache_dir/airootfs/root/omarchy" # Copy in the connectivity check script cp /check_connectivity.sh "$cache_dir/airootfs/root/check_connectivity.sh" @@ -131,9 +131,10 @@ cat <<- _EOF_ | tee $cache_dir/airootfs/root/.automated_script.sh --creds user_credentials.json \ --silent && \ export OMARCHY_USER=\$(ls /home/) && \ - cp -r /root/omarchy "/home/\$OMARCHY_USER/" && \ - chown \$OMARCHY_USER "/home/\$OMARCHY_USER/omarchy" \ - su - \$OMARCHY_USER -c "source /home/\$OMARCHY_USER/omarchy/install.sh" + mkdir -p /home/\$OMARCHY_USER/.local/share/ && \ + cp -r /root/omarchy "/home/\$OMARCHY_USER/.local/share/" && \ + chown -R \$OMARCHY_USER: "/home/\$OMARCHY_USER//.local/" \ + su - \$OMARCHY_USER -c "source /home/\$OMARCHY_USER/.local/share/omarchy/install.sh" fi _EOF_ From b2bc8f2eba829b744d892cad57f3954799a10990 Mon Sep 17 00:00:00 2001 From: Torxed Date: Sun, 17 Aug 2025 17:41:28 +0200 Subject: [PATCH 4/6] Forgot that omarchy installer should run as the user, inside the newly installed system, not inside the ISO --- build_iso.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build_iso.sh b/build_iso.sh index 2a0d179..d5b2f99 100755 --- a/build_iso.sh +++ b/build_iso.sh @@ -130,11 +130,11 @@ cat <<- _EOF_ | tee $cache_dir/airootfs/root/.automated_script.sh --config user_configuration.json \ --creds user_credentials.json \ --silent && \ - export OMARCHY_USER=\$(ls /home/) && \ - mkdir -p /home/\$OMARCHY_USER/.local/share/ && \ - cp -r /root/omarchy "/home/\$OMARCHY_USER/.local/share/" && \ - chown -R \$OMARCHY_USER: "/home/\$OMARCHY_USER//.local/" \ - su - \$OMARCHY_USER -c "source /home/\$OMARCHY_USER/.local/share/omarchy/install.sh" + 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 \$OMARCHY_USER: "/mnt/home/\$OMARCHY_USER/.local/" \ + arch-chroot -u \$OMARCHY_USER /mnt/ "source ~/.local/share/omarchy/install.sh" fi _EOF_ From d178fea9aa528512b130f964ce6ef124bbbdde16 Mon Sep 17 00:00:00 2001 From: Torxed Date: Sun, 17 Aug 2025 17:51:32 +0200 Subject: [PATCH 5/6] Missing efibootmgr --- archinstall.packages | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/archinstall.packages b/archinstall.packages index 5f6cd4d..91b0d65 100644 --- a/archinstall.packages +++ b/archinstall.packages @@ -25,4 +25,5 @@ libva-intel-driver vulkan-radeon vulkan-intel vulkan-nouveau -sddm \ No newline at end of file +sddm +efibootmgr \ No newline at end of file From 7f737c5da4e84bcfb21c0ea319a14c6638c385a3 Mon Sep 17 00:00:00 2001 From: Torxed Date: Sun, 17 Aug 2025 23:40:36 +0200 Subject: [PATCH 6/6] Enabled the omarchy post-installation - also added 'additional packages' to archinstall --- .gitignore | 3 ++- archinstall.packages | 3 ++- build_iso.sh | 42 ++++++++++++++++++++++++++++++++++++------ omarchy.packages | 2 +- 4 files changed, 41 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 1e0a55d..8e41205 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ out/ **/**.iso -/*.txt \ No newline at end of file +/*.txt +**/**.qcow2 diff --git a/archinstall.packages b/archinstall.packages index 91b0d65..d9c4a9a 100644 --- a/archinstall.packages +++ b/archinstall.packages @@ -26,4 +26,5 @@ vulkan-radeon vulkan-intel vulkan-nouveau sddm -efibootmgr \ No newline at end of file +efibootmgr +intel-media-driver diff --git a/build_iso.sh b/build_iso.sh index d5b2f99..2f47ab7 100755 --- a/build_iso.sh +++ b/build_iso.sh @@ -57,9 +57,6 @@ prepare_offline_mirror() { (cd $cache_dir/ && git apply /aur-mirror.patch) mkdir -p /tmp/offlinedb - - echo "$cache_dir/" - ls -l "$cache_dir/" # 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. @@ -130,11 +127,44 @@ cat <<- _EOF_ | tee $cache_dir/airootfs/root/.automated_script.sh --config user_configuration.json \ --creds user_credentials.json \ --silent && \ - export OMARCHY_USER=\$(ls /mnt/home/) && \ + 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 \$OMARCHY_USER: "/mnt/home/\$OMARCHY_USER/.local/" \ - arch-chroot -u \$OMARCHY_USER /mnt/ "source ~/.local/share/omarchy/install.sh" + 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 && \ + HOME=/home/\$OMARCHY_USER arch-chroot -u \$OMARCHY_USER /mnt/ /bin/bash -c "source /home/\$OMARCHY_USER/.local/share/omarchy/install.sh" fi _EOF_ diff --git a/omarchy.packages b/omarchy.packages index b186434..0166cf1 100644 --- a/omarchy.packages +++ b/omarchy.packages @@ -137,4 +137,4 @@ gtk4-layer-shell sassc libsass dart -qt5-remoteobjects \ No newline at end of file +qt5-remoteobjects