Add files via upload

update files
This commit is contained in:
stornic56
2026-05-11 17:11:11 -05:00
committed by GitHub
parent f8b77e7d9b
commit e3978c5a4f
3 changed files with 157 additions and 61 deletions
+25 -7
View File
@@ -22,10 +22,10 @@ if [ -f "${MODULES_DIR}/firmware.sh" ]; then
fi fi
if [ -f "${MODULES_DIR}/gpu.sh" ]; then if [ -f "${MODULES_DIR}/gpu.sh" ]; then
source "${MODULES_DIR}/gpu.sh" source "${MODULES_DIR}/gpu.sh"
fi
if [ -f "${MODULES_DIR}/kernel.sh" ]; then if [ -f "${MODULES_DIR}/kernel.sh" ]; then
source "${MODULES_DIR}/kernel.sh" source "${MODULES_DIR}/kernel.sh"
fi fi
fi
if [ -f "${MODULES_DIR}/gaming.sh" ]; then if [ -f "${MODULES_DIR}/gaming.sh" ]; then
source "${MODULES_DIR}/gaming.sh" source "${MODULES_DIR}/gaming.sh"
fi fi
@@ -58,22 +58,39 @@ main_menu() {
"Setup Wireless & Firmware" "Setup Wireless & Firmware"
"Configure Graphics Stack and Tools" "Configure Graphics Stack and Tools"
"Update Kernel to Backports" "Update Kernel to Backports"
"Gaming Setup and Performance" "Gaming Setup"
"Install extra applications" "Install extra applications"
"Exit" "Exit"
) )
while true; do while true; do
echo "" echo ""
printf "${RED}╔═══════ DEBIANITO ═══════════╗\n" >&2 printf "${RED}╔═══════════════════════════════╗\n" >&2
printf "║ Debian Post-Install Setup\n${NC}" printf "║ DEBIANITO ║\n" >&2
printf "║ Debian Post-Install Setup ║\n" >&2
printf "╚═══════════════════════════════╝\n${NC}" >&2
echo -e "\033[1;97m║─────────── SYSTEM INFO ─────┤\n${NC}\033[0m" echo -e "\033[1;97m║─────────── SYSTEM INFO ─────┤\n${NC}\033[0m"
echo "Detected: Debian ${DEBIAN_VERSION} (${DEBIAN_CODENAME})" echo "Detected: Debian ${DEBIAN_VERSION} (${DEBIAN_CODENAME})"
echo "Kernel: ${KERNEL_VERSION}"
echo "CPU: $(get_cpu_summary)" echo "CPU: $(get_cpu_summary)"
echo "RAM: $(get_ram_summary)" echo "RAM: $(get_ram_summary)"
echo "GPU: $(get_gpu_summary)" if [ -n "$GPU_VERSION" ]; then
echo "WiFi: $(get_wifi_summary)" echo "GPU: ${GPU_DESC} (${GPU_VERSION})"
else
echo "GPU: ${GPU_DESC}"
fi
if [ -n "$ETH_DESC" ] && [ -n "$WIFI_DESC" ]; then
echo "Network:"
echo " Ethernet: ${ETH_DESC}"
echo " WiFi: ${WIFI_DESC}"
elif [ -n "$ETH_DESC" ]; then
echo "Network: ${ETH_DESC}"
elif [ -n "$WIFI_DESC" ]; then
echo "Network: ${WIFI_DESC}"
else
echo "Network: No adapters detected"
fi
echo "" echo ""
select opt in "${options[@]}"; do select opt in "${options[@]}"; do
@@ -101,7 +118,8 @@ check_sudo
detect_debian_version detect_debian_version
detect_cpu_ram detect_cpu_ram
detect_kernel
detect_gpu detect_gpu
detect_wifi_chipset detect_network
main_menu main_menu
+65 -32
View File
@@ -1,9 +1,55 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# State for backup/restore
REPO_BACKUP_DIR=""
backup_current_repos() {
REPO_BACKUP_DIR=$(mktemp -d)
for f in /etc/apt/sources.list /etc/apt/sources.list.d/debian.sources; do
if [ -f "$f" ]; then
cp "$f" "$REPO_BACKUP_DIR/$(basename "$f")"
fi
done
}
restore_previous_repos() {
if [ -z "$REPO_BACKUP_DIR" ] || [ ! -d "$REPO_BACKUP_DIR" ]; then
return
fi
echo -e "${RED}Restoring previous repository configuration...${NC}"
if [ -f "$REPO_BACKUP_DIR/sources.list" ]; then
sudo cp "$REPO_BACKUP_DIR/sources.list" /etc/apt/sources.list
else
sudo rm -f /etc/apt/sources.list
fi
if [ -f "$REPO_BACKUP_DIR/debian.sources" ]; then
sudo cp "$REPO_BACKUP_DIR/debian.sources" /etc/apt/sources.list.d/debian.sources
else
sudo rm -f /etc/apt/sources.list.d/debian.sources
fi
sudo rm -f /etc/apt/sources.list.disabled
rm -rf "$REPO_BACKUP_DIR"
REPO_BACKUP_DIR=""
}
cleanup_repo_backup() {
if [ -n "$REPO_BACKUP_DIR" ] && [ -d "$REPO_BACKUP_DIR" ]; then
rm -rf "$REPO_BACKUP_DIR"
REPO_BACKUP_DIR=""
fi
}
finalize_deb822() {
if [ -f /etc/apt/sources.list ]; then
sudo mv /etc/apt/sources.list /etc/apt/sources.list.disabled
echo "Classic sources.list disabled (renamed to sources.list.disabled)"
fi
cleanup_repo_backup
}
configure_repos() { configure_repos() {
echo -e "${YELLOW}Repository configuration...${NC}" echo -e "${YELLOW}Repository configuration...${NC}"
local use_deb822 local use_deb822
if whiptail --title "Repository Format" --defaultno \ if whiptail --title "Repository Format" --defaultno \
--yesno "Use the modern .sources (deb822) format?\n(default is classic one-line style)" 10 60; then --yesno "Use the modern .sources (deb822) format?\n(default is classic one-line style)" 10 60; then
@@ -12,7 +58,6 @@ configure_repos() {
use_deb822=false use_deb822=false
fi fi
local enable_backports local enable_backports
if whiptail --title "Backports" \ if whiptail --title "Backports" \
--yesno "Enable backports?\nBackports provide newer versions of some software (kernel, drivers, Mesa) for better hardware support.\nIt is recommended to enable it (default: Yes)." 12 70; then --yesno "Enable backports?\nBackports provide newer versions of some software (kernel, drivers, Mesa) for better hardware support.\nIt is recommended to enable it (default: Yes)." 12 70; then
@@ -21,6 +66,14 @@ configure_repos() {
enable_backports=false enable_backports=false
fi fi
if [ -z "$DEBIAN_CODENAME" ]; then
echo -e "${RED}Error: Could not detect Debian codename. Aborting.${NC}"
return 1
fi
sync_system_time
backup_current_repos
if $use_deb822; then if $use_deb822; then
generate_deb822_sources "$DEBIAN_CODENAME" "$enable_backports" generate_deb822_sources "$DEBIAN_CODENAME" "$enable_backports"
@@ -28,43 +81,41 @@ configure_repos() {
generate_classic_sources "$DEBIAN_CODENAME" "$enable_backports" generate_classic_sources "$DEBIAN_CODENAME" "$enable_backports"
fi fi
echo "Updating package lists..." echo "Updating package lists..."
if sudo apt update; then if sudo apt update; then
REPOS_CONFIGURED=true REPOS_CONFIGURED=true
echo -e "${GREEN}Repositories configured and updated successfully.${NC}" echo -e "${GREEN}Repositories configured and updated successfully.${NC}"
if $use_deb822; then
finalize_deb822
else
cleanup_repo_backup
fi
local upgradable local upgradable
upgradable=$(apt list --upgradable 2>/dev/null | grep -c /) upgradable=$(apt list --upgradable 2>/dev/null | grep -c /)
if [ "$upgradable" -gt 0 ]; then if [ "$upgradable" -gt 0 ]; then
if whiptail --title "Upgrade System" \ if whiptail --title "Upgrade System" \
--yesno "There are $upgradable packages that can be upgraded.\n\nDo you want to upgrade them now?" 10 60; then --yesno "There are $upgradable packages that can be upgraded.\n\nDo you want to upgrade them now?" 10 60; then
sudo apt-mark hold tzdata 2>/dev/null || true
sudo apt upgrade -y sudo apt upgrade -y
sudo apt-mark unhold tzdata 2>/dev/null || true
echo -e "${GREEN}System upgraded.${NC}" echo -e "${GREEN}System upgraded.${NC}"
else else
echo "Skipping upgrade." echo "Skipping upgrade."
fi fi
fi fi
else else
echo -e "${RED}apt update failed. Please check your network and repository configuration.${NC}" restore_previous_repos
echo -e "${RED}apt update failed. Previous repository configuration restored.${NC}"
return 1 return 1
fi fi
} }
# ----------------------------------------------------------------------
# Generate classic sources.list
# ----------------------------------------------------------------------
generate_classic_sources() { generate_classic_sources() {
local codename="$1" local codename="$1"
local backports="$2" local backports="$2"
if [ -f /etc/apt/sources.list ]; then
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
echo "Backup of sources.list saved as sources.list.bak"
fi
local content="" local content=""
content="# Official repository\n" content="# Official repository\n"
content+="deb https://deb.debian.org/debian ${codename} main contrib non-free non-free-firmware\n" content+="deb https://deb.debian.org/debian ${codename} main contrib non-free non-free-firmware\n"
@@ -87,24 +138,15 @@ generate_classic_sources() {
content+="# deb https://deb.debian.org/debian ${codename}-backports main contrib non-free non-free-firmware\n" content+="# deb https://deb.debian.org/debian ${codename}-backports main contrib non-free non-free-firmware\n"
fi fi
echo -e "$content" | sudo tee /etc/apt/sources.list > /dev/null echo -e "$content" | sudo tee /etc/apt/sources.list > /dev/null
} }
# ----------------------------------------------------------------------
# Generate deb822 .sources format
# ----------------------------------------------------------------------
generate_deb822_sources() { generate_deb822_sources() {
local codename="$1" local codename="$1"
local backports="$2" local backports="$2"
sudo mkdir -p /etc/apt/sources.list.d sudo mkdir -p /etc/apt/sources.list.d
sudo rm -f /etc/apt/sources.list.d/debian.sources
local content="" local content=""
content="Types: deb\n" content="Types: deb\n"
content+="URIs: https://deb.debian.org/debian\n" content+="URIs: https://deb.debian.org/debian\n"
@@ -121,16 +163,7 @@ generate_deb822_sources() {
content+="URIs: https://deb.debian.org/debian\n" content+="URIs: https://deb.debian.org/debian\n"
content+="Suites: ${codename}-backports\n" content+="Suites: ${codename}-backports\n"
content+="Components: main contrib non-free non-free-firmware\n" content+="Components: main contrib non-free non-free-firmware\n"
else
true
fi fi
echo -e "$content" | sudo tee /etc/apt/sources.list.d/debian.sources > /dev/null echo -e "$content" | sudo tee /etc/apt/sources.list.d/debian.sources > /dev/null
if [ -f /etc/apt/sources.list ]; then
sudo mv /etc/apt/sources.list /etc/apt/sources.list.disabled
echo "Classic sources.list disabled (renamed to sources.list.disabled)"
fi
} }
+67 -22
View File
@@ -8,9 +8,10 @@ CPU_SUMMARY=""
RAM_SUMMARY="" RAM_SUMMARY=""
GPU_TYPE="" GPU_TYPE=""
GPU_DESC="" GPU_DESC=""
GPU_VERSION=""
INTEL_GPU_DEVICE_ID="" INTEL_GPU_DEVICE_ID=""
NVIDIA_GPU_DEVICE_ID="" NVIDIA_GPU_DEVICE_ID=""
WIFI_SUMMARY="Not detected" KERNEL_VERSION=""
WIFI_CHIPSET="" WIFI_CHIPSET=""
# -------------------------- # --------------------------
@@ -30,20 +31,45 @@ check_sudo() {
fi fi
} }
# --------------------------------
# Time sync before network ops
# --------------------------------
sync_system_time() {
if command -v timedatectl &> /dev/null; then
local ntp_active
ntp_active=$(timedatectl show --property=NTP --value 2>/dev/null || echo "no")
if [ "$ntp_active" != "yes" ]; then
echo -e "${YELLOW}NTP not active. Attempting to enable time sync...${NC}"
sudo timedatectl set-ntp true 2>/dev/null || true
sleep 2
fi
elif command -v hwclock &> /dev/null && command -v ntpd &> /dev/null; then
sudo hwclock --hctosys 2>/dev/null || true
fi
}
# -------------------------------- # --------------------------------
# Debian version detection # Debian version detection
# -------------------------------- # --------------------------------
detect_debian_version() { detect_debian_version() {
if ! command -v lsb_release &> /dev/null; then if ! command -v lsb_release &> /dev/null; then
echo -e "${YELLOW}Installing lsb-release...${NC}" if [ -f /etc/os-release ]; then
sudo apt update -qq && sudo apt install -y -qq lsb-release DEBIAN_CODENAME=$(grep -oP 'VERSION_CODENAME=\K\w+' /etc/os-release 2>/dev/null || echo "")
fi
if [ -z "$DEBIAN_CODENAME" ]; then
echo -e "${YELLOW}Installing lsb-release...${NC}"
sync_system_time
sudo apt update -qq 2>/dev/null && sudo apt install -y -qq lsb-release
fi
fi
if [ -z "$DEBIAN_CODENAME" ]; then
DEBIAN_CODENAME=$(lsb_release -cs 2>/dev/null || echo "")
fi fi
DEBIAN_CODENAME=$(lsb_release -cs)
case "$DEBIAN_CODENAME" in case "$DEBIAN_CODENAME" in
bookworm) DEBIAN_VERSION="12" ;; bookworm) DEBIAN_VERSION="12" ;;
trixie) DEBIAN_VERSION="13" ;; trixie) DEBIAN_VERSION="13" ;;
*) *)
echo -e "${RED}Unsupported Debian version: $DEBIAN_CODENAME. Only 12 (bookworm) and 13 (trixie) are supported.${NC}" echo -e "${RED}Unsupported Debian version: '$DEBIAN_CODENAME'. Only 12 (bookworm) and 13 (trixie) are supported.${NC}"
exit 1 exit 1
;; ;;
esac esac
@@ -55,7 +81,7 @@ detect_debian_version() {
detect_cpu_ram() { detect_cpu_ram() {
CPU_SUMMARY=$(grep -m1 'model name' /proc/cpuinfo | sed 's/.*: //') CPU_SUMMARY=$(grep -m1 'model name' /proc/cpuinfo | sed 's/.*: //')
RAM_KB=$(grep MemTotal /proc/meminfo | awk '{print $2}') RAM_KB=$(grep MemTotal /proc/meminfo | awk '{print $2}')
RAM_GB=$((RAM_KB / 1024 / 1024)) RAM_GB=$(awk -v kb="$RAM_KB" 'BEGIN { printf "%.2f", kb / 1048576 }')
RAM_SUMMARY="${RAM_GB} GB" RAM_SUMMARY="${RAM_GB} GB"
} }
@@ -67,6 +93,13 @@ get_ram_summary() {
echo "$RAM_SUMMARY" echo "$RAM_SUMMARY"
} }
# ----------------------------------
# Kernel version
# ----------------------------------
detect_kernel() {
KERNEL_VERSION=$(uname -r)
}
# ---------------------------------- # ----------------------------------
# GPU detection # GPU detection
# ---------------------------------- # ----------------------------------
@@ -96,6 +129,21 @@ detect_gpu() {
else else
GPU_TYPE="unknown" GPU_TYPE="unknown"
fi fi
if [ "$GPU_TYPE" = "nvidia" ]; then
local nv_ver
nv_ver=$(nvidia-smi --query-gpu=driver_version --format=csv,noheader 2>/dev/null | head -1)
if [ -z "$nv_ver" ]; then
nv_ver=$(dpkg -l nvidia-driver 2>/dev/null | awk '/^ii/ {print $3}' | sed 's/-.*//')
fi
[ -n "$nv_ver" ] && GPU_VERSION="NVIDIA $nv_ver"
fi
if [ -z "$GPU_VERSION" ]; then
local mesa_ver
mesa_ver=$(dpkg -l libgl1-mesa-dri 2>/dev/null | awk '/^ii/ {print $3; exit}' | sed 's/-.*//')
[ -n "$mesa_ver" ] && GPU_VERSION="Mesa $mesa_ver"
fi
} }
get_gpu_summary() { get_gpu_summary() {
@@ -107,28 +155,25 @@ get_gpu_summary() {
} }
# ------------------------------------- # -------------------------------------
# WiFi chipset detection # Network adapter detection
# ------------------------------------- # -------------------------------------
WIFI_SUMMARY="Not detected"
WIFI_CHIPSET="" WIFI_CHIPSET=""
WIFI_DESC="" WIFI_DESC=""
ETH_DESC=""
detect_wifi_chipset() { detect_network() {
local net_line local eth_line
net_line=$(lspci -nn | grep -i 'Network controller' | head -n1) || true eth_line=$(lspci -nn | grep -i 'Ethernet controller' | head -n1) || true
if [ -z "$net_line" ]; then if [ -n "$eth_line" ]; then
WIFI_SUMMARY="No WiFi adapter found" ETH_DESC=$(echo "$eth_line" | sed -E 's/^.*\]: //; s/ \[[0-9a-fA-F]{4}:[0-9a-fA-F]{4}\]//; s/ \(rev [0-9a-fA-F]+\)//')
WIFI_CHIPSET=""
WIFI_DESC=""
return
fi fi
WIFI_CHIPSET="$net_line"
WIFI_DESC=$(echo "$net_line" | sed -E 's/^.*\]: //; s/ \[[0-9a-fA-F]{4}:[0-9a-fA-F]{4}\]//; s/ \(rev [0-9a-fA-F]+\)//')
WIFI_SUMMARY="$WIFI_DESC"
}
get_wifi_summary() { local wifi_line
echo "$WIFI_SUMMARY" wifi_line=$(lspci -nn | grep -i 'Network controller' | head -n1) || true
if [ -n "$wifi_line" ]; then
WIFI_CHIPSET="$wifi_line"
WIFI_DESC=$(echo "$wifi_line" | sed -E 's/^.*\]: //; s/ \[[0-9a-fA-F]{4}:[0-9a-fA-F]{4}\]//; s/ \(rev [0-9a-fA-F]+\)//')
fi
} }
# --------------------------------------- # ---------------------------------------