Add more safety.

This commit is contained in:
2026-04-20 15:27:33 +01:00
parent 5afda70f4c
commit 502b414e67

View File

@@ -6,6 +6,10 @@ if [ -d "$repos" ]; then
fi fi
mkdir -p "$repos" mkdir -p "$repos"
tmp_portfolio="/tmp/portfolio-$(cat /dev/urandom | base64 | tr -d '=+/' | head -c 8)" tmp_portfolio="/tmp/portfolio-$(cat /dev/urandom | base64 | tr -d '=+/' | head -c 8)"
if [ -d "$tmp_portfolio" ]; then
echo "Error: Temporary directory '$tmp_portfolio' already exists."
exit 1
fi
function safely_remove_tmp_repos() { function safely_remove_tmp_repos() {
if [ "$repos" ] && [ -d "$repos" ]; then if [ "$repos" ] && [ -d "$repos" ]; then
if [ "$(find -name .git -type d | wc -l)" -eq 0 ]; then if [ "$(find -name .git -type d | wc -l)" -eq 0 ]; then