From cba7e16edcfda1c48617c1d14d9573723d14e464 Mon Sep 17 00:00:00 2001 From: Eric Bell Date: Tue, 8 Sep 2026 20:31:18 -0400 Subject: [PATCH] moved and edited git folder scripts --- unzip-git.sh | 38 ++++++++++++++++++++++ worker-toolkit-flaredown/repo/unzip-git.sh | 18 ---------- worker-toolkit-flaredown/repo/zip-git.sh | 14 -------- zip-git.sh | 34 +++++++++++++++++++ 4 files changed, 72 insertions(+), 32 deletions(-) create mode 100755 unzip-git.sh delete mode 100755 worker-toolkit-flaredown/repo/unzip-git.sh delete mode 100755 worker-toolkit-flaredown/repo/zip-git.sh create mode 100755 zip-git.sh diff --git a/unzip-git.sh b/unzip-git.sh new file mode 100755 index 0000000..c8562a1 --- /dev/null +++ b/unzip-git.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +set -euo pipefail + +cd "$(dirname "$0")" + +shopt -s nullglob +matches=(worker-toolkit-*/repo) +shopt -u nullglob + +if [ ${#matches[@]} -eq 0 ]; then + echo "No worker-toolkit-*/repo folder found, nothing to do." >&2 + exit 1 +fi + +if [ ${#matches[@]} -gt 1 ]; then + echo "Multiple worker-toolkit-*/repo folders found, refusing to guess:" >&2 + printf ' %s\n' "${matches[@]}" >&2 + exit 1 +fi + +target="${matches[0]}" + +if [ ! -f "$target/GITFOLDER.zip" ]; then + echo "$target/GITFOLDER.zip not found, nothing to do." >&2 + exit 1 +fi + +if [ -d "$target/.git" ]; then + echo "$target/.git folder already exists, refusing to overwrite." >&2 + exit 1 +fi + +( + cd "$target" + unzip -q GITFOLDER.zip +) + +echo "Unzipped $target/GITFOLDER.zip into $target/.git folder." diff --git a/worker-toolkit-flaredown/repo/unzip-git.sh b/worker-toolkit-flaredown/repo/unzip-git.sh deleted file mode 100755 index 220dadf..0000000 --- a/worker-toolkit-flaredown/repo/unzip-git.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -cd "$(dirname "$0")" - -if [ ! -f GITFOLDER.zip ]; then - echo "GITFOLDER.zip not found, nothing to do." >&2 - exit 1 -fi - -if [ -d .git ]; then - echo ".git folder already exists, refusing to overwrite." >&2 - exit 1 -fi - -unzip -q GITFOLDER.zip - -echo "Unzipped GITFOLDER.zip into .git folder." diff --git a/worker-toolkit-flaredown/repo/zip-git.sh b/worker-toolkit-flaredown/repo/zip-git.sh deleted file mode 100755 index 795b354..0000000 --- a/worker-toolkit-flaredown/repo/zip-git.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -cd "$(dirname "$0")" - -if [ ! -d .git ]; then - echo ".git folder not found, nothing to do." >&2 - exit 1 -fi - -zip -rq GITFOLDER.zip .git -rm -rf .git - -echo "Zipped .git into GITFOLDER.zip and removed .git folder." diff --git a/zip-git.sh b/zip-git.sh new file mode 100755 index 0000000..e3bcfad --- /dev/null +++ b/zip-git.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +set -euo pipefail + +cd "$(dirname "$0")" + +shopt -s nullglob +matches=(worker-toolkit-*/repo) +shopt -u nullglob + +if [ ${#matches[@]} -eq 0 ]; then + echo "No worker-toolkit-*/repo folder found, nothing to do." >&2 + exit 1 +fi + +if [ ${#matches[@]} -gt 1 ]; then + echo "Multiple worker-toolkit-*/repo folders found, refusing to guess:" >&2 + printf ' %s\n' "${matches[@]}" >&2 + exit 1 +fi + +target="${matches[0]}" + +if [ ! -d "$target/.git" ]; then + echo ".git folder not found in $target, nothing to do." >&2 + exit 1 +fi + +( + cd "$target" + zip -rq GITFOLDER.zip .git + rm -rf .git +) + +echo "Zipped .git into $target/GITFOLDER.zip and removed $target/.git folder."