mirror of
https://github.com/wickedyoda/public-setupfiles.git
synced 2026-11-16 13:31:56 -06:00
updated sync commands
updated sync commands
This commit is contained in:
1 parent
a45afbd3e4
commit
d4cfc5d3cb
3 files changed
+4
-10
No files matched your search
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Automatic setup (installs git if needed, handles existing clones)
|
# 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
|
# Or manual clone / update
|
||||||
# If you haven't cloned yet:
|
# If you haven't cloned yet:
|
||||||
|
|||||||
+2
-6
@@ -74,20 +74,16 @@ def main():
|
|||||||
# Check if directory already exists
|
# Check if directory already exists
|
||||||
if os.path.isdir(local_dir) and os.listdir(local_dir):
|
if os.path.isdir(local_dir) and os.listdir(local_dir):
|
||||||
print(f"Directory '{local_dir}' exists. Pulling latest changes...")
|
print(f"Directory '{local_dir}' exists. Pulling latest changes...")
|
||||||
os.chdir(local_dir)
|
result = run(["git", "pull", "origin", "main"], cwd=local_dir)
|
||||||
result = run(["git", "pull", "origin", "main"])
|
|
||||||
if result.returncode != 0:
|
if result.returncode != 0:
|
||||||
print("Git pull failed, re-cloning...")
|
print("Git pull failed, re-cloning...")
|
||||||
os.chdir("..")
|
|
||||||
shutil.rmtree(local_dir)
|
shutil.rmtree(local_dir)
|
||||||
run(["git", "clone", remote_repo, local_dir])
|
run(["git", "clone", remote_repo, local_dir])
|
||||||
else:
|
|
||||||
os.chdir(local_dir)
|
|
||||||
else:
|
else:
|
||||||
print("Cloning repository...")
|
print("Cloning repository...")
|
||||||
run(["git", "clone", remote_repo, local_dir])
|
run(["git", "clone", remote_repo, local_dir])
|
||||||
os.chdir(local_dir)
|
|
||||||
|
|
||||||
|
os.chdir(local_dir)
|
||||||
subprocess.run(["chmod", "-R", "755", "."], check=True)
|
subprocess.run(["chmod", "-R", "755", "."], check=True)
|
||||||
print("Done!")
|
print("Done!")
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
+1
-3
@@ -46,10 +46,8 @@ fi
|
|||||||
# Check if directory already exists
|
# Check if directory already exists
|
||||||
if [ -d "$LOCAL_DIR" ] && [ "$(ls -A "$LOCAL_DIR" 2>/dev/null)" ]; then
|
if [ -d "$LOCAL_DIR" ] && [ "$(ls -A "$LOCAL_DIR" 2>/dev/null)" ]; then
|
||||||
echo "Existing directory found. Pulling latest changes..."
|
echo "Existing directory found. Pulling latest changes..."
|
||||||
cd "$LOCAL_DIR" || exit 1
|
if ! (cd "$LOCAL_DIR" && git pull origin main); then
|
||||||
if ! git pull origin main; then
|
|
||||||
echo "Git pull failed, re-cloning..."
|
echo "Git pull failed, re-cloning..."
|
||||||
cd ..
|
|
||||||
rm -rf "$LOCAL_DIR"
|
rm -rf "$LOCAL_DIR"
|
||||||
git clone "$REMOTE_REPO" "$LOCAL_DIR"
|
git clone "$REMOTE_REPO" "$LOCAL_DIR"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in new issue
Block a user