From 02f17ed05f1dbe7b30eb47e68b809f84296080fb Mon Sep 17 00:00:00 2001 From: WickedYoda <68271168+wickedyoda@users.noreply.github.com> Date: Thu, 9 May 2024 16:44:37 -0500 Subject: [PATCH] w --- update-from_repo.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 update-from_repo.py diff --git a/update-from_repo.py b/update-from_repo.py new file mode 100644 index 0000000..20dc067 --- /dev/null +++ b/update-from_repo.py @@ -0,0 +1,35 @@ +#!/bin/bash + +# run apt update to make sure the system has the latest repo files +import subprocess + +subprocess.run(["sudo", "apt", "update", "-y"]) + +# Check if git is installedd +try: + subprocess.run(["git", "--version"], check=True) +except subprocess.CalledProcessError: + # Install git + subprocess.run(["sudo", "apt-get", "install", "git", "-y"]) + +# Specify the remote repository URLL +remote_repo = "https://github.com/wickedyoda/public-setupfiles.git" + +# Specify the local file path +local_file = "./pubic-setupfiles" + + +# Check if the local file path exists and is not empty +import os + +if os.path.isdir(local_file) and os.listdir(local_file): + # Delete the existing directory + subprocess.run(["sudo", "rm", "-rf", local_file]) + +# Clone the remote repository to the local file pathh +subprocess.run(["git", "clone", remote_repo, local_file]) + + +# Make all files executable and public ownership +subprocess.run(["sudo", "chmod", "777", "-R", local_file]) +