Add more safety.
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user