better patch base

This commit is contained in:
c0repwn3r 2023-05-23 22:02:12 -04:00
parent 4089db70f9
commit b7d6119058
Signed by: core
GPG Key ID: FDBF740DADDCEECF
2 changed files with 32 additions and 16 deletions

2
.gitignore vendored
View File

@ -1 +1,3 @@
.idea
scratch-blocks
scratch-gui

42
pbt.sh
View File

@ -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
git submodule update
if [ "$?" != "0" ]; then
job_fail "scratch-blocks" "clone"
exit 1
fi
job_success "scratch-blocks" "clone"
fi
job_start "scratch-blocks" "checkout"
pbase=$(<patches/scratch-blocks/PATCH-BASE)
echo "Checking out scratch-blocks patchbase $pbase"
cd scratch-blocks || exit
git checkout "$pbase"
if [ "$?" != "0" ]; then
job_fail "scratch-blocks" "checkout"
exit 1
fi
cd .. || exit
job_success "scratch-blocks" "checkout"
}
sub_patch() {