Validate --local-source paths before any sudo work
Also includes the build-iso.sh cleanup that I prepared earlier but forgot to stage (replacing the inline ugly $(...) conditional pipe with a normal if/then-fi block).
This commit is contained in:
2 files changed
+21
-10
No files matched your search
+10
-5
@@ -49,6 +49,14 @@ while [[ $# -gt 0 ]]; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Validate local-source paths up front (before any sudo / network work).
|
||||||
|
if [[ -n $LOCAL_INSTALLER_PATH ]]; then
|
||||||
|
[[ -d $LOCAL_INSTALLER_PATH ]] || { echo "Error: installer checkout not found at $LOCAL_INSTALLER_PATH" >&2; exit 1; }
|
||||||
|
[[ -d $LOCAL_PKGS_PATH ]] || { echo "Error: pkgs checkout not found at $LOCAL_PKGS_PATH" >&2; exit 1; }
|
||||||
|
LOCAL_INSTALLER_PATH=$(realpath "$LOCAL_INSTALLER_PATH")
|
||||||
|
LOCAL_PKGS_PATH=$(realpath "$LOCAL_PKGS_PATH")
|
||||||
|
fi
|
||||||
|
|
||||||
# Clear out old packages
|
# Clear out old packages
|
||||||
sudo rm -rf /var/cache/pacman/pkg/*
|
sudo rm -rf /var/cache/pacman/pkg/*
|
||||||
|
|
||||||
@@ -80,12 +88,9 @@ DOCKER_ARGS=(
|
|||||||
-v "$BUILD_ROOT/configs:/configs:ro"
|
-v "$BUILD_ROOT/configs:/configs:ro"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Mount the local checkouts when --local-source was passed.
|
# Mount the local checkouts when --local-source was passed (paths already
|
||||||
|
# validated/resolved above).
|
||||||
if [[ -n $LOCAL_INSTALLER_PATH ]]; then
|
if [[ -n $LOCAL_INSTALLER_PATH ]]; then
|
||||||
[[ -d $LOCAL_INSTALLER_PATH ]] || { echo "Error: installer checkout not found at $LOCAL_INSTALLER_PATH" >&2; exit 1; }
|
|
||||||
[[ -d $LOCAL_PKGS_PATH ]] || { echo "Error: pkgs checkout not found at $LOCAL_PKGS_PATH" >&2; exit 1; }
|
|
||||||
LOCAL_INSTALLER_PATH=$(realpath "$LOCAL_INSTALLER_PATH")
|
|
||||||
LOCAL_PKGS_PATH=$(realpath "$LOCAL_PKGS_PATH")
|
|
||||||
DOCKER_ARGS+=(
|
DOCKER_ARGS+=(
|
||||||
-v "$LOCAL_INSTALLER_PATH:/omarchy-installer:ro"
|
-v "$LOCAL_INSTALLER_PATH:/omarchy-installer:ro"
|
||||||
-v "$LOCAL_PKGS_PATH:/omarchy-pkgs:ro"
|
-v "$LOCAL_PKGS_PATH:/omarchy-pkgs:ro"
|
||||||
|
|||||||
+11
-5
@@ -72,20 +72,26 @@ else
|
|||||||
base_pkg_lists=(/tmp/omarchy-pkglists/usr/share/omarchy/install/omarchy-base.packages /tmp/omarchy-pkglists/usr/share/omarchy/install/omarchy-other.packages)
|
base_pkg_lists=(/tmp/omarchy-pkglists/usr/share/omarchy/install/omarchy-base.packages /tmp/omarchy-pkglists/usr/share/omarchy/install/omarchy-other.packages)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Collect every package we want available in the offline mirror.
|
||||||
declare -a all_packages
|
declare -a all_packages
|
||||||
mapfile -t all_packages < <(
|
mapfile -t all_packages < <(
|
||||||
{
|
{
|
||||||
cat "$build_cache_dir/packages.x86_64"
|
cat "$build_cache_dir/packages.x86_64"
|
||||||
grep -hv '^#\|^$' "${base_pkg_lists[@]}"
|
grep -hv '^#\|^$' "${base_pkg_lists[@]}"
|
||||||
grep -hv '^#\|^$' /builder/archinstall.packages
|
grep -hv '^#\|^$' /builder/archinstall.packages
|
||||||
# Always include the omarchy meta-package set so the target install can
|
# Always include the omarchy meta-packages so the target install can find
|
||||||
# find omarchy-installer in the offline mirror.
|
# omarchy-installer in the offline mirror.
|
||||||
printf 'omarchy\nomarchy-settings\nomarchy-installer\nomarchy-limine\n'
|
printf 'omarchy\nomarchy-settings\nomarchy-installer\nomarchy-limine\n'
|
||||||
} |
|
} | sort -u
|
||||||
$([[ -n ${LOCAL_OMARCHY_BUILD:-} ]] && echo "grep -vE ^(omarchy|omarchy-settings|omarchy-installer|omarchy-limine)$" || echo cat) |
|
|
||||||
sort -u
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# With --local-source we already built the four omarchy* packages directly
|
||||||
|
# into the mirror; strip them from the pacman -Syw list so it doesn't try to
|
||||||
|
# fetch the published versions on top.
|
||||||
|
if [[ -n ${LOCAL_OMARCHY_BUILD:-} ]]; then
|
||||||
|
all_packages=($(printf '%s\n' "${all_packages[@]}" | grep -vE '^(omarchy|omarchy-settings|omarchy-installer|omarchy-limine)$'))
|
||||||
|
fi
|
||||||
|
|
||||||
mkdir -p /tmp/offlinedb
|
mkdir -p /tmp/offlinedb
|
||||||
pacman --config /configs/pacman-online-${OMARCHY_MIRROR}.conf --noconfirm -Syw \
|
pacman --config /configs/pacman-online-${OMARCHY_MIRROR}.conf --noconfirm -Syw \
|
||||||
"${all_packages[@]}" --cachedir "$offline_mirror_dir/" --dbpath /tmp/offlinedb --needed
|
"${all_packages[@]}" --cachedir "$offline_mirror_dir/" --dbpath /tmp/offlinedb --needed
|
||||||
|
|||||||
Reference in new issue
Block a user