From b7d61190587ee5c1f96086525edc2c1cc9a2bea9 Mon Sep 17 00:00:00 2001 From: c0repwn3r Date: Tue, 23 May 2023 22:02:12 -0400 Subject: [PATCH] better patch base --- .gitignore | 2 ++ pbt.sh | 46 ++++++++++++++++++++++++++++++---------------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 485dee6..71940dc 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ .idea +scratch-blocks +scratch-gui diff --git a/pbt.sh b/pbt.sh index bba9f74..aee3666 100755 --- a/pbt.sh +++ b/pbt.sh @@ -6,37 +6,51 @@ job_start() { # [*] job start - [target]:[job] # bold echo -e "\e[1m[*] job start - $1:$2\e[0m" - job_start=$(date +%s) + job_start=$(date +%s.%N) } job_success() { # [*] success! [target]:[job] finished in 241.2s :) - end=$(date +%s) - time=$(( end - job_start )) + end=$(date +%s.%N) + time=$( echo "$end - $job_start" | bc -l ) echo -e "\e[1m\e[32m[*] success! $1:$2 finished in $time seconds :)\e[0m" } job_fail() { # [x] FAIL! [target]:[job] failed in 241.2s :( - end=$(date +%s) - time=$(( end - job_start )) + end=$(date +%s.%N) + time=$( echo "$end - $job_start" | bc -l ) echo -e "\e[1m\e[31m[*] FAIL! $1:$2 failed in $time seconds :(\e[0m" } +job_skip() { + # [-] skipped - [target]:[job] skipped in 241.2s + end=$(date +%s.%N) + time=$( echo "$end - $job_start" | bc -l ) + echo -e "\e[1m\e[34m[-] skipped - $1:$2 skipped after $time seconds\e[0m" +} sub_clone() { job_start "scratch-blocks" "clone" - - git submodule init + if [ -d "$(pwd)/scratch-blocks" ]; then + echo "Clone dir already exists" + job_skip "scratch-blocks" "clone" + else + git clone https://github.com/scratchfoundation/scratch-blocks scratch-blocks + if [ "$?" != "0" ]; then + job_fail "scratch-blocks" "clone" + exit 1 + fi + job_success "scratch-blocks" "clone" + fi + job_start "scratch-blocks" "checkout" + pbase=$(