From 2aa1459b15c841551059e580d02c1e5f90a0cd38 Mon Sep 17 00:00:00 2001 From: Arthur Erlich Date: Fri, 3 Apr 2026 11:30:28 +0200 Subject: [PATCH] chore(install): added install script for basic linux preperation --- Kbuntu/install-packages.sh | 156 +++++++++++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 Kbuntu/install-packages.sh diff --git a/Kbuntu/install-packages.sh b/Kbuntu/install-packages.sh new file mode 100644 index 0000000..28c80c2 --- /dev/null +++ b/Kbuntu/install-packages.sh @@ -0,0 +1,156 @@ +#!/bin/bash +# Kubuntu Package Installer +# Installs: LibreOffice, FreeCAD, VLC, Thunderbird, Firefox, +# Timeshift, configures automatic updates + pre-apt snapshots, +# and enables SDDM auto-login for the current user +# ------------------------------------------------------------- + +set -e + +# Capture the user running the script (works even under sudo) +CURRENT_USER="${SUDO_USER:-$USER}" + +echo "Updating package lists..." +sudo apt update && sudo apt upgrade -y + +echo "Installing packages..." +sudo apt install -y \ + libreoffice \ + libreoffice-l10n-de \ + libreoffice-kde \ + freecad \ + vlc \ + vlc-plugin-access-extra \ + vlc-plugin-notify \ + thunderbird \ + firefox \ + ubuntu-restricted-extras \ + ffmpeg \ + ttf-mscorefonts-installer \ + timeshift \ + unattended-upgrades \ + apt-listchanges + +# ------------------------------------------------------------- +# Auto-updates: configure unattended-upgrades +# ------------------------------------------------------------- +echo "" +echo "Configuring automatic updates..." + +sudo dpkg-reconfigure --priority=low unattended-upgrades + +sudo tee /etc/apt/apt.conf.d/50unattended-upgrades > /dev/null <<'EOF' +Unattended-Upgrade::Allowed-Origins { + "${distro_id}:${distro_codename}"; + "${distro_id}:${distro_codename}-security"; + "${distro_id}ESMApps:${distro_codename}-apps-security"; + "${distro_id}ESM:${distro_codename}-infra-security"; + "${distro_id}:${distro_codename}-updates"; +}; + +// Automatically reboot if required (e.g. kernel update) — set to true if desired +Unattended-Upgrade::Automatic-Reboot "false"; +Unattended-Upgrade::Automatic-Reboot-Time "03:00"; + +// Remove unused kernel packages after upgrade +Unattended-Upgrade::Remove-Unused-Kernel-Packages "true"; + +// Remove unused dependencies +Unattended-Upgrade::Remove-Unused-Dependencies "true"; + +// Send email on errors (optional — replace with your address or leave empty) +// Unattended-Upgrade::Mail "you@example.com"; +// Unattended-Upgrade::MailReport "on-change"; +EOF + +sudo tee /etc/apt/apt.conf.d/20auto-upgrades > /dev/null <<'EOF' +APT::Periodic::Update-Package-Lists "1"; +APT::Periodic::Download-Upgradeable-Packages "1"; +APT::Periodic::AutocleanInterval "7"; +APT::Periodic::Unattended-Upgrade "1"; +EOF + +echo "Auto-updates configured." + +# ------------------------------------------------------------- +# Timeshift pre-apt hook +# Creates a snapshot automatically before any apt install/upgrade +# ------------------------------------------------------------- +echo "" +echo "Installing Timeshift pre-apt snapshot hook..." + +sudo tee /usr/local/bin/timeshift-pre-apt.sh > /dev/null <<'EOF' +#!/bin/bash +# Auto-snapshot before apt operations +LOGFILE="/var/log/timeshift-auto.log" +TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S') + +echo "[$TIMESTAMP] apt operation detected — creating Timeshift snapshot..." | tee -a "$LOGFILE" + +if ! command -v timeshift &>/dev/null; then + echo "[$TIMESTAMP] WARNING: timeshift not found, skipping snapshot." | tee -a "$LOGFILE" + exit 0 +fi + +if ! timeshift --list &>/dev/null; then + echo "[$TIMESTAMP] WARNING: Timeshift not configured yet, skipping snapshot." | tee -a "$LOGFILE" + exit 0 +fi + +timeshift --create --comments "auto: pre-apt $(date '+%Y-%m-%d %H:%M')" --tags D 2>&1 | tee -a "$LOGFILE" +echo "[$TIMESTAMP] Snapshot complete." | tee -a "$LOGFILE" +EOF + +sudo chmod +x /usr/local/bin/timeshift-pre-apt.sh + +sudo tee /etc/apt/apt.conf.d/80timeshift-pre-apt > /dev/null <<'EOF' +DPkg::Pre-Invoke { "/usr/local/bin/timeshift-pre-apt.sh"; }; +EOF + +echo "Timeshift pre-apt hook installed." +echo " Hook script: /usr/local/bin/timeshift-pre-apt.sh" +echo " apt config: /etc/apt/apt.conf.d/80timeshift-pre-apt" +echo " Log file: /var/log/timeshift-auto.log" + +# ------------------------------------------------------------- +# SDDM auto-login for current user +# ------------------------------------------------------------- +echo "" +echo "Configuring SDDM auto-login for user: $CURRENT_USER" + +sudo mkdir -p /etc/sddm.conf.d + +sudo tee /etc/sddm.conf.d/autologin.conf > /dev/null <