toolkit/crashreporter/tools/upload_symbols.sh

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/crashreporter/tools/upload_symbols.sh	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,53 @@
     1.4 +#!/bin/bash
     1.5 +#
     1.6 +# This Source Code Form is subject to the terms of the Mozilla Public
     1.7 +# License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.9 +#
    1.10 +# This script expects the following environment variables to be set:
    1.11 +# SYMBOL_SERVER_HOST    : host to upload symbols to
    1.12 +# SYMBOL_SERVER_USER    : username on that host
    1.13 +# SYMBOL_SERVER_PATH    : path on that host to put symbols in
    1.14 +#
    1.15 +# And will use the following optional environment variables if set:
    1.16 +# SYMBOL_SERVER_SSH_KEY : path to a ssh private key to use
    1.17 +# SYMBOL_SERVER_PORT    : port to use for ssh
    1.18 +# POST_SYMBOL_UPLOAD_CMD: a commandline to run on the remote host after
    1.19 +#                         uploading. The full path of the symbol index
    1.20 +#                         file will be appended to the commandline.
    1.21 +#
    1.22 +# The script expects two command-line arguments, in this order:
    1.23 +#   - The symbol index name
    1.24 +#   - The symbol archive
    1.25 +#
    1.26 +
    1.27 +set -e
    1.28 +
    1.29 +: ${SYMBOL_SERVER_HOST?} ${SYMBOL_SERVER_USER?} ${SYMBOL_SERVER_PATH?} ${1?"You must specify a symbol index name."} ${2?"You must specify a symbol archive to upload"}
    1.30 +
    1.31 +SYMBOL_INDEX_NAME="$1"
    1.32 +SYMBOL_ARCHIVE="$2"
    1.33 +
    1.34 +hash=`openssl dgst -sha1 "${SYMBOL_ARCHIVE}" | sed 's/^.*)=//' | sed 's/\ //g'`
    1.35 +archive="${hash}-"`basename "${SYMBOL_ARCHIVE}" | sed 's/\ //g'`
    1.36 +echo "Transferring symbols... ${SYMBOL_ARCHIVE}"
    1.37 +scp -oLogLevel=DEBUG -oRekeyLimit=10M ${SYMBOL_SERVER_PORT:+-P $SYMBOL_SERVER_PORT} \
    1.38 +  ${SYMBOL_SERVER_SSH_KEY:+-i "$SYMBOL_SERVER_SSH_KEY"} "${SYMBOL_ARCHIVE}" \
    1.39 +  ${SYMBOL_SERVER_USER}@${SYMBOL_SERVER_HOST}:"${SYMBOL_SERVER_PATH}/${archive}"
    1.40 +echo "Unpacking symbols on remote host..."
    1.41 +ssh -2 ${SYMBOL_SERVER_PORT:+-p $SYMBOL_SERVER_PORT} \
    1.42 +  ${SYMBOL_SERVER_SSH_KEY:+-i "$SYMBOL_SERVER_SSH_KEY"} \
    1.43 +  -l ${SYMBOL_SERVER_USER} ${SYMBOL_SERVER_HOST} \
    1.44 +  "set -e;
    1.45 +   umask 0022;
    1.46 +   cd ${SYMBOL_SERVER_PATH};
    1.47 +   unzip -n '$archive';
    1.48 +   rm -v '$archive';"
    1.49 +if test -n "$POST_SYMBOL_UPLOAD_CMD"; then
    1.50 +  echo "${POST_SYMBOL_UPLOAD_CMD} \"${SYMBOL_SERVER_PATH}/${SYMBOL_INDEX_NAME}\""
    1.51 +  ssh -2 ${SYMBOL_SERVER_PORT:+-p $SYMBOL_SERVER_PORT} \
    1.52 +  ${SYMBOL_SERVER_SSH_KEY:+-i "$SYMBOL_SERVER_SSH_KEY"} \
    1.53 +  -l ${SYMBOL_SERVER_USER} ${SYMBOL_SERVER_HOST} \
    1.54 +  "${POST_SYMBOL_UPLOAD_CMD} \"${SYMBOL_SERVER_PATH}/${SYMBOL_INDEX_NAME}\""
    1.55 +fi
    1.56 +echo "Symbol transfer completed"

mercurial