Skip to content

Commit 2994d82

Browse files
fix: exclude legacy RPM targets from GPG signing with recent key (#143)
Signed-off-by: Patrick Stephens <pat@fluent.do>
1 parent 6d83cdd commit 2994d82

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

install.sh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ if [ -n "${DISABLE_CONTROL_CHARS:-}" ]; then
4949
NC=''
5050
fi
5151

52+
# Any additional options to pass to the package manager
53+
INSTALL_ADDITIONAL_PARAMETERS=${INSTALL_ADDITIONAL_PARAMETERS:-}
54+
5255
# ============================================================================
5356
# Prerequisites Check
5457
# ============================================================================
@@ -674,24 +677,27 @@ install_package() {
674677
log_warning "Unable to update repositories"
675678
log_debug "$SUDO $PKG_MANAGER update failed"
676679
fi
677-
log_debug "Running: $SUDO $PKG_MANAGER install -y $package_file"
678-
if ! $SUDO "$PKG_MANAGER" install -y "$package_file"; then
680+
log_debug "Running: $SUDO $PKG_MANAGER install -y $INSTALL_ADDITIONAL_PARAMETERS $package_file"
681+
# shellcheck disable=SC2086
682+
if ! $SUDO "$PKG_MANAGER" install -y $INSTALL_ADDITIONAL_PARAMETERS "$package_file"; then
679683
log_error "Failed to install .deb package"
680684
return 1
681685
fi
682686
;;
683687
rpm)
684688
log_debug "Installing .rpm package"
685-
log_debug "Running: $SUDO $PKG_MANAGER install -y $package_file"
686-
if ! $SUDO "$PKG_MANAGER" install -y "$package_file"; then
689+
log_debug "Running: $SUDO $PKG_MANAGER install -y $INSTALL_ADDITIONAL_PARAMETERS $package_file"
690+
# shellcheck disable=SC2086
691+
if ! $SUDO "$PKG_MANAGER" install -y $INSTALL_ADDITIONAL_PARAMETERS "$package_file"; then
687692
log_error "Failed to install .rpm package"
688693
return 1
689694
fi
690695
;;
691696
apk)
692697
log_debug "Installing .apk package"
693-
log_debug "Running: $SUDO $PKG_MANAGER add --allow-untrusted $package_file"
694-
if ! $SUDO "$PKG_MANAGER" add --allow-untrusted "$package_file"; then
698+
log_debug "Running: $SUDO $PKG_MANAGER add --allow-untrusted $INSTALL_ADDITIONAL_PARAMETERS $package_file"
699+
# shellcheck disable=SC2086
700+
if ! $SUDO "$PKG_MANAGER" add --allow-untrusted $INSTALL_ADDITIONAL_PARAMETERS "$package_file"; then
695701
log_error "Failed to install .apk package"
696702
return 1
697703
fi

scripts/sign-packages.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,18 @@ fi
3131
if [[ -n "$GPG_KEY" ]]; then
3232
if command -v rpm &>/dev/null; then
3333
echo "INFO: RPM signing"
34-
# Sign all RPMs
34+
35+
# Now sign everything
3536
find "$BASE_DIR" -type f -name "*.rpm" -print -exec rpm --define "_gpg_name $GPG_KEY" --addsign {} \;
37+
38+
# Legacy targets have some issues with more recent GPG keys: https://superuser.com/a/977804
39+
excludePackages=("package-centos-6" "package-centos-7" "package-centos-8" "package-almalinux-8" "package-rockylinux-8")
40+
for i in "${excludePackages[@]}"; do
41+
if [[ -d "$BASE_DIR"/"$i" ]]; then
42+
echo "Removing GPG key from legacy package: $i"
43+
find "$BASE_DIR"/"$i" -type f -name "*.rpm" -print -exec rpm --delsign {} \;
44+
fi
45+
done
3646
else
3747
echo "WARNING: skipping RPM signing"
3848
fi

0 commit comments

Comments
 (0)