init commit

This commit is contained in:
2025-09-14 14:22:00 -07:00
commit 0fcf53e525
14 changed files with 1065 additions and 0 deletions

9
templates/dhcpd.conf.j2 Executable file
View File

@ -0,0 +1,9 @@
subnet {{ dhcp_subnet }} netmask {{ dhcp_netmask }} {
range {{ dhcp_start }} {{ dhcp_end }};
option routers {{ router_ip }};
option domain-name-servers 8.8.8.8, 8.8.4.4;
next-server {{ server_ip }}; # IP of your PXE server
interface {{ listen_interface }};
filename "debian-installer/amd64/grubx64.efi";
}

163
templates/grub-iso.cfg.j2 Executable file
View File

@ -0,0 +1,163 @@
if loadfont $prefix/font.pf2 ; then
set gfxmode=800x600
set gfxpayload=keep
insmod efi_gop
insmod efi_uga
insmod video_bochs
insmod video_cirrus
insmod gfxterm
insmod png
terminal_output gfxterm
fi
if background_image /isolinux/splash.png; then
set color_normal=light-gray/black
set color_highlight=white/black
elif background_image /splash.png; then
set color_normal=light-gray/black
set color_highlight=white/black
else
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
fi
insmod play
play 960 440 1 0 4 440 1
set timeout=5
set default=0
menuentry 'Cosmos-Base - Debian 13' {
set background_color=black
linux /debian-installer/amd64/linux vga=788 priority=critical auto=true preseed/url=http://{{ server_ip }}/preseed-server.cfg
initrd /debian-installer/amd64/initrd.gz
}
#menuentry 'Cosmos-Base + KDE Plasma' {
# set background_color=black
# linux /debian-installer/amd64/linux vga=788 priority=critical auto=true preseed/url=http://{{ server_ip }}preseed-plasma.cfg
# initrd /debian-installer/amd64/initrd.gz
#}
menuentry 'Easeus Test 1' {
set isofile="/iso/easeus.iso"
loopback loop (tftp,{{ server_ip }})$isofile
linux /debian-installer/amd64/linux boot=casper iso-scan/filename=http://{{ server_ip }}$isofile noeject noprompt splash --
initrd /debian-installer/amd64/initrd.gz
}
menuentry "Easeus Test 2" {
set root="http,{{ server_ip }}"
set isofile="easeus.iso"
loopback loop0 ($root)/iso/$isofile
linux /debian-installer/amd64/linux boot=casper iso-scan/filename=${isofile} verbose noprompt noeject
initrd /debian-installer/amd64/initrd.gz
}
#menuentry 'Cosmos-Base + KDE Plasma' {
# set background_color=black
# linux /debian-installer/amd64/linux vga=788 priority=critical auto=true preseed/url=http://{{ server_ip }}preseed-plasma.cfg
# initrd /debian-installer/amd64/initrd.gz
#}
menuentry 'Install' {
set background_color=black
linux /debian-installer/amd64/linux vga=788 --- quiet
initrd /debian-installer/amd64/initrd.gz
}
submenu --hotkey=a 'Advanced options ...' {
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
set gfxpayload=keep
menuentry '... Expert install' {
set background_color=black
linux /debian-installer/amd64/linux priority=low vga=788 ---
initrd /debian-installer/amd64/initrd.gz
}
menuentry '... Rescue mode' {
set background_color=black
linux /debian-installer/amd64/linux vga=788 rescue/enable=true --- quiet
initrd /debian-installer/amd64/initrd.gz
}
menuentry '... Automated install' {
set background_color=black
linux /debian-installer/amd64/linux auto=true priority=critical vga=788 --- quiet
initrd /debian-installer/amd64/initrd.gz
}
submenu '... Desktop environment menu ...' {
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
set gfxpayload=keep
submenu '... GNOME desktop boot menu ...' {
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
set gfxpayload=keep
menuentry '... Install' {
set background_color=black
linux /debian-installer/amd64/linux desktop=gnome vga=788 --- quiet
initrd /debian-installer/amd64/initrd.gz
}
submenu '... GNOME advanced options ...' {
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
set gfxpayload=keep
menuentry '... Expert install' {
set background_color=black
linux /debian-installer/amd64/linux desktop=gnome priority=low vga=788 ---
initrd /debian-installer/amd64/initrd.gz
}
menuentry '... Automated install' {
set background_color=black
linux /debian-installer/amd64/linux desktop=gnome auto=true priority=critical vga=788 --- quiet
initrd /debian-installer/amd64/initrd.gz
}
}
}
submenu '... KDE Plasma desktop boot menu ...' {
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
set gfxpayload=keep
menuentry '... Install' {
set background_color=black
linux /debian-installer/amd64/linux desktop=kde vga=788 --- quiet
initrd /debian-installer/amd64/initrd.gz
}
submenu '... KDE Plasma advanced options ...' {
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
set gfxpayload=keep
menuentry '... Expert install' {
set background_color=black
linux /debian-installer/amd64/linux desktop=kde priority=low vga=788 ---
initrd /debian-installer/amd64/initrd.gz
}
menuentry '... Automated install' {
set background_color=black
linux /debian-installer/amd64/linux desktop=kde auto=true priority=critical vga=788 --- quiet
initrd /debian-installer/amd64/initrd.gz
}
}
}
submenu '... LXDE desktop boot menu ...' {
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
set gfxpayload=keep
menuentry '... Install' {
set background_color=black
linux /debian-installer/amd64/linux desktop=lxde vga=788 --- quiet
initrd /debian-installer/amd64/initrd.gz
}
submenu '... LXDE advanced options ...' {
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
set gfxpayload=keep
menuentry '... Expert install' {
set background_color=black
linux /debian-installer/amd64/linux desktop=lxde priority=low vga=788 ---
initrd /debian-installer/amd64/initrd.gz
}
menuentry '... Automated install' {
set background_color=black
linux /debian-installer/amd64/linux desktop=lxde auto=true priority=critical vga=788 --- quiet
initrd /debian-installer/amd64/initrd.gz
}
}
}
}
}

