1#!/bin/bash 2# Running this script requires "gcert" login. 3# 4# This script is used to query the PROD database to fetch the info about the ART 5# cloud profiles for a given package name and version code (optional) 6# For example, `bash fetch_profile.sh com.abc` 7# or `bash fetch_profile com.abc 123` 8# The output if any will contain a "blob_key" for each profile info and 9# it could be used to download the content of the profile via 10# "fetch_blob_key.sh". 11if [[ "$#" == 1 ]]; 12then 13 PKG=$1 14 echo "fetching for $PKG..." 15 span sql /span/global/play-gateway:art "select PackageName, VersionCode, DerivedId, SplitName, DeviceType, SdkVersion, ApkSignType, PlayArtProfilePublishStatus.profile_dex_metadata.blob_key FROM AggregatedPlayArtProfileV3 WHERE PlayArtProfilePublishStatus IS NOT NULL AND PackageName='$1';"; 16 echo "$PKG" 17elif [[ "$#" == 2 ]]; 18then 19 PKG=$1 20 VERSION=$2 21 echo "fetching for $PKG $VERSION..." 22 span sql /span/global/play-gateway:art "select PackageName, VersionCode, DerivedId, SplitName, DeviceType, SdkVersion, ApkSignType, PlayArtProfilePublishStatus.profile_dex_metadata.blob_key FROM AggregatedPlayArtProfileV3 WHERE PlayArtProfilePublishStatus IS NOT NULL AND PackageName='$1' and VersionCode=$2;"; 23else 24 echo "Illegal number of parameters. It should be one or two." 25fi 26