diff --git a/packages/termux-keyring/build.sh b/packages/termux-keyring/build.sh index 0b84b8047138f4..81a5cdc0b63094 100644 --- a/packages/termux-keyring/build.sh +++ b/packages/termux-keyring/build.sh @@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="GPG public keys for the official Termux repositories" TERMUX_PKG_LICENSE="Apache-2.0" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=3.12 +TERMUX_PKG_REVISION=1 TERMUX_PKG_AUTO_UPDATE=false TERMUX_PKG_SKIP_SRC_EXTRACT=true TERMUX_PKG_PLATFORM_INDEPENDENT=true @@ -11,6 +12,8 @@ TERMUX_PKG_ESSENTIAL=true termux_step_make_install() { local GPG_SHARE_DIR="$TERMUX_PREFIX/share/termux-keyring" + # Delete all existing termux-keyring keys + rm -rf "$GPG_SHARE_DIR" mkdir -p "$GPG_SHARE_DIR" # Maintainer-specific keys. @@ -27,13 +30,17 @@ termux_step_make_install() { # Key for pacman package manager. install -Dm600 "$TERMUX_PKG_BUILDER_DIR/termux-pacman.gpg" "$GPG_SHARE_DIR" + # Create symlinks under all GPG_DIRs to key files under GPG_SHARE_DIR for GPG_DIR in "$TERMUX_PREFIX/etc/apt/trusted.gpg.d" "$TERMUX_PREFIX/share/pacman/keyrings"; do mkdir -p "$GPG_DIR" + # Delete keys which have been removed in newer version and their symlink target does not exist + find "$GPG_DIR" -xtype l -printf 'Deleting removed key: %p\n' -delete for GPG_FILE in "$GPG_SHARE_DIR"/*.gpg; do if [[ "$GPG_DIR" == *"/apt/"* && "$GPG_FILE" == *"termux-pacman.gpg"* ]]; then continue fi - ln -s "$GPG_FILE" "$GPG_DIR/$(basename "$GPG_FILE")" + # Create or overwrite key symlink + ln -sf "$GPG_FILE" "$GPG_DIR/$(basename "$GPG_FILE")" done # Creation of trusted files if [[ "$GPG_DIR" == *"/pacman/"* ]]; then