From 490e3f9aaff5667be380b4ce106ffd4f96c61612 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 10 Nov 2025 10:08:33 +0800 Subject: Improve installation script to handle existing repositories The script now checks if repositories already exist and pulls latest changes instead of attempting to clone again. This prevents errors when re-running the installation script and ensures users always get the latest code. --- scripts/installation.sh | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/installation.sh b/scripts/installation.sh index c109301..5e853b6 100644 --- a/scripts/installation.sh +++ b/scripts/installation.sh @@ -13,12 +13,30 @@ fi echo "Installation directory set to current directory: $(pwd)" install_dir="$(pwd)" -# Clone repos -echo "Cloning repositories..." +# Clone or update repos +echo "Cloning or updating repositories..." mkdir -p "$install_dir" cd "$install_dir" -git clone https://github.com/JustEnoughVCS/CommandLine -git clone https://github.com/JustEnoughVCS/VersionControl + +# Function to clone or pull repository +clone_or_pull() { + local repo_url="$1" + local repo_name=$(basename "$repo_url") + + if [ -d "$repo_name" ]; then + echo "Repository $repo_name already exists, pulling latest changes..." + cd "$repo_name" + git pull origin main + cd .. + else + echo "Cloning $repo_name..." + git clone "$repo_url" + fi +} + +# Clone or update repositories +clone_or_pull https://github.com/JustEnoughVCS/CommandLine +clone_or_pull https://github.com/JustEnoughVCS/VersionControl # Setup VersionControl repo echo "Setting up VersionControl..." -- cgit