summaryrefslogtreecommitdiffhomepage
path: root/tools/make_repository.sh
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@google.com>2020-04-30 00:32:58 -0700
committergVisor bot <gvisor-bot@google.com>2020-04-30 00:34:26 -0700
commit44a57646d88b0a03545f97defb12f5bde54a55bf (patch)
tree36ed387535cf070768511163c95fd7d19adf45d9 /tools/make_repository.sh
parentef94401955bbcfb5296daa29ab373423cdd289db (diff)
make_repository.sh has to print only the repo path on stdout
PiperOrigin-RevId: 309176385
Diffstat (limited to 'tools/make_repository.sh')
-rwxr-xr-xtools/make_repository.sh18
1 files changed, 13 insertions, 5 deletions
diff --git a/tools/make_repository.sh b/tools/make_repository.sh
index c91fd283c..32d7b3b1f 100755
--- a/tools/make_repository.sh
+++ b/tools/make_repository.sh
@@ -14,6 +14,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+# We need to be sure that only a repo path is printed on stdout.
+exec 50<&1
+exec 1<&2
+
+echo_stdout() {
+ echo "$@" >&50
+}
+
# Parse arguments. We require more than two arguments, which are the private
# keyring, the e-mail associated with the signer, and the list of packages.
if [ "$#" -le 3 ]; then
@@ -61,7 +69,7 @@ cleanup() {
rm -f "${keyring}"
}
trap cleanup EXIT
-gpg --no-default-keyring --keyring "${keyring}" --import "${private_key}" >&2
+gpg --no-default-keyring --keyring "${keyring}" --import "${private_key}"
# Copy the packages into the root.
for pkg in "$@"; do
@@ -92,7 +100,7 @@ find "${root}"/pool -type f -exec chmod 0644 {} \;
# Sign all packages.
for file in "${root}"/pool/*/binary-*/*.deb; do
- dpkg-sig -g "--no-default-keyring --keyring ${keyring}" --sign builder "${file}" >&2
+ dpkg-sig -g "--no-default-keyring --keyring ${keyring}" --sign builder "${file}"
done
# Build the package list.
@@ -124,8 +132,8 @@ rm "${tmpdir}"/apt.conf
# Sign the release.
declare -r digest_opts=("--digest-algo" "SHA512" "--cert-digest-algo" "SHA512")
-(cd "${tmpdir}" && gpg --no-default-keyring --keyring "${keyring}" --clearsign "${digest_opts[@]}" -o InRelease Release >&2)
-(cd "${tmpdir}" && gpg --no-default-keyring --keyring "${keyring}" -abs "${digest_opts[@]}" -o Release.gpg Release >&2)
+(cd "${tmpdir}" && gpg --no-default-keyring --keyring "${keyring}" --clearsign "${digest_opts[@]}" -o InRelease Release)
+(cd "${tmpdir}" && gpg --no-default-keyring --keyring "${keyring}" -abs "${digest_opts[@]}" -o Release.gpg Release)
# Show the results.
-echo "${tmpdir}"
+echo_stdout "${tmpdir}"