From e3b59401f82a617c8341b1e572793c56aee94411 Mon Sep 17 00:00:00 2001 From: PrincessPi3 Date: Mon, 17 Nov 2025 20:33:51 -0700 Subject: [PATCH] add jq to install script and improved cxheckbadge with profile name --- customscripts/checkbadge | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/customscripts/checkbadge b/customscripts/checkbadge index 488bdb4..1311f42 100644 --- a/customscripts/checkbadge +++ b/customscripts/checkbadge @@ -1,22 +1,35 @@ #!/bin/bash -set -e # die on any errpr because nmama didnt raise no bitch +# set -e # die on any errpr because nmama didnt raise no bitch # even includes error handling and sanity checks plus has help and even did tha retcodes :3 # happy naesms provided_credential="$1" openbadge_file="$2" - +# halp string +halp_str="checkbadge!\nFor verifying Openbadges Files\n\nUsage:\n\tcheckbadge \n\nRequires: coreutils, jq, and exiftool" # maek sure da args are in place or print help and fail if [ -z "$provided_credential" -o -z "$openbadge_file" ]; then - echo -e "Usage:\n\tcheckbadge \n\nRequires: coreutils, jq, and exiftool" + echo "ERROR: must provide the credential and the file path" + echo -e "$halp_str" exit 1 fi # does fiel exist dipshit? if [ ! -f "$openbadge_file" ]; then - echo "$openbadge_file not found" + echo "ERROR: $openbadge_file not found" + echo -e "$halp_str" + exit 1 +fi + +# maek sure its an openbadges fiel +exiftool "$openbadge_file" | grep -q Openbadges +ret=$? + +if [ $ret -ne 0 ]; then + echo "File $openbadgefile does not seem to be an Openbadge file or it has had its metadata stripped" + echo -e "$halp_str" exit 1 fi