Add --skip-signing option

This commit is contained in:
Ryan Hughes committed 2025-08-28 23:04:48 +03:00
1 parent c57c9620de
commit c7b4bdd3a1
2 files changed
+43 -25

No files matched your search

+25 -11
View File
@@ -33,8 +33,16 @@ print_header "Omarchy AUR Package Builder"
# Parse command line arguments # Parse command line arguments
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
case $1 in case $1 in
--skip-signing)
SKIP_SIGNING=true
shift
;;
-h | --help) -h | --help)
echo "Usage: $0" echo "Usage: $0 [OPTIONS]"
echo ""
echo "Options:"
echo " --skip-signing Build packages without GPG signing"
echo " -h, --help Show this help message"
echo "" echo ""
echo "This script builds AUR packages from:" echo "This script builds AUR packages from:"
echo " build/packages/omarchy-aur.packages" echo " build/packages/omarchy-aur.packages"
@@ -54,30 +62,35 @@ if [[ ! -f "$BUILD_DIR/packages/omarchy-aur.packages" ]]; then
exit 1 exit 1
fi fi
# Get GPG key from 1Password or environment for signing # Handle GPG signing setup
if [[ -z "$GPG_PRIVATE_KEY" ]]; then if [[ "$SKIP_SIGNING" == true ]]; then
print_warning "Skipping GPG signing (--skip-signing flag set)"
else
# Get GPG key from 1Password or environment for signing
if [[ -z "$GPG_PRIVATE_KEY" ]]; then
print_info "Fetching GPG signing key from 1Password..." print_info "Fetching GPG signing key from 1Password..."
GPG_PRIVATE_KEY=$(op document get "Omarchy GPG Private Key" --account=omarchy.1password.com) || { GPG_PRIVATE_KEY=$(op document get "Omarchy GPG Private Key" --account=omarchy.1password.com) || {
print_error "Failed to fetch GPG key from 1Password or environment" print_error "Failed to fetch GPG key from 1Password or environment"
exit 1 exit 1
} }
else else
print_info "Using existing GPG signing key from environment" print_info "Using existing GPG signing key from environment"
fi fi
export GPG_PRIVATE_KEY="$GPG_PRIVATE_KEY" export GPG_PRIVATE_KEY="$GPG_PRIVATE_KEY"
# Get passphrase from 1Password or environment # Get passphrase from 1Password or environment
if [[ -z "$GPG_PASSPHRASE" ]]; then if [[ -z "$GPG_PASSPHRASE" ]]; then
print_info "Fetching GPG key passphrase from 1Password..." print_info "Fetching GPG key passphrase from 1Password..."
GPG_PASSPHRASE=$(op item get "Omarchy GPG Private Key" --account=omarchy.1password.com --fields password --reveal) || { GPG_PASSPHRASE=$(op item get "Omarchy GPG Private Key" --account=omarchy.1password.com --fields password --reveal) || {
print_error "Failed to fetch GPG passphrase from 1Password or environment" print_error "Failed to fetch GPG passphrase from 1Password or environment"
exit 1 exit 1
} }
else else
print_info "Using existing GPG passphrase from environment" print_info "Using existing GPG passphrase from environment"
fi
export GPG_PASSPHRASE
print_success "GPG signing key and passphrase loaded"
fi fi
export GPG_PASSPHRASE
print_success "GPG signing key and passphrase loaded"
# Build/update the Docker image # Build/update the Docker image
print_info "Building Docker image..." print_info "Building Docker image..."
@@ -87,6 +100,7 @@ print_info "Running AUR package build..."
# Build Docker arguments # Build Docker arguments
DOCKER_ARGS=( DOCKER_ARGS=(
--rm --rm
-e SKIP_SIGNING
-e GPG_PRIVATE_KEY -e GPG_PRIVATE_KEY
-e GPG_PASSPHRASE -e GPG_PASSPHRASE
-v "$ARCH_DIR:/output" -v "$ARCH_DIR:/output"
+18 -14
View File
@@ -3,22 +3,26 @@
echo "==> Importing GPG keys..." echo "==> Importing GPG keys..."
# Import signing key (required) # Check if signing is enabled
echo " -> Importing signing key..." if [[ "$SKIP_SIGNING" == true ]]; then
# Import with batch mode and no tty for automated signing echo " -> Skipping signing key import (--skip-signing enabled)"
echo "$GPG_PRIVATE_KEY" | gpg --batch --import || { else
# Import signing key (required for signing)
echo " -> Importing signing key..."
# Import with batch mode and no tty for automated signing
echo "$GPG_PRIVATE_KEY" | gpg --batch --import || {
echo " -> ERROR: Failed to import signing key" echo " -> ERROR: Failed to import signing key"
exit 1 exit 1
} }
# Configure GPG for automated signing with passphrase # Configure GPG for automated signing with passphrase
echo "allow-loopback-pinentry" >>~/.gnupg/gpg-agent.conf echo "allow-loopback-pinentry" >>~/.gnupg/gpg-agent.conf
echo "pinentry-mode loopback" >>~/.gnupg/gpg.conf echo "pinentry-mode loopback" >>~/.gnupg/gpg.conf
gpg-connect-agent reloadagent /bye 2>/dev/null || true gpg-connect-agent reloadagent /bye 2>/dev/null || true
# Extract key ID and configure # Extract key ID and configure
KEY_ID=$(gpg --list-secret-keys --keyid-format LONG | grep "sec" | head -1 | awk '{print $2}' | cut -d'/' -f2) KEY_ID=$(gpg --list-secret-keys --keyid-format LONG | grep "sec" | head -1 | awk '{print $2}' | cut -d'/' -f2)
if [[ -n "$KEY_ID" ]]; then if [[ -n "$KEY_ID" ]]; then
# Trust the key using fingerprint # Trust the key using fingerprint
FINGERPRINT=$(gpg --list-secret-keys --with-colons | grep "^fpr" | head -1 | cut -d':' -f10) FINGERPRINT=$(gpg --list-secret-keys --with-colons | grep "^fpr" | head -1 | cut -d':' -f10)
echo "$FINGERPRINT:6:" | gpg --import-ownertrust echo "$FINGERPRINT:6:" | gpg --import-ownertrust
@@ -35,9 +39,10 @@ if [[ -n "$KEY_ID" ]]; then
exit 1 exit 1
fi fi
echo " -> GPG signing test successful" echo " -> GPG signing test successful"
else else
echo " -> ERROR: Could not extract key ID" echo " -> ERROR: Could not extract key ID"
exit 1 exit 1
fi
fi fi
# Read the gpg-keys.txt file for verification keys # Read the gpg-keys.txt file for verification keys
@@ -68,4 +73,3 @@ else
fi fi
echo " -> GPG setup complete" echo " -> GPG setup complete"