The builder stage never declared ARG MIRROR, so the keyring [omarchy] repo pointed at the channel-less legacy pkgs.omarchy.org/$arch path — it works only because a stale copy of the old layout still answers there, and it would miss a keyring rotation. Each image now pulls omarchy-keyring from its own channel (edge/rc/stable), matching the base mirror it already selects. update-repo and remove-package switch to the edge x86_64 image: repo-add and repo-remove compile nothing, and using the channel image would deadlock bootstrap-rc — the rc image can only build once the rc channel it pulls the keyring from exists remotely.
119 lines
2.7 KiB
Bash
Executable File
119 lines
2.7 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..")
|
|
source "$BUILD_ROOT/helpers/message-helpers.sh"
|
|
source "$BUILD_ROOT/helpers/docker-helpers.sh"
|
|
source "$BUILD_ROOT/helpers/paths.sh"
|
|
source "$BUILD_ROOT/helpers/lock-helpers.sh"
|
|
|
|
print_header "Remove Package"
|
|
|
|
# Parse arguments
|
|
PACKAGE_NAME=""
|
|
while [[ $# -gt 0 ]]; do
|
|
case $1 in
|
|
--arch)
|
|
ARCH="$2"
|
|
update_arch_paths
|
|
shift 2
|
|
;;
|
|
--mirror)
|
|
MIRROR="$2"
|
|
require_valid_mirror "$MIRROR"
|
|
update_arch_paths
|
|
shift 2
|
|
;;
|
|
-h | --help)
|
|
echo "Usage: $0 <package-name> [OPTIONS]"
|
|
echo ""
|
|
echo "Options:"
|
|
echo " --arch <arch> Target architecture (x86_64 or aarch64, default: x86_64)"
|
|
echo " --mirror <mirror> Mirror to use (edge, rc, or stable, default: edge)"
|
|
echo " -h, --help Show this help message"
|
|
exit 0
|
|
;;
|
|
*)
|
|
if [[ -z "$PACKAGE_NAME" ]]; then
|
|
PACKAGE_NAME="$1"
|
|
else
|
|
print_error "Unknown option: $1"
|
|
exit 1
|
|
fi
|
|
shift
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if [[ -z "$PACKAGE_NAME" ]]; then
|
|
print_error "Package name required"
|
|
echo ""
|
|
echo "Usage: $0 <package-name> [OPTIONS]"
|
|
exit 1
|
|
fi
|
|
|
|
print_info "Target architecture: $ARCH"
|
|
print_info "Mirror: $MIRROR"
|
|
print_info "Repository: $REPO_DIR"
|
|
|
|
# Check if repository exists
|
|
if [[ ! -d "$REPO_DIR" ]]; then
|
|
print_error "Repository directory not found: $REPO_DIR"
|
|
exit 1
|
|
fi
|
|
|
|
# Check Docker is available
|
|
check_docker
|
|
|
|
# Find package files to confirm before running Docker
|
|
cd "$REPO_DIR"
|
|
FILES=$(ls ${PACKAGE_NAME}-[0-9]*.pkg.tar.* 2>/dev/null || true)
|
|
|
|
if [[ -z "$FILES" ]]; then
|
|
print_error "Package '$PACKAGE_NAME' not found"
|
|
exit 1
|
|
fi
|
|
|
|
# Confirm removal
|
|
echo ""
|
|
echo "Package files to remove:"
|
|
for file in $FILES; do
|
|
echo " - $file"
|
|
done
|
|
echo ""
|
|
read -p "Remove package '$PACKAGE_NAME'? (y/N) " -n 1 -r
|
|
echo
|
|
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
|
print_info "Removal cancelled"
|
|
exit 0
|
|
fi
|
|
|
|
# Build/update the Docker image (always use x86_64 for removal - it's architecture independent)
|
|
# repo-remove is mirror-independent — always use the edge x86_64 image
|
|
build_docker_image "$BUILD_DIR" "x86_64" "edge"
|
|
|
|
acquire_release_lock || exit 1
|
|
|
|
print_info "Removing package..."
|
|
|
|
# Ensure directory is writable by container user
|
|
make_dir_writable "$REPO_DIR"
|
|
|
|
# Run the removal script in Docker (always use x86_64 image)
|
|
docker run --rm --platform linux/amd64 \
|
|
-e ARCH="$ARCH" \
|
|
-e MIRROR="$MIRROR" \
|
|
-v "$REPO_ROOT:/pkgs.omarchy.org" \
|
|
-v "$BUILD_DIR:/build:ro" \
|
|
omarchy-pkg-builder:latest-x86_64-edge /build/remove-package.sh "$PACKAGE_NAME"
|
|
|
|
RESULT=$?
|
|
|
|
echo ""
|
|
if [[ $RESULT -eq 0 ]]; then
|
|
print_success "Package removal completed successfully!"
|
|
else
|
|
print_error "Package removal failed"
|
|
exit $RESULT
|
|
fi
|