Skip to content

Instantly share code, notes, and snippets.

@john-clark
Last active February 26, 2025 17:20
Show Gist options
  • Save john-clark/d4065ba622e34438d69ab909b60c3435 to your computer and use it in GitHub Desktop.
Save john-clark/d4065ba622e34438d69ab909b60c3435 to your computer and use it in GitHub Desktop.
### Preseed configuration for Debian
# Type auto http://server/preseed.cfg at netinst grub prompt
# Locale
d-i debian-installer/language string en
d-i debian-installer/locale string en_US
d-i debian-installer/country string US
# Keyboard
d-i keyboard-configuration/xkb-keymap select us
d-i keyboard-configuration/layoutcode string us
d-i console-setup/layoutcode string us
d-i console-setup/ask_detect boolean false
d-i console-setup/layout string us
d-i console-setup/modelcode string pc105
# Clock
d-i time/zone string America/Chicago
d-i clock-setup/utc boolean true
d-i clock-setup/ntp boolean true
# Network configuration
d-i netcfg/get_hostname string ""
d-i netcfg/get_domain string local
### User setup
d-i passwd/root-password password root
d-i passwd/root-password-again password root
d-i passwd/user-fullname string emu
d-i passwd/username string emu
d-i passwd/user-password password emu
d-i passwd/user-password-again password emu
### Partitioning
d-i partman-auto/method string regular
d-i partman-auto/choose_recipe select atomic
d-i partman-auto/disk string /dev/sda
d-i partman/confirm boolean true
d-i partman/confirm_write_new_label boolean true
d-i partman-lvm/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
# Install GRUB bootloader
d-i grub-installer/only_debian boolean true
d-i grub-installer/bootdev string /dev/sda
### Software selection
tasksel tasksel/first multiselect standard ssh-server
### Package selection
popularity-contest popularity-contest/participate boolean false
# Finish installation
d-i finish-install/reboot_in_progress note
d-i finish-install/keep-consoles boolean true
d-i finish-install/enable-boot boolean true
d-i finish-install/reboot boolean true
#!/bin/sh
# Function to log messages to syslog
log_message() {
logger -t preseed-setup "$1"
}
get_debian_version() {
if [ -f /etc/os-release ]; then
. /etc/os-release
echo "$VERSION_CODENAME"
else
log_message "Unable to determine Debian version"
exit 1
fi
}
version=$(get_debian_version)
#version=$(lsb_release -sc 2>/dev/null)
if [ -z "$version" ]; then
echo "Error: version is unset or empty."
exit 1
fi
# Add Proxmox repository if not already present
if ! grep -q "deb http://download.proxmox.com/debian/pve $version pve-no-subscription" /etc/apt/sources.list.d/pve-no-subscription.list 2>/dev/null; then
echo "deb http://download.proxmox.com/debian/pve $version pve-no-subscription" > /etc/apt/sources.list.d/pve-no-subscription.list
log_message "Added Proxmox repository."
else
log_message "Proxmox repository already exists."
fi
# Import Proxmox GPG key if not already present
if ! [ -f /etc/apt/trusted.gpg.d/proxmox-release-$version.gpg ]; then
wget -q "https://enterprise.proxmox.com/debian/proxmox-release-$version.gpg" -O /etc/apt/trusted.gpg.d/proxmox-release-$version.gpg
log_message "Imported Proxmox GPG key."
else
log_message "Proxmox GPG key already exists."
fi
# Update package lists
apt-get update
log_message "Updated package lists."
# install my software
apt install -y spice-vdagent qemu-guest-agent spice-webdavd alsa-utils xorg xinit
# set volume
amixer set Master unmute 2>/dev/null
amixer set Master 50% 2>/dev/null
# Add user to sudo group
usermod -aG sudo emu
log_message "Added user emu to sudo group."
#!/bin/sh
set -x
# Function to log messages to syslog
log_message() {
logger -t preseed-setup "$1"
}
get_debian_version() {
if [ -f /etc/os-release ]; then
. /etc/os-release
echo "$VERSION_CODENAME"
else
log_message "Unable to determine Debian version"
exit 1
fi
}
version=$(get_debian_version)
#version=$(lsb_release -sc 2>/dev/null)
if [ -z "$version" ]; then
echo "Error: version is unset or empty."
exit 1
fi
# Add backports repository if not already present
if grep -q "deb.*${version}-backports" /etc/apt/sources.list /etc/apt/sources.list.d/*; then
log_message "Backports is already enabled in your system."
else
echo "deb http://deb.debian.org/debian $version-backports main contrib non-free non-free-firmware" | tee /etc/apt/sources.list.d/backports.list
log_message "Backports repository has been enabled in your system."
fi
# Update package lists
apt-get update
log_message "Updated package lists."
# Adding my other repos
apt-get -s -y install software-properties-common
apt -s update
apt-add-repository -y contrib
apt-add-repository -y non-free
log_message "Contrib and non-free repositories added."
apt update
# install my software
apt-get -s -y install spice-vdagent qemu-guest-agent spice-webdavd alsa-utils xorg xinit
log_message "software installed"
# set volume
amixer set Master unmute 2>/dev/null
amixer set Master 50% 2>/dev/null
log_message "audio volumen set"
# Add user to sudo group
usermod -aG sudo amiga
log_message "Added user amiga to sudo group."
#!/bin/sh
di() {
for deb_file in "$@"; do
local package_name=$(basename "$deb_file" | cut -d'_' -f1)
if dpkg -l | grep -q "^ii $package_name "; then
echo "$package_name is already installed, skipping installation."
else
dpkg -i "$deb_file"
fi
done
}
wg() {
set -e
local url=$1
local filename=$(basename "$url")
if [ -f "$filename" ]; then
echo "$filename already exists, skipping download."
else
wget "$url"
fi
set +e
}
ai() {
for package in "$@"; do
if apt list --installed 2>/dev/null | grep -q "^$package/"; then
echo "$package is already installed, skipping installation."
else
apt install -y "$package"
fi
done
}
wg https://versaweb.dl.sourceforge.net/project/vice-emu/releases/binaries/debian/gtk3vice_3.9.deb
wg http://security.debian.org/debian-security/pool/updates/main/f/flac/libflac8_1.3.3-2+deb11u2_amd64.deb
wg http://ftp.debian.org/debian/pool/main/g/gcc-12/libstdc++6_12.2.0-14_amd64.deb
wg http://ftp.debian.org/debian/pool/main/g/glibc/libc6_2.38-1_amd64.deb
di libstdc++6_12.2.0-14_amd64.deb libc6_2.38-1_amd64.deb libflac8_1.3.3-2+deb11u3_amd64.deb
# Adding my software
ai libportaudio2 libgif7 libpcap0.8 libcurl4 libudev-dev libglew-dev libieee1284-3 libportaudio2 libgl1-mesa-dev libglu1-mesa-dev libglew-dev libglfw3-dev
di gtk3vice_3.9.deb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment