Skip to content

Instantly share code, notes, and snippets.

@teklynk
Created July 29, 2026 05:56
Show Gist options
  • Select an option

  • Save teklynk/d21f97393fac53b930ce339e0c6e24a8 to your computer and use it in GitHub Desktop.

Select an option

Save teklynk/d21f97393fac53b930ce339e0c6e24a8 to your computer and use it in GitHub Desktop.
Debian XFCE post install script example. Add your own themes, configs, wallpapers
#!/bin/bash
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Extract any bundled .tar.xz archives into the current working directory
shopt -s nullglob
for archive in "$PWD"/*.tar.xz "$SCRIPT_DIR"/*.tar.xz; do
[ -e "$archive" ] || continue
echo "Extracting $(basename "$archive") into $PWD"
tar -xJf "$archive" -C "$PWD"
done
shopt -u nullglob
# Check for sudo user
if [[ $EUID -ne 0 ]]; then
# Not running as root, try to escalate with sudo
if command -v sudo &>/dev/null; then
exec sudo "$0" "$@"
else
echo "Sudo not available. Run as root:"
echo " su - && bash $0 $USER"
exit 1
fi
fi
# Now running as root
TARGET_USER="${SUDO_USER:-${1:-$USER}}"
usermod -aG sudo "$TARGET_USER"
# Enable non-free repos (non-interactive)
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
cat << EOF | sudo tee /etc/apt/sources.list >/dev/null
deb http://deb.debian.org/debian trixie main contrib non-free non-free-firmware
deb http://deb.debian.org/debian trixie-updates main contrib non-free non-free-firmware
deb http://security.debian.org/debian-security trixie-security main contrib non-free non-free-firmware
EOF
# Time Sync Fix (Crucial for apt update)
echo "Configuring Time Sync (NTP)..."
timesyncdconf="/etc/systemd/timesyncd.conf"
sed -i '/^#\?NTP=/d; /^#\?FallbackNTP=/d' "$timesyncdconf"
cat >> "$timesyncdconf" <<'EOF'
NTP=time.cloudflare.com
FallbackNTP=0.debian.pool.ntp.org ntp.ubuntu.com pool.ntp.org
EOF
systemctl restart systemd-timesyncd
timedatectl status
# Codium GPG key
wget -qO - https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg \
| gpg --dearmor \
| sudo dd of=/usr/share/keyrings/vscodium-archive-keyring.gpg
# Add Codium repository
echo 'deb [ signed-by=/usr/share/keyrings/vscodium-archive-keyring.gpg ] https://download.vscodium.com/debs vscodium main' \
| sudo tee /etc/apt/sources.list.d/vscodium.list
# Update and upgrade
sudo apt update && sudo apt upgrade -y
# Firmware & drivers
sudo apt install -y firmware-b43-installer bluez blueman flatpak apt-transport-https
# Bluetooth
sudo systemctl enable --now bluetooth
# Remove unwanted packages from installer defaults
sudo apt purge -y xterm libreoffice-core libreoffice-common xfce4-terminal atril-common exfalso parole quodlibet xfburn xsane chromium firefox-esr gnome-software gnome-software-plugin-flatpak
sudo apt autoremove --purge -y
# Primary apt packages
sudo apt install -y fastfetch systemd-timesyncd net-tools network-manager curl openjdk-21-jre-headless git kodi mpv kazam cheese audacity \
openssh-client openssh-server shotcut meld bleachbit filezilla uget remmina transmission \
gimp gparted tilix nfs-common htop build-essential cmake python3-pip keepassxc xdotool ufw \
x11-utils krita inkscape sqlite3 minetest httrack ca-certificates gnupg \
openarena hedgewars v4l-utils supertuxkart powertop ffmpeg smartmontools btop audacious \
clamav clamtk synaptic abiword mousepad wget codium flatpak \
galculator timeshift lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings \
gnome-disk-utility xfce4-whiskermenu-plugin fonts-inter dmz-cursor-theme dbus-x11 ristretto
# Install Browser
curl -fsS https://dl.brave.com/install.sh | FLAVOR=origin sh
# Flatpak setup
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
# Flatpak apps
flatpak install -y com.github.tchx84.Flatseal org.localsend.localsend_app com.discordapp.Discord org.xonotic.Xonotic com.github.debauchee.barrier
# Copy wallpapers, themes, and icons system-wide
echo "Installing wallpapers, themes, and icons..."
# Wallpapers (create subdirectory if desired)
cp -r "$SCRIPT_DIR/wallpapers/"* /usr/share/images/desktop-base/ 2>/dev/null || true
# Theme
if [ -d "$SCRIPT_DIR/Qogir" ]; then
cp -r "$SCRIPT_DIR/Qogir/"* /usr/share/themes/
fi
# Icons
if [ -d "$SCRIPT_DIR/01-Qogir" ]; then
cp -r "$SCRIPT_DIR/01-Qogir/"* /usr/share/icons/
fi
# Set ownership (root is fine for system-wide, but ensure readable by all)
chmod -R 755 /usr/share/images/desktop-base 2>/dev/null || true
chmod -R 755 /usr/share/themes/Qogir 2>/dev/null || true
chmod -R 755 /usr/share/themes/Qogir-Dark 2>/dev/null || true
chmod -R 755 /usr/share/themes/Qogir-Light 2>/dev/null || true
chmod -R 755 /usr/share/icons/Qogir 2>/dev/null || true
chmod -R 755 /usr/share/icons/Qogir-Dark 2>/dev/null || true
chmod -R 755 /usr/share/icons/Qogir-Light 2>/dev/null || true
echo "Configuring lightdm"
lightdmconf="/etc/lightdm/lightdm-gtk-greeter.conf"
# Back up the existing file if it exists
[ -f "$lightdmconf" ] && cp "$lightdmconf" "$lightdmconf.bak"
# Write this to the conf
cat > "$lightdmconf" <<'EOF'
[greeter]
background = /usr/share/images/desktop-base/0239.jpg
theme-name = Qogir-Dark
icon-theme-name = Qogir-Dark
font-name = Inter 10
user-background = false
hide-user-image = true
position = 25%,start 50%,center
indicators = ~spacer;~power
EOF
echo "Post-install complete!"
echo "Please log out and back in for sudo group changes to take effect."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment