mirror of
https://github.com/wickedyoda/public-setupfiles.git
synced 2026-11-16 13:31:56 -06:00
- Fix CRLF line endings (SC1017) in 10 shell scripts - Add shebangs (SC2148) to 5 scripts missing them - Fix unquoted variables (SC2086) in kali-updates.sh - Add shellcheck disable directive for intentional eval usage - Fix missing space after ! in observium/custom_install.sh - Add security scan reports to .gitignore-safe location
47 lines
2.1 KiB
Bash
47 lines
2.1 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# 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
|
|
# shellcheck disable=SC1091
|
|
. /etc/os-release
|
|
ID="${ID:-}"
|
|
|
|
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"
|
|
CODENAME="${VERSION_CODENAME:?missing VERSION_CODENAME}"
|
|
echo "deb http://archive.ubuntu.com/ubuntu/ ${CODENAME} main restricted universe multiverse" | sudo tee /etc/apt/sources.list
|
|
echo "deb http://archive.ubuntu.com/ubuntu/ ${CODENAME}-updates main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list
|
|
echo "deb http://security.ubuntu.com/ubuntu ${CODENAME}-security 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!"
|
|
|