Skip to content

Instantly share code, notes, and snippets.

@dmytro
Created June 21, 2012 06:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmytro/2964138 to your computer and use it in GitHub Desktop.
Save dmytro/2964138 to your computer and use it in GitHub Desktop.
Debian 6.0 with Cobbler
MEDIUM_SUPPORTED = cdrom cdrom-xen netboot netboot-gtk netboot-xen hd-media
MEDIUM_SUPPORTED_EXTRA = monolithic
# The version of the kernel to use.
KERNELVERSION = 2.6.32-5-amd64
KERNELMAJOR = 2.6
KERNEL_FLAVOUR = di
KERNELNAME = vmlinuz
KERNELIMAGEVERSION = $(KERNELVERSION)
# Not used for amd64.
#UPX=upx-ucl-beta
# Default syslinux configuration
SYSLINUX_CFG=standard
# The default video modes
VIDEO_MODE="vga=788"
VIDEO_MODE_GTK="video=vesa:ywrap,mtrr vga=788"
include config/x86.cfg
# The codename of the Debian release that should be installed by default.
DEBIAN_RELEASE = squeeze
# The version (number and codename) of the Debian release targeted by the
# installation images. (Only the codename is used while the version number
# has not yet been determined.)
DEBIAN_VERSION = 6.0 (squeeze)
DEBIAN_VERSION = squeeze
# Define here from what release (codename!) components (udebs) should be taken
# to build debian-installer. By default this is set to 'unstable' for building
# daily images. For official builds this is overruled in debian/rules.
USE_UDEBS_FROM = stable
PRESEED = preseed.cfg
#!/bin/bash -x
dist=$1
arch=$2
vendor=$3
:<<=cut
=head1 NAME
Incorporate Debian preseed.cfg file into initrd image
=head1 USAGE
preseed-initrd <DISTRO>
Distro: Debian6.0.5-x86_64 as given by cobbler distro list
=head1 DESCRIPTION
To be able to clone Debian OS with Cobbler we need to add some
configuration to Debian initrd file - language, keyboard and country
setting is located in preseed file in initrd. This script installs
preseed.cfg file and rebuilds initrd.
Script takes original initrd, creates preseed.cfg file at the top and
gzips it back again.
=cut
usage () { perldoc $0; echo $*; exit ; }
[ -z "$dist" ] && usage "Distro name is required"
initrd=$(cobbler distro report --name=$dist | awk '$0 ~ /^Initrd/ {print $3}')
[ -z "$initrd" ] && { echo "Can not detect initrd path for distro $dist"; exit 2; }
[ -f ${initrd} ] || { usage "${FILE} does not exist"; }
#
# Build initrd
#
build_dir=$(mktemp -d)
(
cd $build_dir
gunzip -c ${initrd} | cpio -i --quiet
cat > preseed.cfg <<EOF
d-i debian-installer/locale string en_US
d-i keyboard-configuration/variant select US
d-i keyboard-configuration/xkb-keymap select us
d-i console-keymaps-at/keymap select us
d-i debian-installer/locale string en_US
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string us
d-i console-setup/charmap string UTF-8
d-i console-setup/codeset string Latin1
d-i console-setup/dont_ask_layout boolean true
netcfg netcfg/use_dhcp boolean true
netcfg netcfg/no_default_route boolean true
netcfg netcfg/get_nameservers string
netcfg netcfg/get_hostname string unallocated-ubuntu
netcfg netcfg/choose_interface select eth0
EOF
find . | cpio --quiet -c -o | gzip -9 > $initrd
)
rm -rf ${build_dir}
echo "Do not forgeet to run 'cobbler sync'"
# vim:ts=8:sw=4:sts=4:et
ide-modules-${kernel:Version}
ide-core-modules-${kernel:Version}
ide-modules-${kernel:Version}
scsi-core-modules-${kernel:Version}
scsi-common-modules-${kernel:Version}
sata-modules-${kernel:Version}
#include "base"
#include "kernel"
# Other udebs that are needed for netboot install
ide-modules-${kernel:Version}
ide-core-modules-${kernel:Version}
ide-modules-${kernel:Version}
scsi-core-modules-${kernel:Version}
scsi-common-modules-${kernel:Version}
sata-modules-${kernel:Version}
hw-detect
localechooser
choose-mirror
net-retriever
download-installer
cdebconf-newt-udeb
cdebconf-newt-terminal ?
cdebconf-text-udeb
installation-locale
di-utils-terminfo
preseed-common
initrd-preseed
network-preseed
file-preseed
nano-udeb
save-logs
libfribidi0-udeb
# Console setting
d-i debian-installer/locale string en_US
d-i keyboard-configuration/variant select US
d-i keyboard-configuration/xkb-keymap select us
d-i console-keymaps-at/keymap select us
d-i debian-installer/locale string en_US
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string us
d-i console-setup/charmap string UTF-8
d-i console-setup/codeset string Latin1
d-i console-setup/dont_ask_layout boolean true
netcfg netcfg/use_dhcp boolean true
netcfg netcfg/no_default_route boolean true
netcfg netcfg/get_nameservers string
netcfg netcfg/get_hostname string unallocated-ubuntu
netcfg netcfg/choose_interface select eth0
@dmytro
Copy link
Author

dmytro commented Jun 22, 2012

Files required for Debian netboot installer fix. To make it work with Cobbler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment