Files
public-setupfiles/update-public-setupfiles
T
2024-03-31 15:38:11 -05:00

39 lines
1.2 KiB
Plaintext

# Change to /home/traver
cd /home/traver
# Check distro and download updated public-setupfiles
if [ -f "/etc/debian_version" ]; then
# Pull file A
wget https://raw.githubusercontent.com/wickedyoda/public-setupfiles/main/server_config/ubuntu/ubuntu-setup.sh
elif [ -f "/etc/lsb-release" ]; then
# Pull file B
wget https://raw.githubusercontent.com/wickedyoda/public-setupfiles/main/server_config/debian/debian-setup.sh
fi
# make updated files executable
cd /home/traver
chmod +x ./ubuntu-setup.sh
chmod +x ./debian-setup.sh
# Check if /home/traver/public-setupfiles exists
if [ -d "/home/traver/public-setupfiles" ]; then
# Change directory to /home/traver/public-setupfiles
cd /home/traver/public-setupfiles
# Stash any local changes
git stash
# Pull the latest changes from the remote repository
git pull
else
# mkdir for git repo
sudo mkdir -p /home/traver/public-setupfiles
cd /home/traver/public-setupfiles
git init
git remote add origin https://github.com/wickedyoda/public-setupfiles
git pull origin main
git checkout main
# make directory executable
chmod +x -R /home/traver/public-setupfiles