File indexing completed on 2024-06-23 05:11:56
0001 #!/bin/bash 0002 0003 command=$1 0004 pkpassFile=$2 0005 0006 if [ -z "${command}" ] || ! [ -f "${pkpassFile}" ]; then 0007 echo "Usage: $0 (unpack|repack) <pkpassFile>" 0008 exit 1 0009 fi 0010 0011 if [ "${command}" == "unpack" ]; then 0012 mkdir -p ${pkpassFile}.dir 0013 pushd ${pkpassFile}.dir > /dev/null 0014 unzip -o ../${pkpassFile} 0015 rm -f *.png 0016 rm -f manifest.json 0017 rm -f signature 0018 rm -rf *.lproj 0019 mv pass.json pass.raw.json 0020 jq '.' pass.raw.json > pass.json 0021 rm pass.raw.json 0022 popd > /dev/null 0023 elif [ "${command}" == "repack" ]; then 0024 pushd ${pkpassFile}.dir > /dev/null 0025 if ! [ -f "pass.json" ]; then 0026 echo "Invalid extracted pass!" 0027 exit 1 0028 fi 0029 rm -f ../${pkpassFile} 0030 zip -r ../${pkpassFile} . 0031 popd > /dev/null 0032 rm -rf ${pkpassFile}.dir 0033 else 0034 exit 1 0035 fi 0036