2024-05-09 15:48:15 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
2024-05-09 16:22:56 -05:00
|
|
|
# run apt update to make sure the system is got latest repo files
|
|
|
|
|
sudo apt update -y
|
|
|
|
|
|
|
|
|
|
# Check if git is installed
|
|
|
|
|
if ! command -v git &> /dev/null; then
|
|
|
|
|
# Install git
|
|
|
|
|
sudo apt-get install git -y
|
|
|
|
|
fi
|
|
|
|
|
|
2024-05-09 15:48:15 -05:00
|
|
|
# Specify the remote repository URL
|
2024-05-09 15:59:36 -05:00
|
|
|
remote_repo="https://github.com/wickedyoda/public-setupfiles.git"
|
2024-05-09 15:48:15 -05:00
|
|
|
|
|
|
|
|
# Specify the local file path
|
2024-05-10 22:55:20 -05:00
|
|
|
local_file="./public-setupfiles"
|
2024-05-09 15:48:15 -05:00
|
|
|
|
2024-05-09 16:02:52 -05:00
|
|
|
# Check if the local file path exists and is not empty
|
|
|
|
|
if [ -d "$local_file" ] && [ -n "$(ls -A $local_file)" ]; then
|
|
|
|
|
# Delete the existing directory
|
2024-05-09 16:22:56 -05:00
|
|
|
sudo rm -rf "$local_file"
|
2024-05-09 15:59:36 -05:00
|
|
|
fi
|
2024-05-09 16:02:52 -05:00
|
|
|
|
|
|
|
|
# Clone the remote repository to the local file path
|
|
|
|
|
git clone "$remote_repo" "$local_file"
|
2024-05-09 16:09:58 -05:00
|
|
|
|
2024-05-09 16:22:56 -05:00
|
|
|
# Make all files executable and public ownership
|
|
|
|
|
sudo chmod 777 -R $local_file
|
|
|
|
|
|