138
templates/grub.cfg.j2 Executable file
View File

@ -0,0 +1,138 @@
if loadfont $prefix/font.pf2 ; then
set gfxmode=800x600
set gfxpayload=keep
insmod efi_gop
insmod efi_uga
insmod video_bochs
insmod video_cirrus
insmod gfxterm
insmod png
terminal_output gfxterm
fi
if background_image /isolinux/splash.png; then
set color_normal=light-gray/black
set color_highlight=white/black
elif background_image /splash.png; then
set color_normal=light-gray/black
set color_highlight=white/black
else
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
fi
insmod play
play 960 440 1 0 4 440 1
set timeout=5
set default=0
menuentry 'Cosmos-Base Debian 13 Install' {
set background_color=black
linux /debian-installer/amd64/linux vga=788 priority=critical auto=true preseed/url=http://{{ server_ip }}/preseed-server.cfg
initrd /debian-installer/amd64/initrd.gz
}
menuentry 'Default Debian 13 Install' {
set background_color=black
linux /debian-installer/amd64/linux vga=788 --- quiet
initrd /debian-installer/amd64/initrd.gz
}
submenu --hotkey=a 'Advanced options ...' {
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
set gfxpayload=keep
menuentry '... Expert install' {
set background_color=black
linux /debian-installer/amd64/linux priority=low vga=788 ---
initrd /debian-installer/amd64/initrd.gz
}
menuentry '... Rescue mode' {
set background_color=black
linux /debian-installer/amd64/linux vga=788 rescue/enable=true --- quiet
initrd /debian-installer/amd64/initrd.gz
}
menuentry '... Automated install' {
set background_color=black
linux /debian-installer/amd64/linux auto=true priority=critical vga=788 --- quiet
initrd /debian-installer/amd64/initrd.gz
}
submenu '... Desktop environment menu ...' {
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
set gfxpayload=keep
submenu '... GNOME desktop boot menu ...' {
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
set gfxpayload=keep
menuentry '... Install' {
set background_color=black
linux /debian-installer/amd64/linux desktop=gnome vga=788 --- quiet
initrd /debian-installer/amd64/initrd.gz
}
submenu '... GNOME advanced options ...' {
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
set gfxpayload=keep
menuentry '... Expert install' {
set background_color=black
linux /debian-installer/amd64/linux desktop=gnome priority=low vga=788 ---
initrd /debian-installer/amd64/initrd.gz
}
menuentry '... Automated install' {
set background_color=black
linux /debian-installer/amd64/linux desktop=gnome auto=true priority=critical vga=788 --- quiet
initrd /debian-installer/amd64/initrd.gz
}
}
}
submenu '... KDE Plasma desktop boot menu ...' {
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
set gfxpayload=keep
menuentry '... Install' {
set background_color=black
linux /debian-installer/amd64/linux desktop=kde vga=788 --- quiet
initrd /debian-installer/amd64/initrd.gz
}
submenu '... KDE Plasma advanced options ...' {
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
set gfxpayload=keep
menuentry '... Expert install' {
set background_color=black
linux /debian-installer/amd64/linux desktop=kde priority=low vga=788 ---
initrd /debian-installer/amd64/initrd.gz
}
menuentry '... Automated install' {
set background_color=black
linux /debian-installer/amd64/linux desktop=kde auto=true priority=critical vga=788 --- quiet
initrd /debian-installer/amd64/initrd.gz
}
}
}
submenu '... LXDE desktop boot menu ...' {
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
set gfxpayload=keep
menuentry '... Install' {
set background_color=black
linux /debian-installer/amd64/linux desktop=lxde vga=788 --- quiet
initrd /debian-installer/amd64/initrd.gz
}
submenu '... LXDE advanced options ...' {
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
set gfxpayload=keep
menuentry '... Expert install' {
set background_color=black
linux /debian-installer/amd64/linux desktop=lxde priority=low vga=788 ---
initrd /debian-installer/amd64/initrd.gz
}
menuentry '... Automated install' {
set background_color=black
linux /debian-installer/amd64/linux desktop=lxde auto=true priority=critical vga=788 --- quiet
initrd /debian-installer/amd64/initrd.gz
}
}
}
}
}

