From 30565c4f571d366fe77af396532dc47ebcae112a Mon Sep 17 00:00:00 2001 From: XakerTwo <13261533+XakerTwo@users.noreply.github.com> Date: Thu, 28 Nov 2024 21:29:17 +0300 Subject: [PATCH] fix optionality issue of switch -T of sh script --- gencat.sh | 12 ++++++------ generate-cat-file.c | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gencat.sh b/gencat.sh index a37e401..f9e82be 100644 --- a/gencat.sh +++ b/gencat.sh @@ -57,7 +57,7 @@ # Server_v100_ARM64_24H2 - arm 64-bit Windows Server 2025 (not tested + officially the first ARM64 Server) function usage_and_exit() { - echo Usage: "$0 -o [-h ] [-O OS string] [-A OS attribute string] [-T generation-time] file1 [ file2 ... ]" + echo Usage: "$0 -o [-h ] [-O OS string] [-A OS attribute string] [-T ] file1 [ file2 ... ]" echo See comment inside this .sh file for list of OS string and OS attributes exit 1 } @@ -68,7 +68,7 @@ OUTPUT_CAT_FILE=- HARDWARE_ID=windrbd OS_STRING=7X64,8X64,_v100_X64 OS_ATTR=2:6.1,2:6.2,2:10.0 -GEN_TIME=230823140713Z +GEN_TIME="-T 230823140713Z" DRY_RUN=0 args=$( getopt do:h:O:A:T: $* ) @@ -108,7 +108,7 @@ do shift ;; -T) - GEN_TIME=$2 + GEN_TIME="-T $2" shift shift ;; @@ -147,13 +147,13 @@ unset IFS if [ $DRY_RUN -eq 1 ] then - echo $EXEC_DIR/generate-cat-file -T $GEN_TIME -A $OS_ATTR -O $OS_STRING -h $HARDWARE_IDS ${sorted_images[*]} + echo $EXEC_DIR/generate-cat-file "$GEN_TIME" -A $OS_ATTR -O $OS_STRING -h $HARDWARE_IDS ${sorted_images[*]} exit 0 fi if [ $OUTPUT_CAT_FILE == '-' ] then - $EXEC_DIR/generate-cat-file -T $GEN_TIME -A $OS_ATTR -O $OS_STRING -h $HARDWARE_IDS ${sorted_images[*]} + $EXEC_DIR/generate-cat-file "$GEN_TIME" -A $OS_ATTR -O $OS_STRING -h $HARDWARE_IDS ${sorted_images[*]} else - $EXEC_DIR/generate-cat-file -T $GEN_TIME -A $OS_ATTR -O $OS_STRING -h $HARDWARE_IDS ${sorted_images[*]} > $OUTPUT_CAT_FILE + $EXEC_DIR/generate-cat-file "$GEN_TIME" -A $OS_ATTR -O $OS_STRING -h $HARDWARE_IDS ${sorted_images[*]} > $OUTPUT_CAT_FILE fi diff --git a/generate-cat-file.c b/generate-cat-file.c index 40fafb6..326093e 100644 --- a/generate-cat-file.c +++ b/generate-cat-file.c @@ -1035,7 +1035,7 @@ void create_binary_tree(struct pkcs7_toplevel *sdat) void __attribute((noreturn)) usage_and_exit(void) { - fprintf(stderr, "Usage: generate_cat_file -h [-O OS string] [-A OS attribute string] [-T generation-time] file-with-hash1 [ file-with-hash2 ... ]\n"); + fprintf(stderr, "Usage: generate_cat_file -h [-O OS string] [-A OS attribute string] [-T ] file-with-hash1 [ file-with-hash2 ... ]\n"); fprintf(stderr, "Generates a Microsoft Security Catalog (\".cat\") file.\n"); fprintf(stderr, "hardware-ids is comma separated list\n"); fprintf(stderr, "generation-time has the format YYmmddHHMMSSZ, Z is constant, means 0 timezone\n");