-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-from_repo.py
37 lines (24 loc) · 1010 Bytes
/
update-from_repo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
import subprocess
subprocess.run(["apt", "install", "python", "python3", "-y"])
# run apt update to make sure the system has the latest repo files
subprocess.run(["apt", "update", "-y"])
# Check if git is installed
try:
subprocess.run(["git", "--version"], check=True)
except subprocess.CalledProcessError:
# Install git
subprocess.run(["apt-get", "install", "git", "-y"])
# Specify the remote repository URL
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])