2
templates/isc-dhcp-server.j2 Executable file
View File

@ -0,0 +1,2 @@
INTERFACESv4={{ listen_interface }}

View File

@ -0,0 +1,97 @@
# Preseed file for automated Debian installation
# Locale settings
d-i debian-installer/locale string en_US.UTF-8
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/xkb-keymap select us
# Network configuration
d-i netcfg/disable_dhcp6 boolean true
d-i netcfg/dhcp6_timeout string 1
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string cosmos-base
d-i netcfg/get_domain string home.cosmos
# Mirror settings
d-i mirror/country string manual
d-i mirror/http/hostname string ftp.us.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string
d-i mirror/codename string trixie
# Account setup
d-i passwd/root-password-crypted password {{ cosmos_root_password | password_hash('sha512') }}
d-i passwd/make-user boolean true
d-i passwd/user-fullname string Cosmos User
d-i passwd/username string cosmos
d-i passwd/user-password-crypted password {{ cosmos_password | password_hash('sha512') }}
# Clock and time zone setup
d-i clock-setup/utc boolean true
d-i time/zone string America/Los_Angeles
d-i clock-setup/ntp boolean true
# Partitioning - Regular working
# This does standard partitioning i.e. not LVM
# d-i partman-auto/method string regular
# Obviously this selects the disk
d-i partman-auto/disk select auto
# /dev/sda
# The atomic recipe creates a very simple partitioning scheme with just a single root partition and swap space.
d-i partman-auto/choose_recipe select atomic
# this top one is the magic one that made the prompt go away; huzzah
# This line tells the installer to finalize the partitioning setup.
# By selecting finish, you indicate that you have completed the partitioning and
# the installer should proceed to format the partitions and continue with the installation.
# It's part of the process to automate the steps without manual confirmation
d-i partman/choose_partition select finish
# This setting automatically confirms the partitioning changes,
# allowing the installer to proceed without asking for user confirmation.
# Setting this to true is important for fully automated installations,
# as it avoids stopping the installation process to ask if you want to write the changes to disk.
d-i partman/confirm boolean true
# This line automatically confirms overwriting existing partitions on the disk.
# By setting this to true, the installer will overwrite any existing data
# on the specified disk without prompting for user confirmation.
# This is useful for fully automated installations where you want to ensure that old data is removed.
d-i partman/confirm_nooverwrite boolean true
# Opt out of the popularity contest survey
popularity-contest popularity-contest/participate boolean false
# Package selection
tasksel tasksel/first multiselect standard, ssh-server
d-i pkgsel/include string openssh-server curl openvpn net-tools htop
d-i pkgsel/upgrade select none
d-i preseed/late_command string \
mkdir -p /target/root/.ssh; \
mkdir -p /target/root/.config/htop; \
mkdir -p /target/etc/openvpn/client; \
mkdir -p /target/opt/cosmos/init; \
in-target echo " * * * * * root /root/update_issue.sh" >> /etc/crontab; \
in-target curl -o /opt/cosmos/cosmos-init.tar -L http://{{ server_ip }}/cosmos-init.tar; \
in-target tar -xf /opt/cosmos/cosmos-init.tar -C /opt/cosmos; \
cp /target/opt/cosmos/init/jenkins_key.pub /target/root/.ssh/authorized_keys; \
cp /target/opt/cosmos/init/update_issue.sh /target/root/update_issue.sh; \
cp /target/opt/cosmos/init/update_issue.service /target/etc/systemd/system/update_issue.service; \
cp /target/opt/cosmos/init/.bashrc /target/root/.bashrc; \
cp /target/opt/cosmos/init/htoprc /target/root/.config/htop/htoprc; \
cp /target/opt/cosmos/init/stat.sh /target/root/stat.sh; \
cp /target/opt/cosmos/init/cosmos-client.ovpn /target/etc/openvpn/client/cosmos-client.conf; \
cp /target/opt/cosmos/init/00-update-issue.conf /target/etc/cron.d/update-issue; \
cp /target/opt/cosmos/init/00-root-allow.conf /target/etc/ssh/sshd_config.d/00-root-allow.conf; \
in-target chmod +x /root/update_issue.sh; \
in-target chmod +x /root/stat.sh; \
in-target systemctl enable update_issue.service; \
in-target systemctl enable openvpn-client@cosmos-client
# Grub installation
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean false
# Reboot after installation
d-i finish-install/reboot_in_progress note
# Shutdown after installation
d-i debian-installer/exit/poweroff boolean true

