mirror of
https://github.com/wickedyoda/public-setupfiles.git
synced 2026-11-16 13:31:56 -06:00
s
sws
This commit is contained in:
1 parent
1e8dd7939e
commit
9e0ac55028
6 files changed
+48
-60
No files matched your search
+5
-3
@@ -1,16 +1,18 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# run apt update to make sure the system has the latest repo files
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
subprocess.run(["sudo", "apt", "update", "-y"])
|
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
|
# Check if git is installed
|
||||||
try:
|
try:
|
||||||
subprocess.run(["git", "--version"], check=True)
|
subprocess.run(["git", "--version"], check=True)
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
# Install git
|
# Install git
|
||||||
subprocess.run(["sudo", "apt-get", "install", "git", "-y"])
|
subprocess.run(["apt-get", "install", "git", "-y"])
|
||||||
|
|
||||||
# Specify the remote repository URL
|
# Specify the remote repository URL
|
||||||
remote_repo = "https://github.com/wickedyoda/public-setupfiles.git"
|
remote_repo = "https://github.com/wickedyoda/public-setupfiles.git"
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
# /bin/bash
|
|
||||||
|
|
||||||
sudo apt update
|
|
||||||
sudo apt upgrade -y
|
|
||||||
sudo apt full-upgrade -y
|
|
||||||
sudo apt dist-upgrade -y
|
|
||||||
sudo apt autoremove -y
|
|
||||||
sudo apt clean -y
|
|
||||||
sudo apt purge -y
|
|
||||||
|
|
||||||
echo "System update and cleanup complete!"
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
|
|
||||||
# Change to /home/traver
|
|
||||||
cd /home/traver
|
|
||||||
|
|
||||||
# Check distro and download updated public-setupfiles
|
|
||||||
if [ -x "$(command -v os-release)" ]; then
|
|
||||||
$ID=$(os-release -si)
|
|
||||||
else
|
|
||||||
$ID=$(cat /etc/os-release | grep -oP '(?<=^ID=).+' | tr -d '"')
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$ID" = "Ubuntu" ]; then
|
|
||||||
# Pull file A
|
|
||||||
wget https://raw.githubusercontent.com/wickedyoda/public-setupfiles/main/server_config/ubuntu/ubuntu-setup.sh && chmod +x ./ubuntu-setup.sh
|
|
||||||
elif [ "$ID" = "Debian" ]; then
|
|
||||||
# Pull file B
|
|
||||||
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
|
|
||||||
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
|
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
# /bin/bash
|
||||||
|
|
||||||
|
# Backup of existing sources.list file
|
||||||
|
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
|
||||||
|
|
||||||
|
# Create variable from /etc/os-release file to get ID
|
||||||
|
ID=$(grep -oP '(?<=^ID=).+' /etc/os-release)
|
||||||
|
|
||||||
|
if [ "$ID" == "debian" ]; then
|
||||||
|
echo "ID_LIKE is debian"
|
||||||
|
echo "Updating sources.list file"
|
||||||
|
echo "deb http://deb.debian.org/debian/ bookworm main contrib non-free" | sudo tee /etc/apt/sources.list
|
||||||
|
echo "deb-src http://deb.debian.org/debian/ bookworm main contrib non-free" | sudo tee -a /etc/apt/sources.list
|
||||||
|
echo "deb http://deb.debian.org/debian/ bookworm-updates main contrib non-free" | sudo tee -a /etc/apt/sources.list
|
||||||
|
echo "deb-src http://deb.debian.org/debian/ bookworm-updates main contrib non-free" | sudo tee -a /etc/apt/sources.list
|
||||||
|
echo "deb http://deb.debian.org/debian/ bookworm-backports main contrib non-free" | sudo tee -a /etc/apt/sources.list
|
||||||
|
echo "deb-src http://deb.debian.org/debian/ bookworm-backports main contrib non-free" | sudo tee -a /etc/apt/sources.list
|
||||||
|
echo "deb http://security.debian.org/debian-security/ bookworm-security main contrib non-free" | sudo tee -a /etc/apt/sources.list
|
||||||
|
echo "deb-src http://security.debian.org/debian-security/ bookworm-security main contrib non-free" | sudo tee -a /etc/apt/sources.list
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$ID" == "ubuntu" ]; then
|
||||||
|
echo "ID_LIKE is ubuntu"
|
||||||
|
echo "Updating sources.list file"
|
||||||
|
echo "deb http://archive.ubuntu.com/ubuntu/ Minotaur restricted universe multiverse" | sudo tee /etc/apt/sources.list
|
||||||
|
echo "deb http://archive.ubuntu.com/ubuntu/ Minotaur main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list
|
||||||
|
echo "deb http://archive.ubuntu.com/ubuntu/ Minotaur main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list
|
||||||
|
echo "deb http://security.ubuntu.com/ubuntu Minotaur main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list
|
||||||
|
fi
|
||||||
|
|
||||||
|
# update repositories
|
||||||
|
sudo apt update
|
||||||
|
|
||||||
|
# Full upgrade of system
|
||||||
|
sudo apt full-upgrade -y && sudo apt dist-upgrade -y
|
||||||
|
|
||||||
|
# Clean up system
|
||||||
|
sudo apt autoremove -y
|
||||||
|
sudo apt clean -y
|
||||||
|
sudo apt autopurge -y
|
||||||
|
|
||||||
|
echo "System update and cleanup complete!"
|
||||||
|
|
||||||
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user