Skip to content

Commit 2d3430a

Browse files
authored
Merge pull request #64 from The-Art-of-Hacking/fix/idempotent-git-clone
fix: make git clone operations idempotent in install.sh
2 parents 76e892c + f4ae219 commit 2d3430a

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

install.sh

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,26 @@ sudo systemctl enable docker --now
115115
#--------------------------------------------------
116116
echo "[+] Cloning GitHub repos..."
117117
cd /root
118-
git clone https://github.com/The-Art-of-Hacking/h4cker.git
119-
git clone https://github.com/danielmiessler/SecLists.git
120-
git clone https://github.com/internetwache/GitTools.git
121-
git clone https://github.com/swisskyrepo/PayloadsAllTheThings.git
122-
git clone https://github.com/The-Art-of-Hacking/websploit.git
118+
119+
# Helper function to clone or update a repo
120+
clone_or_update() {
121+
local repo_url="$1"
122+
local dir_name=$(basename "$repo_url" .git)
123+
124+
if [ -d "$dir_name" ]; then
125+
echo "[*] Directory '$dir_name' already exists. Pulling latest changes..."
126+
cd "$dir_name" && git pull && cd ..
127+
else
128+
echo "[+] Cloning $repo_url..."
129+
git clone "$repo_url"
130+
fi
131+
}
132+
133+
clone_or_update https://github.com/The-Art-of-Hacking/h4cker.git
134+
clone_or_update https://github.com/danielmiessler/SecLists.git
135+
clone_or_update https://github.com/internetwache/GitTools.git
136+
clone_or_update https://github.com/swisskyrepo/PayloadsAllTheThings.git
137+
clone_or_update https://github.com/The-Art-of-Hacking/websploit.git
123138

124139
# IoT firmware exercises for reverse engineering courses
125140
mkdir -p /root/iot_exercises

0 commit comments

Comments
 (0)