81
templates/preseed-server.cfg.j2 Executable file
View File

@ -0,0 +1,81 @@
# Preseed file for automated Debian installation
# Locale settings
d-i debian-installer/locale string en_US.UTF-8
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/xkb-keymap select us
# Network configuration
d-i netcfg/disable_dhcp6 boolean true
d-i netcfg/dhcp6_timeout string 1
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string cosmos-base
d-i netcfg/get_domain string home.cosmos
# Mirror settings
d-i mirror/country string manual
d-i mirror/http/hostname string deb.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string
d-i mirror/codename string bookworm
# Account setup
d-i passwd/root-password-crypted password {{ cosmos_root_password | password_hash('sha512') }}
d-i passwd/make-user boolean true
d-i passwd/user-fullname string Cosmos User
d-i passwd/username string cosmos
d-i passwd/user-password-crypted password {{ cosmos_password | password_hash('sha512') }}
# Clock and time zone setup
d-i clock-setup/utc boolean true
d-i time/zone string America/Los_Angeles
d-i clock-setup/ntp boolean true
# Partitioning - Regular working
# This does standard partitioning i.e. not LVM
# d-i partman-auto/method string regular
# Obviously this selects the disk
d-i partman-auto/disk select auto
# /dev/sda
# The atomic recipe creates a very simple partitioning scheme with just a single root partition and swap space.
d-i partman-auto/choose_recipe select atomic
# this top one is the magic one that made the prompt go away; huzzah
# This line tells the installer to finalize the partitioning setup.
# By selecting finish, you indicate that you have completed the partitioning and
# the installer should proceed to format the partitions and continue with the installation.
# It's part of the process to automate the steps without manual confirmation
d-i partman/choose_partition select finish
# This setting automatically confirms the partitioning changes,
# allowing the installer to proceed without asking for user confirmation.
# Setting this to true is important for fully automated installations,
# as it avoids stopping the installation process to ask if you want to write the changes to disk.
d-i partman/confirm boolean true
# This line automatically confirms overwriting existing partitions on the disk.
# By setting this to true, the installer will overwrite any existing data
# on the specified disk without prompting for user confirmation.
# This is useful for fully automated installations where you want to ensure that old data is removed.
d-i partman/confirm_nooverwrite boolean true
# Opt out of the popularity contest survey
popularity-contest popularity-contest/participate boolean false
# Package selection
tasksel tasksel/first multiselect standard, ssh-server
d-i pkgsel/include string openssh-server curl
d-i pkgsel/upgrade select none
# Late command to download and execute a script
d-i preseed/late_command string \
in-target curl -o /root/cosmos-init.sh -L https://pxe:{{ pxe_auth }}@mattifactory.com/dhcp/cosmos-init.sh; \
in-target chmod +x /root/cosmos-init.sh; \
in-target /root/cosmos-init.sh
# Grub installation
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean false
# Reboot after installation
d-i finish-install/reboot_in_progress note
# Shutdown after installation
d-i debian-installer/exit/poweroff boolean true

102
templates/preseed-usb.cfg.j2 Executable file
View File

