#!/bin/bash SCRIPT_DIR=$(dirname $0) mkdir -p out/PKIMetadata/ if [ $# -lt 1 ] then echo "Usage: $0 " exit 1 fi for file in "$@"; do if [ ! -f "$file" ]; then echo "$file missing!" exit 1 fi done echo "using chrome ${CHROME:="google-chrome"}" if [ ! -d "$HOME/.config/$CHROME/PKIMetadata" ] then echo "Opened chrome automatically, make sure you follow the README!" "$CHROME" chrome://components &> /dev/null & exit 0 fi HIGHESTVERSIONAPPARENTLY=$(find "$HOME/.config/$CHROME/PKIMetadata/" -maxdepth 1 -mindepth 1 -type d| head -n 1) if [ -z ${HIGHESTVERSIONAPPARENTLY} ]; then echo "Failed to find PKIMetadata directory" exit 1 fi mkdir -p original/PKIMetadata/9999 if [ "$HIGHESTVERSIONAPPARENTLY" != "" ]; then cp -rvf "$HIGHESTVERSIONAPPARENTLY"/. original/PKIMetadata/9999 else echo "Variable HIGHESTVERSIONAPPARENTLY returned empty, failing." exit 1 fi rm -rvf original/PKIMetadata/9999/_metadata rm -rvf original/PKIMetadata/9999/manifest.fingerprint # Copy all directories, and will be modified by future calls rm -rvf "${SCRIPT_DIR}"/out mkdir "${SCRIPT_DIR}"/out mkdir -p "${SCRIPT_DIR}"/out/PKIMetadata/. cp -rvf "${SCRIPT_DIR}"/original/PKIMetadata/9999/. "${SCRIPT_DIR}"/out/PKIMetadata rm -rvf "${SCRIPT_DIR}"/out/PKIMetadata/_metadata # verified contents not necessary rm -rvf "${SCRIPT_DIR}out/PKIMetadata/"*.fingerprint python3 ./src/root_store_gen/generate_new_pbs.py "${SCRIPT_DIR}/original/PKIMetadata/9999/crs.pb" "$@" "${SCRIPT_DIR}/out/PKIMetadata/crs.pb" # Modify version in manifest python3 <