preload-hacks: Some patches to make it work.
[termux-packages] / packages / apt / cmdline-apt-key.in.patch
index 0d07e4f..91d8667 100644 (file)
@@ -1,51 +1,28 @@
-diff -u -r ../apt-1.1.3/cmdline/apt-key.in ./cmdline/apt-key.in
---- ../apt-1.1.3/cmdline/apt-key.in    2015-11-30 03:08:24.000000000 -0500
-+++ ./cmdline/apt-key.in       2015-12-03 21:22:35.231730185 -0500
-@@ -19,10 +19,7 @@
+diff -u -r ../apt-1.4.7/cmdline/apt-key.in ./cmdline/apt-key.in
+--- ../apt-1.4.7/cmdline/apt-key.in    2017-07-13 23:45:39.000000000 +0200
++++ ./cmdline/apt-key.in       2017-07-26 12:18:17.424086422 +0200
+@@ -16,10 +16,7 @@
  aptkey_echo() { echo "$@"; }
  
  requires_root() {
 -      if [ "$(id -u)" -ne 0 ]; then
--              echo >&2 "ERROR: This command can only be used by root."
+-              apt_error "This command can only be used by root."
 -              exit 1
 -      fi
-+      continue
++continue
  }
  
get_fingerprints_of_keyring() {
-@@ -212,7 +209,7 @@
-       if [ -s "$TRUSTEDFILE" ]; then
command_available() {
+@@ -260,7 +257,7 @@
+       if accessible_file_exists "$TRUSTEDFILE"; then
            $ACTION "$TRUSTEDFILE" "$@"
        fi
 -      local TRUSTEDPARTS="/etc/apt/trusted.gpg.d"
 +      local TRUSTEDPARTS="@TERMUX_PREFIX@/etc/apt/trusted.gpg.d"
-       eval $(apt-config shell TRUSTEDPARTS Dir::Etc::TrustedParts/d)
+       eval "$(apt-config shell TRUSTEDPARTS Dir::Etc::TrustedParts/d)"
        if [ -d "$TRUSTEDPARTS" ]; then
-           # strip / suffix as gpg will double-slash in that case (#665411)
-@@ -282,11 +279,11 @@
-     # if a --keyring was given, just use this one
-     if [ -n "$FORCED_KEYRING" ]; then
-       if [ -s "$FORCED_KEYRING" ]; then
--          cp --dereference "$FORCED_KEYRING" "$PUBRING"
-+          cp "$FORCED_KEYRING" "$PUBRING"
-       fi
-     else
-       # otherwise all known keyrings are merged
--      local TRUSTEDPARTS="/etc/apt/trusted.gpg.d"
-+      local TRUSTEDPARTS="@TERMUX_PREFIX@/etc/apt/trusted.gpg.d"
-       eval $(apt-config shell TRUSTEDPARTS Dir::Etc::TrustedParts/d)
-       if [ -d "$TRUSTEDPARTS" ]; then
-           # ignore errors mostly for non-existing $TRUSTEDFILE
-@@ -297,7 +294,7 @@
-              done
-           } > "$PUBRING" 2>/dev/null
-       elif [ -s "$TRUSTEDFILE" ]; then
--          cp --dereference "$TRUSTEDFILE" "$PUBRING"
-+          cp "$TRUSTEDFILE" "$PUBRING"
-       fi
-     fi
-@@ -441,7 +438,7 @@
+           TRUSTEDPARTS="$(readlink -f "$TRUSTEDPARTS")"
+@@ -542,7 +539,7 @@
  done
  
  if [ -z "$TRUSTEDFILE" ]; then
@@ -54,3 +31,13 @@ diff -u -r ../apt-1.1.3/cmdline/apt-key.in ./cmdline/apt-key.in
     eval $(apt-config shell TRUSTEDFILE Apt::GPGV::TrustedKeyring)
     eval $(apt-config shell TRUSTEDFILE Dir::Etc::Trusted/f)
  fi
+@@ -612,7 +609,8 @@
+           unset TMPDIR
+       fi
+     fi
+-    GPGHOMEDIR="$(mktemp --directory --tmpdir 'apt-key-gpghome.XXXXXXXXXX')"
++    # Use short options as busybox mktemp does not support long ones:
++    GPGHOMEDIR="$(mktemp -d -t 'apt-key-gpghome.XXXXXXXXXX')"
+     CURRENTTRAP="${CURRENTTRAP} cleanup_gpg_home;"
+     trap "${CURRENTTRAP}" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
+     if [ -z "$GPGHOMEDIR" ]; then