@ -0,0 +1,102 @@
# Preseed file for automated Debian installation
# Locale settings
d-i debian-installer/locale string en_US.UTF-8
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/xkb-keymap select us
# Clock and time zone setup
d-i clock-setup/utc boolean true
d-i time/zone string America/Los_Angeles
d-i clock-setup/ntp boolean true
# Skip asking to scan additional CDs
d-i apt-setup/cdrom/set-first boolean false
d-i apt-setup/cdrom/set-failed boolean false
d-i apt-setup/cdrom/set-next boolean false
d-i cdrom-detect/eject boolean false
# Network configuration
d-i netcfg/disable_dhcp6 boolean true
d-i netcfg/dhcp6_timeout string 1
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string cosmos-usb
d-i netcfg/get_domain string home.cosmos
# Mirror settings
d-i mirror/country string manual
d-i mirror/http/hostname string deb.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string
d-i mirror/codename string trixie
# Account setup
d-i passwd/root-password-crypted password {{ cosmos_root_password | password_hash('sha512') }}
d-i passwd/make-user boolean true
d-i passwd/user-fullname string Cosmos User
d-i passwd/username string cosmos
d-i passwd/user-password-crypted password {{ cosmos_password | password_hash('sha512') }}
# Partitioning - Regular working
# This does standard partitioning i.e. not LVM
# d-i partman-auto/method string regular
# Obviously this selects the disk
d-i partman-auto/disk select auto
# /dev/sda
# The atomic recipe creates a very simple partitioning scheme with just a single root partition and swap space.
d-i partman-auto/choose_recipe select atomic
# this top one is the magic one that made the prompt go away; huzzah
# This line tells the installer to finalize the partitioning setup.
# By selecting finish, you indicate that you have completed the partitioning and
# the installer should proceed to format the partitions and continue with the installation.
# It's part of the process to automate the steps without manual confirmation
d-i partman/choose_partition select finish
# This setting automatically confirms the partitioning changes,
# allowing the installer to proceed without asking for user confirmation.
# Setting this to true is important for fully automated installations,
# as it avoids stopping the installation process to ask if you want to write the changes to disk.
d-i partman/confirm boolean true
# This line automatically confirms overwriting existing partitions on the disk.
# By setting this to true, the installer will overwrite any existing data
# on the specified disk without prompting for user confirmation.
# This is useful for fully automated installations where you want to ensure that old data is removed.
d-i partman/confirm_nooverwrite boolean true
# Grub installation
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean false
# Opt out of the popularity contest survey
popularity-contest popularity-contest/participate boolean false
# Package selection
tasksel tasksel/first multiselect standard, ssh-server
d-i pkgsel/include string openssh-server curl openvpn net-tools resolvconf htop
d-i pkgsel/upgrade select none
d-i preseed/late_command string \
mkdir -p /target/root/.ssh; \
mkdir -p /target/root/.config/htop; \
mkdir -p /target/etc/openvpn/client; \
mkdir -p /target/opt/cosmos/init; \
cp /cdrom/cosmos/cosmos-init.tar /target/opt/cosmos/cosmos-init.tar; \
in-target tar -xf /opt/cosmos/cosmos-init.tar -C /opt/cosmos; \
cp /target/opt/cosmos/init/jenkins_key.pub /target/root/.ssh/authorized_keys; \
cp /target/opt/cosmos/init/update_issue.sh /target/root/update_issue.sh; \
cp /target/opt/cosmos/init/update_issue.service /target/etc/systemd/system/update_issue.service; \
cp /target/opt/cosmos/init/.bashrc /target/root/.bashrc; \
cp /target/opt/cosmos/init/htoprc /target/root/.config/htop/htoprc; \
cp /target/opt/cosmos/init/stat.sh /target/root/stat.sh; \
cp /target/opt/cosmos/init/cosmos-client.ovpn /target/etc/openvpn/client/cosmos-client.conf; \
cp /target/opt/cosmos/init/00-update-issue.conf /target/etc/cron.d/update-issue; \
cp /target/opt/cosmos/init/00-root-allow.conf /target/etc/ssh/sshd_config.d/00-root-allow.conf; \
in-target chmod +x /root/update_issue.sh; \
in-target chmod +x /root/stat.sh; \
in-target systemctl enable update_issue.service; \
in-target systemctl enable openvpn-client@cosmos-client
# Reboot after installation
d-i finish-install/reboot_in_progress note
# Shutdown after installation
d-i debian-installer/exit/poweroff boolean true

4
templates/tftpd-hpa.j2 Executable file
View File

@ -0,0 +1,4 @@
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/srv/tftp"
TFTP_ADDRESS="{{ server_ip }}:69"
TFTP_OPTIONS="--secure --verbose"