Files
public-setupfiles/updates/update-public-setupfiles.sh
T

46 lines
1.5 KiB
Bash
Raw Normal View History

2024-03-31 15:38:11 -05:00
# Change to /home/traver
cd /home/traver
# Check distro and download updated public-setupfiles
2024-05-09 15:43:11 -05:00
if [ -x "$(command -v os-release)" ]; then
$ID=$(os-release -si)
2024-03-31 15:43:01 -05:00
else
2024-05-09 15:43:11 -05:00
$ID=$(cat /etc/os-release | grep -oP '(?<=^ID=).+' | tr -d '"')
2024-03-31 15:43:01 -05:00
fi
2024-05-09 15:43:11 -05:00
if [ "$ID" = "Ubuntu" ]; then
2024-03-31 15:38:11 -05:00
# Pull file A
2024-05-09 15:43:11 -05:00
wget https://raw.githubusercontent.com/wickedyoda/public-setupfiles/main/server_config/ubuntu/ubuntu-setup.sh && chmod +x ./ubuntu-setup.sh
elif [ "$ID" = "Debian" ]; then
2024-03-31 15:38:11 -05:00
# Pull file B
2024-05-09 15:43:11 -05:00
wget https://raw.githubusercontent.com/wickedyoda/public-setupfiles/main/server_config/debian/debian-setup.sh && chmod +x ./debian-setup.sh
elif [ "$ID" = "raspbian" ]; then
# Pull file B
wget https://raw.githubusercontent.com/wickedyoda/public-setupfiles/main/server_config/debian/debian-setup.sh && chmod +x ./debian-setup.sh
2024-03-31 15:38:11 -05:00
fi
# make updated files executable
cd /home/traver
# 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