From d4cfc5d3cbc6b59f27f050cd0db26d867c709507 Mon Sep 17 00:00:00 2001 From: WickedYoda <68271168+wickedyoda@users.noreply.github.com> Date: Sun, 20 Sep 2026 12:18:38 -0500 Subject: [PATCH] updated sync commands updated sync commands --- README.md | 2 +- update-from_repo.py | 8 ++------ update-from_repo.sh | 4 +--- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index ac743f8..bf49711 100755 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ ```bash # Automatic setup (installs git if needed, handles existing clones) -curl -s https://raw.githubusercontent.com/wickedyoda/public-setupfiles/refs/heads/main/update-from_repo.sh | sudo bash +curl -fsSL https://raw.githubusercontent.com/wickedyoda/public-setupfiles/refs/heads/main/update-from_repo.sh | sudo bash # Or manual clone / update # If you haven't cloned yet: diff --git a/update-from_repo.py b/update-from_repo.py index d418a63..04b9f63 100755 --- a/update-from_repo.py +++ b/update-from_repo.py @@ -74,20 +74,16 @@ def main(): # Check if directory already exists if os.path.isdir(local_dir) and os.listdir(local_dir): print(f"Directory '{local_dir}' exists. Pulling latest changes...") - os.chdir(local_dir) - result = run(["git", "pull", "origin", "main"]) + result = run(["git", "pull", "origin", "main"], cwd=local_dir) if result.returncode != 0: print("Git pull failed, re-cloning...") - os.chdir("..") shutil.rmtree(local_dir) run(["git", "clone", remote_repo, local_dir]) - else: - os.chdir(local_dir) else: print("Cloning repository...") run(["git", "clone", remote_repo, local_dir]) - os.chdir(local_dir) + os.chdir(local_dir) subprocess.run(["chmod", "-R", "755", "."], check=True) print("Done!") return 0 diff --git a/update-from_repo.sh b/update-from_repo.sh index 1a5042f..b5381a6 100755 --- a/update-from_repo.sh +++ b/update-from_repo.sh @@ -46,10 +46,8 @@ fi # Check if directory already exists if [ -d "$LOCAL_DIR" ] && [ "$(ls -A "$LOCAL_DIR" 2>/dev/null)" ]; then echo "Existing directory found. Pulling latest changes..." - cd "$LOCAL_DIR" || exit 1 - if ! git pull origin main; then + if ! (cd "$LOCAL_DIR" && git pull origin main); then echo "Git pull failed, re-cloning..." - cd .. rm -rf "$LOCAL_DIR" git clone "$REMOTE_REPO" "$LOCAL_DIR" fi