kickseed/0000755000000000000000000000000012276225773007543 5ustar kickseed/cmdline.sh0000644000000000000000000000244212276225750011507 0ustar #! /bin/sh if [ -z "$SPOOL" ]; then SPOOL=/var/spool/kickseed fi # Find the parameter named by $2 in /proc/cmdline (or the test file of your choice). kickseed_cmdline () { for item in $(cat "$1"); do var="${item%%=*}" if [ "$var" = "$2" ]; then echo "${item#*=}" break fi done } # Work out the filename corresponding to a ks parameter. kickseed_file () { if [ -z "$1" ]; then return fi case $1 in cdrom:/*) echo "/cdrom${1#cdrom:}" ;; file:/*) echo "${1#file:}" ;; floppy) echo /floppy/ks.cfg ;; floppy:/*) echo "/floppy${1#floppy:}" ;; ftp://*/*) spoolpath="$SPOOL/fetch/ftp/${1#ftp://}" mkdir -p "${spoolpath%/*}" echo "$spoolpath" ;; hd:*:/*) file="${1#hd:}" device="${file%%:*}" file="${file#*:}" echo "/media/$device$file" ;; http://*/*) spoolpath="$SPOOL/fetch/http/${1#http://}" mkdir -p "${spoolpath%/*}" echo "$spoolpath" ;; https://*/*) spoolpath="$SPOOL/fetch/https/${1#https://}" mkdir -p "${spoolpath%/*}" echo "$spoolpath" ;; nfs:*:/*) file="${1#nfs:}" server="${file%%:*}" file="${file#*:}" spoolpath="$SPOOL/fetch/nfs/$server/$file" mkdir -p "${spoolpath%/*}" echo "$spoolpath" ;; *) logger -t kickseed "Kickstart location $1 not supported" ;; esac } kickseed/debian-installer.d/0000755000000000000000000000000011725373573013202 5ustar kickseed/debian-installer.d/S65kickseed0000644000000000000000000000064611725373572015212 0ustar # TODO: initrd-setup and initrd-kickseed need to run inside the context of # the main menu in order to be usable with the GTK frontend, since otherwise # it starts up an initial X client which exits quickly and causes the X # server to exit. if [ "$DEBIAN_FRONTEND" != gtk ] && \ TERM_UTF8="$TERM_UTF8" TERM_FRAMEBUFFER="$TERM_FRAMEBUFFER" \ /lib/kickseed/initrd-setup; then /lib/kickseed/initrd-kickseed || true fi kickseed/initrd-kickseed0000755000000000000000000000534312276225750012542 0ustar #! /bin/sh -e . /usr/share/debconf/confmodule . /lib/kickseed/kickseed.sh . /lib/kickseed/cmdline.sh . /lib/preseed/preseed.sh ks_log () { logger -t kickseed "$@" } ks_preseed () { echo "$@" >> "$SPOOL/parse/preseed.cfg" } # No support for chrooting here, as /target isn't available yet and %pre # scripts don't need it. ks_run_script () { TYPE="$1" INTERPRETER="$2" SCRIPT="$4" logger -t kickseed "Running $TYPE script $SCRIPT using interpreter $INTERPRETER:" log-output -t kickseed --pass-stdout "$INTERPRETER" "$SCRIPT" } ks_write_script () { if [ "${1%/*}" != "$1" ]; then mkdir -p "${1%/*}" fi cat > "$1" chmod +x "$1" } preseed_fetch () { ln -sf "$1" "$2" } preseed_relative () { if [ -z "${1##/*}" ]; then return 1 else return 0 fi } FETCH_ERROR= fetch_url () { local url="$1" local file="$2" iters=0 while [ $iters -lt 3 ]; do # TODO proxy support? Would it be useful? # TODO add progress bar if FETCH_ERROR="$(wget -q "$url" -O "$file" 2>&1)"; then return 0 fi echo "$FETCH_ERROR" | logger -t kickseed iters=$(($iters + 1)) done return 1 } KS="$(kickseed_cmdline /proc/cmdline ks)" KSCFG="$(kickseed_file "$KS")" case $KS in ftp://*/*|http://*/*|https://*/*) logger -t kickseed "Downloading kickstart file from $KS" if ! fetch_url "$KS" "$KSCFG"; then logger -t kickseed "... failed" db_subst initrd-kickseed/wget-failed URL "$KS" db_subst initrd-kickseed/wget-failed \ ERROR "$FETCH_ERROR" db_input high initrd-kickseed/wget-failed || true db_go exit 1 fi ;; nfs:*:/*) logger -t kickseed "Retrieving kickstart file from $KS" file="${KS#nfs:}" server="${file%%:*}" file="${file#*:}" if ! mount -t nfs -o ro,intr,nolock \ "$server:${file%/*}" "${KSCFG%/*}"; then logger -t kickseed "... failed" db_subst initrd-kickseed/nfs-mount-failed \ DIR "${file%/*}" db_subst initrd-kickseed/nfs-mount-failed \ SERVER "$server" db_input high initrd-kickseed/nfs-mount-failed || true db_go exit 1 fi trap "umount '${KSCFG%/*}' || true" \ EXIT HUP INT QUIT TERM ;; esac case $KSCFG in /floppy/*) mountmedia floppy || true KSCFG="/media/${KSCFG#/floppy/}" trap 'umount /media || true' EXIT HUP INT QUIT TERM ;; /media/*) device="${KSCFG#/media/}" device="${device%%/*}" # TODO: relies on having non-devfs compatibility paths if log-output -t kickseed \ mount "/dev/$device" "/media/$device"; then trap "umount '/media/$device' || true" \ EXIT HUP INT QUIT TERM fi ;; esac case $KSCFG in '') # not handled in initrd (yet?) : ;; *) logger -t kickseed "Reading kickstart file from $KSCFG" kickseed "$KSCFG" if [ -s "$SPOOL/parse/preseed.cfg" ]; then preseed_location "$SPOOL/parse/preseed.cfg" fi ;; esac kickseed/debian/0000755000000000000000000000000012276226037010757 5ustar kickseed/debian/initrd-kickseed.install0000644000000000000000000000027711515540347015424 0ustar debian-installer.d/S65kickseed lib/debian-installer.d initrd-kickseed lib/kickseed initrd-setup lib/kickseed kickseed-anna lib/kickseed kickseed-udpkg lib/kickseed setup/* lib/kickseed/setup kickseed/debian/kickseed-common.install0000644000000000000000000000015311515540347015414 0ustar *.sh lib/kickseed handlers/*.sh lib/kickseed/handlers finish-install.d/01kickseed usr/lib/finish-install.d kickseed/debian/kickseed-common.dirs0000644000000000000000000000002311515540347014703 0ustar var/spool/kickseed kickseed/debian/rules0000755000000000000000000000003611515540347012034 0ustar #! /usr/bin/make -f %: dh $@ kickseed/debian/copyright0000644000000000000000000000206011606014177012704 0ustar The Kickstart-to-preseed translator was written by Colin Watson . Small pieces used for integration with the preseed package were taken from that package, and are copyright 2004 by Joey Hess and others. Copyright (c) 2005, 2006, 2007 Canonical Ltd. kickseed is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. kickseed is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with kickseed; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. A copy of the GNU General Public License is available in /usr/share/common-licenses/GPL. kickseed/debian/source/0000755000000000000000000000000012173334461012254 5ustar kickseed/debian/source/format0000644000000000000000000000001512173334460013462 0ustar 3.0 (native) kickseed/debian/source/lintian-overrides0000644000000000000000000000002512173334460015631 0ustar not-using-po-debconf kickseed/debian/compat0000644000000000000000000000000212173334460012151 0ustar 9 kickseed/debian/control0000644000000000000000000000201712173334514012356 0ustar Source: kickseed Section: debian-installer Priority: optional Maintainer: Ubuntu Installer Team XSBC-Original-Maintainer: Debian Install System Team Uploaders: Colin Watson , Christian Perrier Build-Depends: debhelper (>= 9), dpkg-dev (>= 1.9) XS-Debian-Vcs-Browser: http://anonscm.debian.org/gitweb/?p=d-i/kickseed.git XS-Debian-Vcs-Git: git://anonscm.debian.org/d-i/kickseed.git Vcs-Bzr: http://bazaar.launchpad.net/~ubuntu-core-dev/kickseed/ubuntu Package: kickseed-common Package-Type: udeb Architecture: all Priority: standard Depends: di-utils (>= 1.20) Description: Common files for Kickstart compatibility This package reads Kickstart files and preseeds an installation with them, translating to the d-i preseeding infrastructure. Package: initrd-kickseed Package-Type: udeb Architecture: all Depends: cdebconf-udeb, kickseed-common, preseed-common, di-utils (>= 1.15) Description: Load Kickstart file from the initrd kickseed/debian/changelog0000644000000000000000000005533112276226037012640 0ustar kickseed (0.61ubuntu1) trusty; urgency=medium * Resynchronise with Debian. Remaining changes: - Add basic RAID support. (LVM-on-RAID won't quite work yet.) - Add basic iSCSI support. -- Colin Watson Mon, 10 Feb 2014 19:44:28 +0000 kickseed (0.61) unstable; urgency=medium * Add HTTPS support, which will only work if d-i has been built with GNU wget (LP: #833994). "url https://..." requires further work in at least choose-mirror before it will be usable. -- Colin Watson Mon, 10 Feb 2014 18:59:53 +0000 kickseed (0.60ubuntu1) trusty; urgency=low * Resynchronise with Debian. Remaining changes: - Add basic RAID support. (LVM-on-RAID won't quite work yet.) - Add basic iSCSI support. -- Colin Watson Fri, 08 Nov 2013 12:30:00 +0000 kickseed (0.60) unstable; urgency=low * Preseed netcfg/disable_autoconfig rather than deprecated netcfg/disable_dhcp (LP: #879605). -- Colin Watson Fri, 08 Nov 2013 12:23:31 +0000 kickseed (0.59ubuntu1) saucy; urgency=low * Resynchronise with Debian. Remaining changes: - Add basic RAID support. (LVM-on-RAID won't quite work yet.) - Add basic iSCSI support. -- Colin Watson Tue, 23 Jul 2013 00:00:41 +0100 kickseed (0.59) unstable; urgency=low [ Dmitrijs Ledkovs ] * Set debian source format to '3.0 (native)'. * Bump debhelper compat level to 9. * Set Vcs-* to canonical format. * Drop XC- from Package-Type field. [ Colin Watson ] * Move debian/source.lintian-overrides to preferred location of debian/source/lintian-overrides. [ Christian Perrier ] * Add myself to Uploaders -- Christian Perrier Sun, 14 Jul 2013 13:11:39 +0200 kickseed (0.58ubuntu1) quantal; urgency=low * Resynchronise with Debian. Remaining changes: - Add basic RAID support. (LVM-on-RAID won't quite work yet.) - Add basic iSCSI support. -- Colin Watson Mon, 02 Jul 2012 12:59:00 +0100 kickseed (0.58) unstable; urgency=low * Rebuild for xz udebs. -- Philipp Kern Fri, 22 Jun 2012 23:08:43 +0200 kickseed (0.57ubuntu1) precise; urgency=low * Resynchronise with Debian. Remaining changes: - Add basic RAID support. (LVM-on-RAID won't quite work yet.) - Add basic iSCSI support. -- Colin Watson Tue, 06 Mar 2012 11:40:10 +0000 kickseed (0.57) unstable; urgency=low * Disable kickseed for now when using the GTK frontend, as otherwise it starts up an initial X client which exits quickly and causes the Xserver to exit (LP: #939278). -- Colin Watson Tue, 06 Mar 2012 11:34:27 +0000 kickseed (0.56ubuntu2) oneiric; urgency=low * Fix iSCSI ks_preseed calls to include a type field (LP: #810068). -- Colin Watson Wed, 20 Jul 2011 17:11:06 +0100 kickseed (0.56ubuntu1) oneiric; urgency=low * Resynchronise with Debian. Remaining changes: - Add basic RAID support. (LVM-on-RAID won't quite work yet.) - Add basic iSCSI support. -- Colin Watson Sat, 09 Jul 2011 10:00:30 +0100 kickseed (0.56) unstable; urgency=low * Preseed partman-lvm/confirm_overwrite as well as partman-lvm/confirm. * Preseed partman-lvm/device_remove_lvm when confirming logvol results, since Kickstart doesn't have a separate control with a one-to-one correspondence to this (LP: #708548). * Don't perform an extra layer of backslash interpretation when reading lines from Kickstart files (LP: #715746). Note that this may break some existing Kickstart files that tried to work around the previous behaviour; this seems like the lesser of two evils. * Allow ksdevice=bootif, with netcfg 1.63. -- Colin Watson Fri, 08 Jul 2011 16:02:55 +0100 kickseed (0.55ubuntu1) natty; urgency=low * Resynchronise with Debian. Remaining changes: - Add basic RAID support. (LVM-on-RAID won't quite work yet.) - Add basic iSCSI support. -- Colin Watson Thu, 04 Nov 2010 12:25:06 +0000 kickseed (0.55) unstable; urgency=low * Preseed mirror/country to "manual" instead of "enter information manually"; support for the latter has been dropped (LP: #662931). -- Colin Watson Wed, 03 Nov 2010 23:56:04 +0000 kickseed (0.54ubuntu1) lucid; urgency=low * Resynchronise with Debian. Remaining changes: - Add basic RAID support. (LVM-on-RAID won't quite work yet.) - Add basic iSCSI support. -- Colin Watson Mon, 29 Mar 2010 00:37:53 +0100 kickseed (0.54) unstable; urgency=low * Add Vcs-Svn field. * Add notes about why templates are untranslatable. * Only preseed partman-lvm/confirm if the logvol command was used. * Preseed partman/confirm_nooverwrite as well as partman/confirm. * Be lenient if the Kickstart file author forgets the required space after '@' in a %packages section (LP: #419392). -- Colin Watson Sat, 27 Mar 2010 23:49:22 +0000 kickseed (0.53ubuntu4) lucid; urgency=low * Drop nouveau preseeding, no longer needed with the drm backport in 2.6.32-16 kernels. -- Colin Watson Thu, 11 Mar 2010 14:23:46 +0000 kickseed (0.53ubuntu3) lucid; urgency=low * Preseed base-installer/kernel/backports-modules to 'nouveau' if installing a desktop task, as a partial workaround for problems elsewhere (LP: #526422). * Be lenient if the Kickstart file author forgets the required space after '@' in a %packages section (LP: #419392). -- Colin Watson Fri, 05 Mar 2010 15:03:32 +0000 kickseed (0.53ubuntu2) lucid; urgency=low * Add basic iSCSI support. -- Colin Watson Mon, 14 Dec 2009 13:09:15 +0000 kickseed (0.53ubuntu1) karmic; urgency=low * Add basic RAID support. (LVM-on-RAID won't quite work yet.) -- Colin Watson Wed, 26 Aug 2009 23:37:54 +0100 kickseed (0.53) unstable; urgency=low * Implement 'halt' and 'poweroff'. * Override not-using-po-debconf Lintian tag. All our templates are intentionally untranslatable. * Drop no-standards-version-field override, which Lintian no longer emits for udebs. * Upgrade to debhelper v7. * Implement 'repo', with some Debian extensions to handle the sources.list format. -- Colin Watson Mon, 10 Aug 2009 15:23:12 +0100 kickseed (0.52) unstable; urgency=low [ Colin Watson ] * Fix exit code handling from ks_run_script. -- Christian Perrier Thu, 11 Jun 2009 22:05:24 +0200 kickseed (0.51) unstable; urgency=low * Add initial LVM support (LP: #120377). There are probably still some warts here. * Use new-style "-1" instead of a big number (1024 * 1024 * 1024) to indicate unlimited partition size in partman recipes, following partman-auto 84 and partman-auto-lvm 32. * Use my Ubuntu e-mail address in Uploaders, since I usually work on this on work time. -- Colin Watson Wed, 18 Feb 2009 23:54:50 +0000 kickseed (0.50) unstable; urgency=low * Use new mountmedia command, instead of mountfloppy. * load-floppy renamed to load-media. -- Joey Hess Mon, 07 Jul 2008 14:10:57 -0400 kickseed (0.49) unstable; urgency=low * Adjust 'bootloader --md5pass' for changes in grub-installer 1.31 (LP: #221501). * Use 'sed -i' to change /target/etc/nsswitch.conf (thanks, Christer Edwards). -- Colin Watson Sun, 01 Jun 2008 14:15:11 +0100 kickseed (0.48) unstable; urgency=low [ Colin Watson ] * Allow 'preseed' to take just two arguments, equivalent to an empty value. -- Otavio Salvador Fri, 15 Feb 2008 11:05:25 -0200 kickseed (0.47) unstable; urgency=low * Set Maintainer to debian-boot. * Use in-target to run chrooted %post scripts. * Use /lib/partman/display.d rather than /lib/partman/auto.d. -- Colin Watson Sun, 28 Oct 2007 15:26:48 +0000 kickseed (0.46) unstable; urgency=low * Moved to d-i SVN; maintaining it here henceforth. * Update copyright dates. * Remove Ubuntu-specific hostname in setup/net. * Unbrand an Ubuntu-specific error message. * Remove some old base-config cruft. * The Ubuntu standard tasks are now just called 'standard', and this makes more sense for Debian too. -- Colin Watson Fri, 05 Oct 2007 14:49:18 +0100 kickseed (0.45) gutsy; urgency=low * Make ksdevice=link equivalent to leaving out ksdevice, since that's netcfg's default behaviour. * Make ksdevice=bootif emit a warning and be equivalent to leaving out ksdevice for now. Once netcfg supports being preseeded with a MAC address, this can be supported. * Support 'part swap --recommended' (thanks, Rohit Kumar Mehta). * I'm not sure how swap partition preseeding ever worked, because the filesystem slot in the recipe is supposed to be "linux-swap", not "swap". Fixed. -- Colin Watson Wed, 13 Jun 2007 21:50:01 +0100 kickseed (0.44) feisty; urgency=low * Support --interpreter for %post scripts without --nochroot (pointed out by Jérôme Benois). * Fix broken %post argument parsing. * Run kickseed_post in test-kickseed again; this time, print a notice when a post-installation handler would be run. * Add Lintian override for no-standards-version-field; udebs don't need that. -- Colin Watson Wed, 13 Dec 2006 10:01:36 +0000 kickseed (0.43) feisty; urgency=low * Handle /dev/ prefix on clearpart --drives transparently. * Try to install fs-core-modules and fs-secondary-modules for ext2 and vfat support (udebs renamed in Ubuntu feisty). -- Colin Watson Mon, 4 Dec 2006 09:47:38 +0000 kickseed (0.42) feisty; urgency=low * 'clearpart' preseeds partman-auto/method, needed as of partman-auto 55. * finish-install.d/01kickseed: Provide a ks_log hook. -- Colin Watson Wed, 29 Nov 2006 15:24:27 +0000 kickseed (0.41) edgy; urgency=low * Move from /usr/lib/prebaseconfig.d to /usr/lib/finish-install.d. * Make 'reboot' preseed finish-install/reboot_in_progress as well as prebaseconfig/reboot_in_progress (closes: Malone #65561). -- Colin Watson Wed, 11 Oct 2006 22:30:44 +0100 kickseed (0.40) edgy; urgency=low * Handle Kickstart files with DOS line endings (see Malone #61576). * test-kickseed: Adjust mktemp call to work with busybox. * Make 'clearpart --all' write out a partman auto.d script to clear the first disk, since /dev/discs/disc0/disc isn't available any more and there's no single static alternative (closes: Malone #61576). -- Colin Watson Wed, 4 Oct 2006 20:30:23 +0100 kickseed (0.39) edgy; urgency=low * test-kickseed: Explicitly source kickseed.sh from current directory. * Update keyboard handling for console-setup; note that keymap names have changed from Dapper and earlier, and that layout_variant (e.g. in_guj) keymap names may be used (closes: Malone #61573). -- Colin Watson Fri, 22 Sep 2006 16:20:30 +0100 kickseed (0.38) edgy; urgency=low * Allow Kickstart commands and arguments to be separated by tabs as well as spaces (closes: Malone #49438). -- Colin Watson Wed, 23 Aug 2006 08:47:26 +0100 kickseed (0.37) edgy; urgency=low * Update %packages preseeding for pkgsel 0.07ubuntu1 (revive-tasksel). Issue a warning if exclusions are used, since they are no longer supported. -- Colin Watson Wed, 26 Jul 2006 14:06:02 +0100 kickseed (0.36) edgy; urgency=low * Upload changes from dapper-updates to edgy. -- Colin Watson Mon, 10 Jul 2006 17:22:25 +0100 kickseed (0.35.2) dapper-updates; urgency=low [Colin Watson] * Don't run kickseed_post in test-kickseed. [Scott James Remnant] * Fix passwd/root-login preseeding harder; additional instance of the fix for #48038. -- Scott James Remnant Sun, 11 Jun 2006 17:22:59 +0100 kickseed (0.35.1) dapper-updates; urgency=low * Fix passwd/root-login preseeding (closes: Malone #48038). -- Colin Watson Mon, 5 Jun 2006 02:22:10 +0100 kickseed (0.35) dapper; urgency=low * Preseed passwd/root-login depending on whether the root password is disabled, to cope with user-setup 1.1. -- Colin Watson Mon, 15 May 2006 15:08:53 +0100 kickseed (0.34) dapper; urgency=low * setup/hd: Install disk-detect rather than hw-detect-full. * Adapt %packages handling to pkgsel. -- Colin Watson Thu, 12 Jan 2006 22:50:32 +0000 kickseed (0.33) dapper; urgency=low * Fix %packages handling to account for names in aptitude patterns really being unanchored regular expressions. * Update crypted user and root password handling for passwd 1:4.0.13-5. This is incompatible with older versions of passwd. -- Colin Watson Sun, 11 Dec 2005 10:34:13 +0000 kickseed (0.32) dapper; urgency=low * Use log-output so that log messages go to syslog and are tagged as coming from kickseed. * Simplify prebaseconfig script. * Remove Standards-Version:, not applicable to udebs. -- Colin Watson Thu, 27 Oct 2005 12:44:49 +0100 kickseed (0.31) breezy; urgency=low * Add "Ubuntu Standard" and "Kubuntu Standard" package groups, which install the ubuntu-standard and kubuntu-standard tasks respectively. -- Colin Watson Fri, 7 Oct 2005 16:38:07 +0100 kickseed (0.30) breezy; urgency=low * Fix NFS mount error dialog. -- Colin Watson Mon, 8 Aug 2005 18:29:31 +0100 kickseed (0.29) breezy; urgency=low * Update timezone to be able to cope with clock-setup and tzsetup udebs. * Display an error if we can't fetch the Kickstart file from HTTP/FTP, or if we can't mount the given NFS server. -- Colin Watson Mon, 8 Aug 2005 15:04:13 +0100 kickseed (0.28) breezy; urgency=low * Make 'lang' preseed debian-installer/locale as well as preseed/locale, in order to work with localechooser >= 0.07. -- Colin Watson Tue, 19 Jul 2005 17:23:27 +0100 kickseed (0.27) breezy; urgency=low * Use 'mount -o nolock' when retrieving Kickstart files over NFS, which is massively faster since we aren't running the usual userspace support. -- Colin Watson Mon, 20 Jun 2005 19:05:02 +0100 kickseed (0.26) breezy; urgency=low * Implement device --opts, now that hw-detect supports it. * Implement bootloader --password and --md5pass options. -- Colin Watson Mon, 6 Jun 2005 12:17:24 +0100 kickseed (0.25) breezy; urgency=low * Send stderr from %pre scripts to /var/log/messages. * Don't send %post stdout to /var/log/messages, and don't truncate that file! -- Colin Watson Fri, 6 May 2005 20:39:09 +0100 kickseed (0.24) breezy; urgency=low * Add native support for custom d-i preseeding. The syntax is 'preseed [--owner PACKAGE] KEY TYPE VALUE'. The owner package defaults to "d-i". -- Colin Watson Thu, 5 May 2005 16:42:34 +0100 kickseed (0.23) breezy; urgency=low * Execute %pre sections without redirecting stdin, so that it's possible to use debconf from them. -- Colin Watson Wed, 4 May 2005 17:17:41 +0100 kickseed (0.22) breezy; urgency=low * Make sure %pre and %post scripts are executable, so that debconf can re-exec them. -- Colin Watson Wed, 4 May 2005 10:35:08 +0100 kickseed (0.21) breezy; urgency=low * Make 'url' preseed second-stage mirror configuration too. * Replace $OPTARG with $2 everywhere; fixes 'clearpart --drives'. -- Colin Watson Fri, 15 Apr 2005 15:05:51 +0100 kickseed (0.20) breezy; urgency=low * Send warnings during installation to syslog, not stderr. * Fix handler arguments in the case where no arguments were passed to a command. * Fix langsupport to conform to Kickstart documentation and Anaconda. - If no non-option arguments were passed to langsupport, support all locales, per the Kickstart documentation. Yes, this will be slow. In that case, default to en_US.UTF-8 if there's no default set either, per Anaconda. - Otherwise, default to the first locale selected if there's no default set, per Anaconda. * Tolerate %pre and %post scripts exiting non-zero (log a warning rather than exiting). -- Colin Watson Thu, 14 Apr 2005 12:46:55 +0100 kickseed (0.19) hoary; urgency=low * Very basic package group support, mapping package groups to tasks. Any package group name not containing a space causes the task of the same name to be installed; as special cases, "Ubuntu Desktop" and "Kubuntu Desktop" install the ubuntu-desktop and kubuntu-desktop tasks respectively; any other package group name triggers a warning. -- Colin Watson Sat, 26 Mar 2005 13:50:52 +0000 kickseed (0.18) hoary; urgency=low * Preseed netcfg/wireless_essid_again for noninteractive network setup, required by netcfg 1.08ubuntu3. -- Colin Watson Wed, 23 Mar 2005 14:57:47 +0000 kickseed (0.17) hoary; urgency=low * Make setup/net only set questions if they aren't already flagged seen, to allow booting with something like 'ks=http:/// netcfg/choose_interface=eth1'. -- Colin Watson Tue, 22 Mar 2005 00:03:26 +0000 kickseed (0.16) hoary; urgency=low * Copy chrooted %post scripts to /target before executing them. -- Colin Watson Mon, 21 Mar 2005 17:55:18 +0000 kickseed (0.15) hoary; urgency=low * Make 'xconfig --resolution' preseed xserver-xorg/config/display/modes rather than xserver-xorg/config/monitor/mode-list. * Add NIS authentication support. -- Colin Watson Mon, 21 Mar 2005 16:19:55 +0000 kickseed (0.14) hoary; urgency=low * Preseed all console-keymaps-*/keymap questions, not just at. * Just warn on unrecognised commands, rather than dying. * Separate localechooser/supported-locales elements by ", ", not just " ". -- Colin Watson Thu, 17 Mar 2005 18:47:49 +0000 kickseed (0.13) hoary; urgency=medium * Ignore empty return from kickseed_cmdline, to avoid trying to bring up the CD and the network early when booting without the ks= argument. -- Colin Watson Wed, 2 Mar 2005 20:37:22 +0000 kickseed (0.12) hoary; urgency=low * Fix kbd-chooser/method preseeding. * Use -o intr for NFS mounts. -- Colin Watson Wed, 2 Mar 2005 20:09:53 +0000 kickseed (0.11) hoary; urgency=low * Run depmod before modprobe in /lib/kickseed/setup/hd. * Add support for ks=nfs::/. Requires busybox-cvs 20040623-1ubuntu13 and nfs-modules udebs. -- Colin Watson Tue, 1 Mar 2005 13:45:07 +0000 kickseed (0.10) hoary; urgency=low * Add support for ks=ftp:///. * Implement user --disabled (Ubuntu extension), to disable creating the initial user. * Implement rootpw --disabled (Ubuntu extension), to explicitly disable the root password. -- Colin Watson Mon, 28 Feb 2005 13:18:03 +0000 kickseed (0.9) hoary; urgency=low * Avoid unwanted expansion of $ in e.g. crypted passwords. * Implement user command; I've suggested it to Brent and Tammy Fox at Red Hat, but it's Ubuntu-specific for now. -- Colin Watson Sun, 27 Feb 2005 22:59:43 +0000 kickseed (0.8) hoary; urgency=low * Make partman automatically partition without confirmation when partitions have been defined. * Fix timezone preseeding syntax. * Attempt to handle case where no growing partitions have been defined more gracefully. Changes to partman-auto will be required to do this properly, I think. -- Colin Watson Sun, 27 Feb 2005 21:55:43 +0000 kickseed (0.7) hoary; urgency=low * Extra preseed for new Ubuntu keymap selector. * Implement ksdevice= to set the network interface used by netcfg. * Add support for ks=hd::/ to read a Kickstart file from a vfat or ext2 partition on an arbitrary device (although actually some other filesystems will probably work too). Requires anna 1.06ubuntu5. * Split out /proc/cmdline handling into /lib/kickseed/cmdline.sh. -- Colin Watson Sun, 27 Feb 2005 11:26:18 +0000 kickseed (0.6) hoary; urgency=low * Merge file-kickseed and network-kickseed into initrd-kickseed. If reading a Kickstart file from CD-ROM or the network, install (using anna) and configure (using udpkg) the appropriate udebs first in order to make sure that the requested file is accessible. -- Colin Watson Fri, 25 Feb 2005 20:16:21 +0000 kickseed (0.5) hoary; urgency=low * Add a network-kickseed package to allow downloading Kickstart files from the network (only HTTP so far). * Make packages that use /usr/share/debconf/confmodule depend on cdebconf-udeb. -- Colin Watson Thu, 24 Feb 2005 10:24:54 +0000 kickseed (0.4) hoary; urgency=low * Make zerombr a no-op rather than dying. * Fix clearpart --initlabel. * "Implement" firewall --disabled/--disable. * Implement cdrom (a no-op, assuming that everyone using this will be booting with the cdrom initrd). * Implement clearpart --all, assuming for now that this means just the first disk; getting partman-auto to deal with multiple disks appears to be difficult. I'm not sure if this will work properly with e.g. USB installs. * Add a file-kickseed package to allow loading Kickstart files from CD-ROM or floppy disk. -- Colin Watson Wed, 9 Feb 2005 13:54:00 +0000 kickseed (0.3) hoary; urgency=low * Implement langsupport. * Implement skipx properly (by not starting the display manager). * Implement rootpw --iscrypted. -- Colin Watson Tue, 8 Feb 2005 14:54:06 +0000 kickseed (0.2) hoary; urgency=low * Add Standards-Version: field. * Force debconf priority to critical. * Implement 'timezone', having fixed base-config to make timezone preseeding easier. -- Colin Watson Mon, 7 Feb 2005 16:52:56 +0000 kickseed (0.1) hoary; urgency=low * Initial release. This is still very experimental, doesn't implement all of Kickstart, is probably unable to do a completely automated installation yet, and can only read Kickstart files from the initrd. Nevertheless, it works as far as it goes. -- Colin Watson Fri, 4 Feb 2005 13:47:19 +0000 kickseed/debian/initrd-kickseed.templates0000644000000000000000000000077111515540347015753 0ustar Template: initrd-kickseed/wget-failed Type: error # Note: not translatable, runs before language is chosen Description: Failed to download Kickstart file The Kickstart file at ${URL} could not be downloaded. The error was: . ${ERROR} Template: initrd-kickseed/nfs-mount-failed Type: error # Note: not translatable, runs before language is chosen Description: NFS mount failed An error occurred while mounting the directory ${DIR} from NFS server ${SERVER}. See /var/log/syslog for more information. kickseed/test-kickseed0000755000000000000000000000130311515540347012215 0ustar #! /bin/sh -e HANDLERS=handlers SPOOL="$(mktemp -d /tmp/kickseed.XXXXXX)" SUPPORTEDLOCALES=/usr/share/localechooser/SUPPORTED-short trap 'rm -rf "$SPOOL"' EXIT HUP INT QUIT TERM . ./kickseed.sh ks_log () { echo "LOG: $@" >&2 } ks_preseed () { echo "$@" >> "$SPOOL/parse/test-output" } ks_run_handler () { echo "Would run $1 handler" } ks_run_script () { TYPE="$1" INTERPRETER="$2" CHROOTED="$3" SCRIPT="$4" echo "Would run $TYPE script $SCRIPT using interpreter $INTERPRETER (chrooted: $CHROOTED):" cat "$SCRIPT" echo } ks_write_script () { echo "Would write executable script $1:" cat echo } RET=0 (kickseed "$1") || RET=$? sort "$SPOOL/parse/test-output" kickseed_post exit $RET kickseed/handlers/0000755000000000000000000000000012276225750011336 5ustar kickseed/handlers/cdrom.sh0000644000000000000000000000014411515540347012772 0ustar #! /bin/sh cdrom_handler () { # If a CD-ROM is detected, it will be used automatically. return } kickseed/handlers/pre.sh0000644000000000000000000000055711515540347012464 0ustar #! /bin/sh pre_handler_section () { eval set -- "$(getopt -o '' -l interpreter: -- "$@")" || { warn_getopt %pre; return; } while :; do case $1 in --interpreter) if [ "$2" != /bin/sh ]; then warn "%pre interpreters other than /bin/sh not supported yet" fi shift 2 ;; --) shift; break ;; *) warn_getopt %pre; return ;; esac done } kickseed/handlers/driverdisk.sh0000644000000000000000000000014611515540347014036 0ustar #! /bin/sh driverdisk_handler () { # TODO: --type= warn "driver disks not supported" } kickseed/handlers/repo.sh0000644000000000000000000000300011515540347012625 0ustar #! /bin/sh repo_next_local_id=0 repo_handler () { name= baseurl= distribution= components= enable_source= key= # TODO --mirrorlist= eval set -- "$(getopt -o '' -l name:,baseurl:,distribution:,components:,source,key: -- "$@")" || { warn_getopt repo; return; } while :; do case $1 in --name) name="$2" shift 2 ;; --baseurl) baseurl="$2" shift 2 ;; --distribution) # Debian extension distribution="$2" shift 2 ;; --components) # Debian extension components="$(echo "$2" | sed 's/,/ /g')" shift 2 ;; --source) # Debian extension enable_source=1 shift ;; --key) # Debian extension key="$2" shift 2 ;; --) shift; break ;; *) warn_getopt repo; return ;; esac done if [ -z "$baseurl" ]; then warn "repo command requires --baseurl" return fi if [ "$components" ] && [ -z "$distribution" ]; then warn "repo --components meaningless without --distribution; ignoring --components" fi prefix="apt-setup/local$repo_next_local_id" if [ "$distribution" ]; then ks_preseed d-i "$prefix/repository" string "$baseurl $distribution${components:+ $components}" else ks_preseed d-i "$prefix/repository" string "$baseurl ./" fi if [ "$name" ]; then ks_preseed d-i "$prefix/comment" string "$name" fi if [ "$enable_source" ]; then ks_preseed d-i "$prefix/source" boolean true fi if [ "$key" ]; then ks_preseed d-i "$prefix/key" string "$key" fi repo_next_local_id="$(($repo_next_local_id + 1))" } kickseed/handlers/rootpw.sh0000644000000000000000000000201011515540347013212 0ustar #! /bin/sh rootpw_handler () { setpassword=1 crypted= eval set -- "$(getopt -o '' -l disabled,iscrypted -- "$@")" || { warn_getopt rootpw; return; } while :; do case $1 in --disabled) setpassword= shift ;; --iscrypted) crypted=1 shift ;; --) shift; break ;; *) warn_getopt rootpw; return ;; esac done if [ "$setpassword" ]; then if [ $# -ne 1 ]; then warn "rootpw command requires a password" return fi # requires user-setup 1.1 ks_preseed d-i passwd/root-login boolean true if [ "$crypted" ] && [ "$1" ]; then # requires passwd 1:4.0.13-5 ks_preseed passwd passwd/root-password-crypted password "$1" else # requires passwd 1:4.0.3-30.7ubuntu6 ks_preseed passwd passwd/root-password password "$1" ks_preseed passwd passwd/root-password-again password "$1" if [ -z "$1" ]; then ks_preseed passwd passwd/root-password-empty note '' fi fi else # requires user-setup 1.1 ks_preseed d-i passwd/root-login boolean false set -- '' fi } kickseed/handlers/preseed.sh0000644000000000000000000000065711515540347013326 0ustar #! /bin/sh preseed_handler () { owner=d-i eval set -- "$(getopt -o '' -l owner: -- "$@")" || { warn_getopt preseed; return; } while :; do case $1 in --owner) owner="$2" shift 2 ;; --) shift; break ;; *) warn_getopt preseed; return ;; esac done if [ $# -ne 2 ] && [ $# -ne 3 ]; then warn "preseed command requires key, type, and optional value" return fi ks_preseed "$owner" "$1" "$2" "$3" } kickseed/handlers/zerombr.sh0000644000000000000000000000016611515540347013352 0ustar #! /bin/sh zerombr_handler () { # partman already initialises partition tables when it needs to do # so. return } kickseed/handlers/skipx.sh0000644000000000000000000000022411515540347013023 0ustar #! /bin/sh skipx_handler () { # We generally avoid showing an X configuration interface already, # so just don't start the display manager. : } kickseed/handlers/partition.sh0000644000000000000000000001500611515540347013702 0ustar #! /bin/sh partition_recipe= partition_pending_lvm_recipe= partition_leave_free_space=1 partition_raid= partition_final_done= partition_recipe_append () { if [ -z "$partition_recipe" ]; then partition_recipe='Kickstart-supplied partitioning scheme :' fi partition_recipe="$partition_recipe $1 ." } partition_handler () { recommended= size= grow= maxsize= format=1 asprimary= fstype= ondisk= eval set -- "$(getopt -o '' -l recommended,size:,grow,maxsize:,noformat,onpart:,usepart:,ondisk:,ondrive:,asprimary,fstype:,start:,end: -- "$@")" || { warn_getopt partition; return; } while :; do case $1 in --recommended) # Apparently only used for swap, but # Anaconda doesn't error if you try to use # it for something else, so we won't either. recommended=1 shift ;; --size) size="$2" shift 2 ;; --grow) grow=1 shift ;; --maxsize) maxsize="$2" shift 2 ;; --noformat) format= shift ;; --asprimary) asprimary=1 shift ;; --fstype) fstype="$2" shift 2 ;; --onpart|--usepart|--start|--end) warn "unsupported restriction '$1'" shift 2 ;; --ondisk|--ondrive) ondisk="${2#/dev/}" shift 2 ;; --) shift; break ;; *) warn_getopt partition; return ;; esac done if [ $# -ne 1 ]; then warn "partition command requires a mountpoint" return fi mountpoint="$1" parttype=normal case $mountpoint in swap) filesystem=linux-swap mountpoint= ;; pv.*) # LVM physical volume parttype=lvm pvname="$mountpoint" format= if [ "$fstype" ]; then filesystem="$fstype" else filesystem=ext3 fi mountpoint= ;; raid.*) # RAID physical volume parttype=raid raidname="$mountpoint" format= if [ "$fstype" ]; then filesystem="$fstype" else filesystem=ext3 fi mountpoint= ;; *) if [ "$fstype" ]; then filesystem="$fstype" else filesystem=ext3 fi ;; esac if [ "$parttype" != raid ] && [ "$ondisk" ]; then # TODO: --ondisk/--ondrive supported with LVM too warn "unsupported restriction 'ondisk' for non-RAID" return fi if [ "$parttype" = raid ] && [ -z "$ondisk" ]; then warn "RAID partitioning requires --ondisk" return fi if [ "$filesystem" = linux-swap ] && [ "$recommended" ]; then size=96 priority=512 maxsize=300% partition_leave_free_space= else if [ -z "$size" ]; then warn "partition command requires a size" return fi if [ "$grow" ]; then partition_leave_free_space= if [ -z "$maxsize" ]; then priority=$((1024 * 1024 * 1024)) # requires partman-auto 84, partman-auto-lvm 32 maxsize=-1 else priority="$maxsize" fi else maxsize="$size" priority="$size" fi fi new_recipe="$size $priority $maxsize $filesystem" if [ "$asprimary" ]; then new_recipe="$new_recipe \$primary{ }" fi if [ "$parttype" = lvm ]; then new_recipe="$new_recipe \$defaultignore{ } method{ lvm }" elif [ "$parttype" = raid ]; then new_recipe="$new_recipe \$lvmignore{ } method{ raid } \$raidname{ $raidname }" elif [ "$filesystem" = linux-swap ]; then new_recipe="$new_recipe method{ swap }" elif [ "$format" ]; then new_recipe="$new_recipe method{ format }" else new_recipe="$new_recipe method{ keep }" fi if [ "$format" ]; then new_recipe="$new_recipe format{ }" fi if [ "$parttype" = normal ] && [ "$filesystem" != linux-swap ]; then new_recipe="$new_recipe use_filesystem{ }" new_recipe="$new_recipe filesystem{ $filesystem }" fi if [ "$mountpoint" ]; then new_recipe="$new_recipe mountpoint{ $mountpoint }" fi case $parttype in normal) partition_recipe_append "$new_recipe" ;; lvm) partition_pending_lvm_recipe="$partition_pending_lvm_recipe $new_recipe \$pending_lvm{ $pvname } ." ;; raid) echo "$new_recipe" >>"$SPOOL/parse/partition.raid.$ondisk" partition_recipe_append "$new_recipe \$raid_ondisk{ $ondisk }" partition_raid=1 ;; esac } part_handler () { partition_handler "$@" } partition_final () { # guard so that raid_final can make sure we've been run [ -z "$partition_final_done" ] || return if [ "$partition_raid" ]; then compare= for file in "$SPOOL/parse/partition.raid".*; do [ -f "$file" ] || continue recipe="$(sed 's/ \$raidname{ [^}]* }//' "$file")" raidnames= for raidname in $(sed -n 's/.* \$raidname{ \([^}]*\) }.*/\1/p' "$file"); do raidnames="${raidnames:+$raidnames }$raidname" done if [ "$compare" ]; then if [ "$recipe" != "$compare" ]; then warn "RAID recipes for each disk must be identical: '$recipe' != '$compare'" return fi else compare="$recipe" want_ondisk="${file#$SPOOL/parse/partition.raid.}" primary_raidnames="$raidnames" fi for primary_raidname in $primary_raidnames; do echo "${raidnames%% *}" >>"$SPOOL/parse/partition.raidnames.$primary_raidname" raidnames="${raidnames#* }" done done # leave only one "ondisk" set, but preserve the ordering partition_new_recipe= set -- $partition_recipe got_ondisk= got_raidname= raidid=1 line= rest= while [ "$1" ]; do case $1 in \$raidname{) shift got_raidname="$1" shift ;; \$raid_ondisk{) shift got_ondisk="$1" shift ;; .) if [ -z "$got_ondisk" ] || [ "$want_ondisk" = "$got_ondisk" ]; then if [ "$got_raidname" ]; then line="${line:+$line }raidid{ $raidid }" for raidname in $(cat "$SPOOL/parse/partition.raidnames.$got_raidname"); do echo "$raidid" >>"$SPOOL/parse/partition.raididmap.$raidname" done raidid="$(($raidid + 1))" fi partition_new_recipe="${partition_new_recipe:+$partition_new_recipe }$line ." fi line= got_raidname= got_ondisk= ;; *) line="${line:+$line }$1" ;; esac shift done partition_recipe="$partition_new_recipe" fi if [ "$partition_recipe" ]; then if [ "$partition_leave_free_space" ]; then # This doesn't quite work; it leaves a dummy # partition at the end of the disk. Bug filed on # partman-auto. bignum=$((1024 * 1024 * 1024)) # requires partman-auto 84, partman-auto-lvm 32 partition_recipe="$partition_recipe 0 $bignum -1 free ." fi ks_preseed d-i partman-auto/expert_recipe string \ "$partition_recipe" ks_preseed d-i partman/choose_partition string \ 'Finish partitioning and write changes to disk' ks_preseed d-i partman/confirm boolean true ks_preseed d-i partman/confirm_nooverwrite boolean true fi partition_final_done=1 } register_final partition_final kickseed/handlers/poweroff.sh0000644000000000000000000000016011515540347013513 0ustar #! /bin/sh poweroff_handler () { reboot_handler ks_preseed d-i debian-installer/exit/poweroff boolean true } kickseed/handlers/url.sh0000644000000000000000000000175612276225750012505 0ustar #! /bin/sh url_handler () { eval set -- "$(getopt -o '' -l url: -- "$@")" || { warn_getopt url; return; } while :; do case $1 in --url) ks_preseed d-i mirror/country string manual case $2 in http://*/*) protocol=http ;; https://*/*) protocol=https ;; ftp://*/*) protocol=ftp ;; *) warn "URL type $2 not supported" continue ;; esac ks_preseed d-i mirror/protocol 'select' "$protocol" # Disassemble URL into host and path. host="${2#$protocol://}" path="/${host#*/}" host="${host%%/*}" # Ensure trailing slash. if [ "${path%/}" = "$path" ]; then path="$path/" fi ks_preseed d-i "mirror/$protocol/hostname" string "$host" ks_preseed d-i "mirror/$protocol/directory" string "$path" # TODO: no support for specifying proxy? ks_preseed d-i "mirror/$protocol/proxy" string '' shift 2 ;; --) shift; break ;; *) warn_getopt url; return ;; esac done } kickseed/handlers/auth.sh0000644000000000000000000000337111515540347012634 0ustar #! /bin/sh auth_handler () { # TODO --enableldap, --enableldapauth, --ldapserver=, --ldapbasedn=, # --enableldaptls, --enablekrb5, --krb5realm=, --krb5kdc=, # --krb5adminserver=, --enablehesiod, --hesiodlhs, # --hesiodrhs, --enablesmbauth, --smbservers=, --smbworkgroup= eval set -- "$(getopt -o '' -l enablemd5,enablenis,nisdomain:,nisserver:,useshadow,enableshadow,enablecache -- "$@")" || { warn_getopt auth; return; } while :; do case $1 in --enablemd5) ks_preseed passwd passwd/md5 boolean true shift ;; --enablenis) mkdir -p "$POSTSPOOL/auth.handler" touch "$POSTSPOOL/auth.handler/nis" shift ;; --nisdomain) mkdir -p "$POSTSPOOL/auth.handler" echo "$2" > "$POSTSPOOL/auth.handler/nisdomain" shift 2 ;; --nisserver) mkdir -p "$POSTSPOOL/auth.handler" echo "$2" > "$POSTSPOOL/auth.handler/nisserver" shift 2 ;; --useshadow|--enableshadow) # TODO: this is true by default already ks_preseed passwd passwd/shadow boolean true shift ;; --enablecache) warn "nscd not supported" shift ;; --) shift; break ;; *) warn_getopt auth; return ;; esac done } auth_post () { if [ -f "$POSTSPOOL/auth.handler/nisdomain" ]; then cp "$POSTSPOOL/auth.handler/nisdomain" /target/etc/defaultdomain fi if [ -e "$POSTSPOOL/auth.handler/nis" ]; then sed -i '/^\(passwd\|group\|shadow\):/s/$/ nis/; /^hosts:/s/files/files nis/; /^\(protocols\|services\):/s/$/ nis/' \ /target/etc/nsswitch.conf apt-install nis || true fi # Must come after installing nis, since /etc/yp.conf is a conffile. if [ -f "$POSTSPOOL/auth.handler/nisserver" ]; then nisserver="$(cat "$POSTSPOOL/auth.handler/nisserver")" echo "ypserver $nisserver" >> /target/etc/yp.conf fi } kickseed/handlers/device.sh0000644000000000000000000000101511515540347013123 0ustar #! /bin/sh device_handler () { opts= eval set -- "$(getopt -o '' -l opts: -- "$@")" || { warn_getopt device; return; } while :; do case $1 in --opts) opts="$2" shift 2 ;; --) shift; break ;; *) warn_getopt device; return ;; esac done if [ "$opts" ]; then if [ $# -ne 2 ]; then warn "device command requires type and modulename" return fi # type argument ($1) ignored modulename="$2" # requires hw-detect 1.17 ks_preseed d-i "hw-detect/module_params/$2" string "$opts" fi } kickseed/handlers/text.sh0000644000000000000000000000013711515540347012654 0ustar #! /bin/sh text_handler () { # No graphical installer yet, so this is the default. return } kickseed/handlers/halt.sh0000644000000000000000000000015011515540347012613 0ustar #! /bin/sh halt_handler () { reboot_handler ks_preseed d-i debian-installer/exit/halt boolean true } kickseed/handlers/post.sh0000644000000000000000000000113611515540347012655 0ustar #! /bin/sh post_handler_section () { # Global variables read by kickseed. post_chroot=1 post_interpreter= eval set -- "$(getopt -o '' -l nochroot,interpreter: -- "$@")" || { warn_getopt %post; return; } while :; do case $1 in --nochroot) post_chroot=0 shift ;; --interpreter) post_interpreter="$2" shift 2 ;; --) shift; break ;; *) warn_getopt %post; return ;; esac done if [ "$post_chroot" = 0 ] && [ "$post_interpreter" ] && \ [ "$post_interpreter" != /bin/sh ]; then warn "%post --nochroot interpreters other than /bin/sh not supported yet" fi } kickseed/handlers/mouse.sh0000644000000000000000000000114111515540347013014 0ustar #! /bin/sh mouse_handler () { if [ "$#" -eq 0 ]; then # autodetection is the default return fi eval set -- "$(getopt -o '' -l device:,emulthree -- "$@")" || { warn_getopt mouse; return; } while :; do case $1 in --device) ks_preseed xserver-xorg xserver-xorg/config/inputdevice/mouse/port 'select' "/dev/$2" shift 2 ;; --emulthree) ks_preseed xserver-xorg xserver-xorg/config/inputdevice/mouse/emulate3buttons boolean true shift ;; --) shift; break ;; *) warn_getopt mouse; return ;; esac done # TODO: translate protocol into xserver-xorg's naming scheme } kickseed/handlers/network.sh0000644000000000000000000000276312237154455013373 0ustar #! /bin/sh network_handler () { got_ipaddress= got_gateway= got_nameservers= got_netmask= eval set -- "$(getopt -o '' -l bootproto:,device:,ip:,gateway:,nameserver:,nodns,netmask:,hostname: -- "$@")" || { warn_getopt network; return; } while :; do case $1 in --bootproto) case $2 in dhcp|bootp) ;; static) ks_preseed d-i netcfg/disable_autoconfig boolean true ;; *) warn_bad_arg network bootproto "$2" ;; esac shift 2 ;; --device) ks_preseed d-i netcfg/choose_interface 'select' "$2" shift 2 ;; --ip) ks_preseed d-i netcfg/get_ipaddress string "$2" got_ipaddress=1 shift 2 ;; --gateway) ks_preseed d-i netcfg/get_gateway string "$2" got_gateway=1 shift 2 ;; --nameserver) ks_preseed d-i netcfg/get_nameservers string "$2" got_nameservers=1 shift 2 ;; --nodns) ks_preseed d-i netcfg/get_nameservers string '' got_nameservers=1 shift ;; --netmask) ks_preseed d-i netcfg/get_netmask string "$2" got_netmask=1 shift 2 ;; --hostname) ks_preseed d-i netcfg/get_hostname string "$2" shift 2 ;; --) shift; break ;; *) warn_getopt network; return ;; esac done # If all the information displayed on the netcfg/confirm_static # screen was preseeded, skip it. if [ "$got_ipaddress" ] && [ "$got_netmask" ] && \ [ "$got_gateway" ] && [ "$got_nameservers" ]; then ks_preseed d-i netcfg/confirm_static boolean true fi } kickseed/handlers/timezone.sh0000644000000000000000000000110311515540347013514 0ustar #! /bin/sh timezone_handler () { utc= eval set -- "$(getopt -o '' -l utc -- "$@")" || { warn_getopt timezone; return; } while :; do case $1 in --utc) utc=1 shift ;; --) shift; break ;; *) warn_getopt timezone; return ;; esac done if [ $# -ne 1 ]; then warn "timezone command requires a timezone" return fi if [ "$utc" ]; then # requires clock-setup ks_preseed d-i clock-setup/utc boolean true else # requires clock-setup ks_preseed d-i clock-setup/utc boolean false fi # requires tzsetup ks_preseed d-i time/zone string "$1" } kickseed/handlers/autostep.sh0000644000000000000000000000011311515540347013526 0ustar #! /bin/sh autostep_handler () { warn "autostep makes no sense in d-i" } kickseed/handlers/interactive.sh0000644000000000000000000000020711515540347014203 0ustar #! /bin/sh interactive_handler () { # requires di-utils 1.09, preseed-common 1.03 ks_preseed d-i preseed/interactive boolean true } kickseed/handlers/lang.sh0000644000000000000000000000044711515540347012615 0ustar #! /bin/sh # used in langsupport consistency check lang_value= lang_handler () { lang_value="$1" # for localechooser << 0.07; harmless otherwise ks_preseed d-i preseed/locale string "$1" # for localechooser >= 0.07; harmless otherwise ks_preseed d-i debian-installer/locale string "$1" } kickseed/handlers/xconfig.sh0000644000000000000000000000354711515540347013335 0ustar #! /bin/sh xconfig_handler () { eval set -- "$(getopt -o '' -l noprobe,card:,videoram:,monitor:,hsync:,vsync:,defaultdesktop:,startxonboot,resolution:,depth: -- "$@")" || { warn_getopt xconfig; return; } while :; do case $1 in --noprobe) # TODO: xresprobe code doesn't honour this ks_preseed xserver-xorg xserver-xorg/autodetect_monitor boolean false shift ;; --card) # TODO: translate card name ks_preseed xserver-xorg xserver-xorg/config/device/driver 'select' "$2" shift 2 ;; --videoram) ks_preseed xserver-xorg xserver-xorg/config/device/video_ram string "$2" shift 2 ;; --monitor) # TODO: no monitor database; we could # preseed the identifier but there's little # point warn_bad_opt xconfig monitor shift 2 ;; --hsync) ks_preseed xserver-xorg xserver-xorg/config/monitor/horiz-sync string "$2" shift 2 ;; --vsync) ks_preseed xserver-xorg xserver-xorg/config/monitor/vert-refresh string "$2" shift 2 ;; --defaultdesktop) if [ "$2" = GNOME ]; then : # Ubuntu default else warn_bad_arg xconfig defaultdesktop "$2" fi shift 2 ;; --startxonboot) # TODO: this is true by default already shift ;; --resolution) case $2 in 640x480) modes='640x480' ;; 800x600) modes='800x600, 640x480' ;; 1024x768) modes='1024x768, 800x600, 640x480' ;; *) modes="$2, 1024x768, 800x600, 640x480" ;; esac ks_preseed xserver-xorg xserver-xorg/config/display/modes multiselect "$modes" shift 2 ;; --depth) if [ "$2" = 32 ]; then depth=24 else depth="$2" fi ks_preseed xserver-xorg xserver-xorg/config/display/default_depth 'select' "$depth" shift 2 ;; --) shift; break ;; *) warn_getopt xconfig; return ;; esac done } kickseed/handlers/install.sh0000644000000000000000000000014411515540347013334 0ustar #! /bin/sh install_handler () { # d-i doesn't support upgrades, so this is the default. return } kickseed/handlers/user.sh0000644000000000000000000000210711515540347012645 0ustar #! /bin/sh user_handler () { makeuser=1 crypted= password= eval set -- "$(getopt -o '' -l disabled,fullname:,iscrypted,password: -- "$@")" || { warn_getopt user; return; } while :; do case $1 in --disabled) makeuser= shift ;; --fullname) ks_preseed passwd passwd/user-fullname string "$2" shift 2 ;; --iscrypted) crypted=1 shift ;; --password) password="$2" shift 2 ;; --) shift; break ;; *) warn_getopt user; return ;; esac done if [ "$makeuser" ]; then if [ $# -ne 1 ]; then warn "user command requires a username" return fi ks_preseed passwd passwd/make-user boolean true ks_preseed passwd passwd/username string "$1" if [ "$password" ]; then if [ "$crypted" ]; then # requires passwd >= 1:4.0.13-5 ks_preseed passwd passwd/user-password-crypted password "$password" else ks_preseed passwd passwd/user-password password "$password" ks_preseed passwd passwd/user-password-again password "$password" fi fi else ks_preseed passwd passwd/make-user boolean false fi } kickseed/handlers/upgrade.sh0000644000000000000000000000012211515540347013311 0ustar #! /bin/sh upgrade_handler () { warn "upgrades using installer not supported" } kickseed/handlers/deviceprobe.sh0000644000000000000000000000013111515540347014151 0ustar #! /bin/sh deviceprobe_handler () { # Already the default thanks to hotplug. return } kickseed/handlers/logvol.sh0000644000000000000000000000557311606014177013201 0ustar #! /bin/sh logvol_confirm= logvol_handler () { vgname= recommended= size= grow= maxsize= name= format=1 fstype= # TODO --percent=, --bytes-per-inode=, --fsoptions= eval set -- "$(getopt -o '' -l vgname:,recommended,size:,grow,maxsize:,name:,noformat,fstype: -- "$@")" || { warn_getopt logvol; return; } while :; do case $1 in --vgname) vgname="$2" shift 2 ;; --recommended) # Apparently only used for swap, but # Anaconda doesn't error if you try to use # it for something else, so we won't either. recommended=1 shift ;; --size) size="$2" shift 2 ;; --grow) grow=1 shift ;; --maxsize) maxsize="$2" shift 2 ;; --name) name="$2" shift 2 ;; --noformat) format= shift ;; --fstype) fstype="$2" shift 2 ;; --) shift; break ;; *) warn_getopt logvol; return ;; esac done if [ $# -ne 1 ]; then warn "logvol command requires a mountpoint" return fi mountpoint="$1" if [ -z "$vgname" ]; then warn "logvol command requires a vgname" return fi # TODO check volume group exists? if [ -z "$name" ]; then warn "logvol command requires a name" return fi case $mountpoint in swap) filesystem=linux-swap mountpoint= ;; *) if [ "$fstype" ]; then filesystem="$fstype" else filesystem=ext3 fi ;; esac # TODO: clone-and-hack from partition_handler if [ "$filesystem" = linux-swap ] && [ "$recommended" ]; then size=96 priority=512 maxsize=300% partition_leave_free_space= else if [ -z "$size" ]; then warn "logvol command requires a size" return fi if [ "$grow" ]; then partition_leave_free_space= if [ -z "$maxsize" ]; then priority=$((1024 * 1024 * 1024)) # requires partman-auto 84, partman-auto-lvm 32 maxsize=-1 else priority="$maxsize" fi else maxsize="$size" priority="$size" fi fi new_recipe="$size $priority $maxsize $filesystem" new_recipe="$new_recipe \$lvmok{ } in_vg{ $vgname } lv_name{ $name }" if [ "$filesystem" = linux-swap ]; then new_recipe="$new_recipe method{ swap }" elif [ "$format" ]; then new_recipe="$new_recipe method{ format }" else new_recipe="$new_recipe method{ keep }" fi if [ "$format" ]; then new_recipe="$new_recipe format{ }" fi if [ "$filesystem" != linux-swap ]; then new_recipe="$new_recipe use_filesystem{ }" new_recipe="$new_recipe filesystem{ $filesystem }" fi if [ "$mountpoint" ]; then new_recipe="$new_recipe mountpoint{ $mountpoint }" fi partition_recipe_append "$new_recipe" [ "$clearpart_method" ] || clearpart_method=lvm logvol_confirm=1 } logvol_final () { if [ "$logvol_confirm" ]; then ks_preseed d-i partman-lvm/device_remove_lvm boolean true ks_preseed d-i partman-lvm/confirm boolean true ks_preseed d-i partman-lvm/confirm_nooverwrite boolean true fi } register_final logvol_final kickseed/handlers/clearpart.sh0000644000000000000000000000375411515540347013655 0ustar #! /bin/sh clearpart_method= clearpart_need_method= clearpart_handler () { eval set -- "$(getopt -o '' -l linux,all,drives:,initlabel -- "$@")" || { warn_getopt clearpart; return; } while :; do case $1 in --linux) warn "clearing all Linux partitions not supported yet" shift ;; --all) ks_log "can't clear multiple drives; assuming just the first one" clearpart_need_method=1 # TODO: I bet this isn't safe for installs # from USB ... ks_preseed d-i partman-auto/disk string /dev/discs/disc0/disc # The above breaks when udev is configured # to avoid devfs-style device names, so we # have to write out a partman hook on the # fly to handle this properly if the tools # are available. ks_write_script /lib/partman/display.d/01kickseed <<'EOF' #! /bin/sh set -e # Generated by kickseed for 'clearpart --all'. . /usr/share/debconf/confmodule # Only run the first time. if [ -f /var/lib/partman/initial_auto ]; then exit 0 fi if type list-devices >/dev/null 2>&1; then FIRSTDISK="$(list-devices disk | head -n1)" logger -t kickseed "Clearing first disk ($FIRSTDISK) for Kickstart 'clearpart --all'" db_set partman-auto/disk "$FIRSTDISK" fi exit 0 EOF shift ;; --drives) case $2 in *,*) warn "clearing multiple drives not supported" ;; *) clearpart_need_method=1 disk="$2" case $disk in /dev/*) ;; *) disk="/dev/$disk" ;; esac ks_preseed d-i partman-auto/disk string "$disk" ;; esac shift 2 ;; --initlabel) ks_preseed d-i partman/confirm_write_new_label boolean true shift ;; --) shift; break ;; *) warn_getopt clearpart; return ;; esac done } clearpart_final () { if [ "$clearpart_need_method" ]; then if [ -z "$clearpart_method" ]; then clearpart_method=regular fi # needed as of partman-auto 55 ks_preseed d-i partman-auto/method string "$clearpart_method" fi } register_final clearpart_final kickseed/handlers/reboot.sh0000644000000000000000000000022511515540347013160 0ustar #! /bin/sh reboot_handler () { ks_preseed d-i prebaseconfig/reboot_in_progress note '' ks_preseed d-i finish-install/reboot_in_progress note '' } kickseed/handlers/raid.sh0000644000000000000000000000561311515540347012613 0ustar #! /bin/sh raid_recipe= raid_current_device=0 raid_recipe_append () { raid_recipe="${raid_recipe:+$raid_recipe }$1 ." } raid_handler () { level= device= spares=0 fstype= # TODO --bytes-per-inode=, --fsoptions=, --noformat, --useexisting eval set -- "$(getopt -o '' -l level:,device:,spares:fstype: -- "$@")" || { warn_getopt raid; return; } while :; do case $1 in --level) level="$2" shift 2 ;; --device) device="$2" shift 2 ;; --spares) spares="$2" shift 2 ;; --fstype) fstype="$2" shift 2 ;; --) shift; break ;; *) warn_getopt raid; return ;; esac done if [ -z "$level" ]; then warn "raid command requires a level" return fi if [ -z "$device" ]; then warn "raid command requires a device" return fi if [ $# -lt 2 ]; then warn "raid comment requires mountpoint and partition(s)" return fi # TODO support out-of-order if [ "$device" != "md$raid_current_device" ]; then warn "raid devices specified out of order; expecting md$raid_current_device" return fi raid_current_device="$(($raid_current_device + 1))" mountpoint="$1" shift raid_recipe_append "$level $# $spares $mountpoint $*" } raid_final () { if [ "$raid_recipe" ]; then partition_final devs= raid_new_recipe= set -- $raid_recipe while [ "$1" ]; do dev_count="$2" spare_count="$3" raid_new_recipe="${raid_new_recipe:+$raid_new_recipe }$1 $2 $3 $4" shift 4 raidids= while [ "$1" ] && [ "$1" != . ] && [ "$dev_count" -gt "$spare_count" ]; do if [ -e "$SPOOL/parse/partition.raididmap.$1" ]; then raidids="${raidids:+$raidids$NL}$(cat "$SPOOL/parse/partition.raididmap.$1")" else warn "no partition command issued for $1" return fi dev_count="$(($dev_count - 1))" shift done active_devs= for raidid in $(echo "$raidids" | sort -u); do active_devs="${active_devs:+$active_devs#}raidid=$raidid" done if [ "$active_devs" ]; then raid_new_recipe="${raid_new_recipe:+$raid_new_recipe }$active_devs" fi raidids= while [ "$1" ] && [ "$1" != . ] && [ "$dev_count" -gt 0 ]; do if [ -e "$SPOOL/parse/partition.raididmap.$1" ]; then raidids="${raidids:+$raidids$NL}$(cat "$SPOOL/parse/partition.raididmap.$1")" else warn "no partition command issued for $1" return fi dev_count="$(($dev_count - 1))" shift done spare_devs= for raidid in $(echo "$raidids" | sort -u); do spare_devs="${spare_devs:+$spare_devs#}raidid=$raidid" done if [ "$spare_devs" ]; then raid_new_recipe="${raid_new_recipe:+$raid_new_recipe }$spare_devs" fi while [ "$1" ] && [ "$1" != . ]; do shift done raid_new_recipe="${raid_new_recipe:+$raid_new_recipe }." shift done raid_recipe="$raid_new_recipe" ks_preseed d-i partman-auto/method string raid ks_preseed d-i partman-auto-raid/recipe "$raid_recipe" fi } register_final raid_final kickseed/handlers/lilocheck.sh0000644000000000000000000000010511515540347013620 0ustar #! /bin/sh lilocheck_handler () { warn "lilocheck not supported" } kickseed/handlers/langsupport.sh0000644000000000000000000000312211515540347014243 0ustar #! /bin/sh langsupport_default= langsupport_handler () { eval set -- "$(getopt -o '' -l default: -- "$@")" || { warn_getopt langsupport; return; } while :; do case $1 in --default) langsupport_default="$2" shift 2 ;; --) shift; break ;; *) warn_getopt langsupport; return ;; esac done if [ $# -eq 0 ]; then # Support all locales (per the Red Hat Kickstart # documentation). Yes, this will be slow. languages= for l in $(grep -v '\.UTF-8@euro$' "$SUPPORTEDLOCALES"); do languages="${languages:+$languages, }$l" done # Per Anaconda, default to en_US.UTF-8 if there's no default # set. if [ -z "$langsupport_default" ]; then langsupport_default=en_US.UTF-8 fi else languages="$(echo "$*" | sed 's/ /, /g')" # If there's a default, support that too; otherwise, the # first locale selected is the default. # (According to the Red Hat Kickstart documentation, it's an # error not to specify a default when asking for support for # more than one locale; however, Anaconda just picks the # first one, so we'll go with that.) if [ "$langsupport_default" ]; then languages="$langsupport_default, $languages" else langsupport_default="$1" fi fi # requires localechooser 0.06 ks_preseed d-i localechooser/supported-locales multiselect "$languages" } langsupport_final () { # TODO: no support for different installation and installed languages if [ "$lang_value" ] && [ "$langsupport_default" ] && \ [ "$lang_value" != "$langsupport_default" ]; then warn "langsupport --default must equal lang" fi } register_final langsupport_final kickseed/handlers/bootloader.sh0000644000000000000000000000252111515540347014021 0ustar #! /bin/sh bootloader_handler_common () { useLilo="$1" shift # TODO --linear, --nolinear, --lba32 eval set -- "$(getopt -o '' -l location:,password:,md5pass:,useLilo,upgrade -- "$@")" || { warn_getopt bootloader; return; } while :; do case $1 in --location) case $2 in mbr) # TODO: not always hd0; lilo ks_preseed d-i grub-installer/bootdev string '(hd0)' ;; partition) # TODO: lilo ks_preseed d-i grub-installer/bootdev string '(hd0,1)' ;; none) # TODO: need lilo-installer/skip too ks_preseed d-i grub-installer/skip boolean true ;; *) warn_bad_arg bootloader location "$2" ;; esac shift 2 ;; --password) # requires grub-installer 1.09 ks_preseed d-i grub-installer/password password "$2" shift 2 ;; --md5pass) # requires grub-installer 1.31 ks_preseed d-i grub-installer/password-crypted password "$2" shift 2 ;; --useLilo) useLilo=1 shift ;; --upgrade) warn "upgrades using installer not supported" ;; --) shift; break ;; *) warn_getopt bootloader; return ;; esac done if [ "$useLilo" = 1 ]; then ks_preseed d-i grub-installer/skip boolean true fi } bootloader_handler () { bootloader_handler_common 0 "$@" } lilo_handler () { bootloader_handler_common 1 "$@" } kickseed/handlers/iscsi.sh0000644000000000000000000000337511611575072013011 0ustar #! /bin/sh iscsi_handler () { ipaddr= port= user= password= reverse_user= reverse_password= eval set -- "$(getopt -o '' -l ipaddr:,target:,port:,user:,password:,reverse-user:,reverse-password: -- "$@")" || { warn_getopt iscsi; return; } while :; do case $1 in --ipaddr) ipaddr="$2" shift 2 ;; --target) # TODO: this doesn't appear to do anything # in Anaconda? shift 2 ;; --port) port="$2" shift 2 ;; --user) user="$2" shift 2 ;; --password) password="$2" shift 2 ;; --reverse-user) reverse_user="$2" shift 2 ;; --reverse-password) reverse_password="$2" shift 2 ;; --) shift; break ;; *) warn_getopt iscsi; return ;; esac done bad_options= if [ -z "$ipaddr" ]; then warn "iscsi command requires --ipaddr" bad_options=1 fi if [ "$user" ]; then if [ -z "$password" ]; then warn "iscsi --user requires --password as well" bad_options=1 fi fi if [ "$reverse_user" ]; then if [ -z "$reverse_password" ]; then warn "iscsi --reverse-user requires --reverse-password as well" bad_options=1 fi if [ -z "$user" ]; then warn "iscsi --reverse-user requires --user as well" bad_options=1 fi fi if [ "$bad_options" ]; then return fi ks_preseed d-i partman-iscsi/login/address string "$ipaddr${port:+:$port}" if [ "$user" ]; then ks_preseed d-i partman-iscsi/login/username string "$user" ks_preseed d-i partman-iscsi/login/password password "$password" if [ "$reverse_user" ]; then ks_preseed d-i partman-iscsi/login/incoming_username string "$reverse_user" ks_preseed d-i partman-iscsi/login/incoming_password password "$reverse_password" fi fi ks_preseed d-i partman-iscsi/login/all_targets boolean true } kickseed/handlers/volgroup.sh0000644000000000000000000000201211515540347013537 0ustar #! /bin/sh volgroup_pull_recipe () { vgname="$1" want_pvname="$2" shift 2 got_pvname= line= rest= while [ "$1" ]; do case $1 in \$pending_lvm{) shift got_pvname="$1" shift ;; .) if [ "$want_pvname" = "$got_pvname" ]; then partition_recipe_append "$line vg_name{ $vgname }" else rest="${rest:+$rest }$line ." fi line= ;; *) line="${line:+$line }$1" ;; esac shift done partition_pending_lvm_recipe="$rest" } volgroup_handler () { existing= eval set -- "$(getopt -o '' -l noformat,useexisting,pesize: -- "$@")" || { warn_getopt volgroup; return; } while :; do case $1 in --noformat|--useexisting) existing=1 # TODO? ;; --pesize) warn "only default PE size supported" shift 2 ;; --) shift; break ;; *) warn_getopt volgroup; return ;; esac done if [ $# -ne 2 ]; then warn "volgroup command requires volume group name and partition" return fi volgroup_pull_recipe "$1" "$2" $partition_pending_lvm_recipe } kickseed/handlers/firewall.sh0000644000000000000000000000131111515540347013470 0ustar #! /bin/sh firewall_handler () { eval set -- "$(getopt -o '' -l high,medium,enabled,enable,disabled,disable,trust:,dhcp,ssh,telnet,smtp,http,ftp,port: -- "$@")" || { warn_getopt firewall; return; } while :; do case $1 in --high|--medium|--enabled|--enable|--dhcp|--ssh|--telnet|--smtp|--http|--ftp) # TODO: Anaconda uses lokkit; what should we # do? warn "firewall preseeding not supported yet" shift ;; --trust|--port) # TODO: Anaconda uses lokkit; what should we # do? warn "firewall preseeding not supported yet" shift 2 ;; --disabled|--disable) # do nothing shift ;; --) shift; break ;; *) warn_getopt firewall; return ;; esac done } kickseed/handlers/keyboard.sh0000644000000000000000000000105511515540347013470 0ustar #! /bin/sh keyboard_handler () { # Specific to Ubuntu keymap selector, but harmless elsewhere. ks_preseed d-i kbd-chooser/method 'select' \ 'Select from full keyboard list' for kbarch in acorn amiga at atari dec mac sun usb; do ks_preseed d-i "console-keymaps-$kbarch/keymap" 'select' "$1" done # requires console-setup; keymap names often incompatible with old # kbd-chooser preseeding ks_preseed d-i console-setup/layoutcode string "${1%%_*}" if [ "${1#*_}" != "$1" ]; then ks_preseed d-i console-setup/variantcode string "${1#*_}" fi } kickseed/initrd-setup0000755000000000000000000000140312276225750012111 0ustar #! /bin/sh -e . /lib/kickseed/cmdline.sh # Run a debconf-using program, possibly inside bterm. # Cloned-and-hacked from /lib/debian-installer.d/S70menu-linux. bterm_run () { bterm=/usr/bin/bterm font=/unifont.bgf if [ -x "$bterm" ] && [ -e "$font" ] && \ [ "$TERM_UTF8" ] && [ "$TERM_FRAMEBUFFER" ]; then TERM=bterm MENU="$1" \ $bterm -f $font -l $LANG /lib/debian-installer/menu else MENU="$1" /lib/debian-installer/menu fi } KS="$(kickseed_cmdline /proc/cmdline ks)" case $KS in cdrom:/*) bterm_run /lib/kickseed/setup/cdrom || true ;; ftp://*/*|http://*/*|https://*/*) bterm_run /lib/kickseed/setup/net || true ;; hd:*:/*) bterm_run /lib/kickseed/setup/hd || true ;; nfs:*:/*) bterm_run /lib/kickseed/setup/nfs || true ;; esac kickseed/tests/0000755000000000000000000000000011606014177010673 5ustar kickseed/tests/simple.ks0000644000000000000000000000330411606014177012523 0ustar lang en_GB langsupport --default=en_US de_DE xh_ZA keyboard uk autostep auth --enablemd5 --enableshadow --enablenis bootloader --location=mbr device eth module1 --opts="aic152x=0x340 io=11" device scsi module2 --opts="testopts=testvalue" firewall --disabled interactive lilo %include tests/included.ks mouse --device=ttyS0 --emulthree msintellips/2 network --bootproto=static --ip=10.0.2.15 --netmask=255.255.255.0 --gateway=10.0.2.254 --nameserver=10.0.2.1 part / --size=1024 --grow --maxsize=2048 --asprimary --fstype xfs partition swap --size=512 --maxsize=1024 rootpw rootme timezone --utc America/New_York url --url http://archive.ubuntu.com/ubuntu repo --name test --baseurl http://mirror/ubuntu --distribution local --components=main,restricted --source --key=http://mirror/ubuntu/project/key repo --name "another test" --baseurl http://mirror/other --key=http://mirror/ubuntu/project/key2 user cjwatson --fullname="Colin Watson" --password="foobar" xconfig --resolution 1280x1024 preseed test/question1 string hello preseed --owner base-config test/question2 boolean true preseed apt-setup/security_host string "" %packages @ Ubuntu Desktop openssh-server -man-db %pre #! /bin/sh echo "This is a %pre script." echo "It does nothing very interesting." %post --nochroot --interpreter /bin/dash #! /bin/sh echo "This is a %post script." echo "It does nothing very interesting, outside a chroot." echo "A warning should be printed for the attempt to use dash." %post --interpreter=/bin/bash #! /bin/bash echo "This is a %post script." echo "It does nothing very interesting, in a chroot." # test backslash interpretation sed -i -e "s/^\s*#*\s*\(account\s*required\s*pam_access\.so.*\)/\1/" /etc/pam.d/login /etc/pam.d/sshd kickseed/tests/swap-recommended.ks0000644000000000000000000000013111515540347014461 0ustar clearpart --all --initlabel part swap --recommended part / --fstype ext3 --size 1 --grow kickseed/tests/iscsi.ks0000644000000000000000000000016611311433527012344 0ustar iscsi --ipaddr 127.0.0.1 --user inuser --password inpass123456 --reverse-user outuser --reverse-password outpass12345 kickseed/tests/included.ks0000644000000000000000000000003011515540347013014 0ustar xconfig --videoram=1024 kickseed/tests/raid.ks0000644000000000000000000000055611245230762012156 0ustar part raid.01 --size=60 --ondisk=sda part raid.02 --size=60 --ondisk=sdb part raid.03 --size=60 --ondisk=sdc part swap --size=128 part raid.11 --size=1 --grow --ondisk=sda part raid.12 --size=1 --grow --ondisk=sdb part raid.13 --size=1 --grow --ondisk=sdc raid / --level=1 --device=md0 raid.01 raid.02 raid.03 raid /usr --level=5 --device=md1 raid.11 raid.12 raid.13 kickseed/tests/noroot.ks0000644000000000000000000000015311515540347012553 0ustar rootpw --disabled user joe --fullname "Joe User" --iscrypted --password $1$abcd1234$8wJHFFdFZv63I/QAFMxno1 kickseed/tests/lvm.ks0000644000000000000000000000015511515540347012033 0ustar clearpart --all part pv.01 --size 3000 volgroup myvg pv.01 logvol / --vgname=myvg --size=2000 --name=rootvol kickseed/tests/cryptedroot.ks0000644000000000000000000000006611515540347013614 0ustar rootpw --iscrypted $1$HE4C5mKO$3pVzO34Wz/TJGL0s69rkS0 kickseed/kickseed.sh0000644000000000000000000001652111606014177011654 0ustar #! /bin/sh # Caller should set -e. if [ -z "$HANDLERS" ]; then HANDLERS=/lib/kickseed/handlers fi if [ -z "$SPOOL" ]; then SPOOL=/var/spool/kickseed fi if [ -z "$POSTSPOOL" ]; then POSTSPOOL="$SPOOL/parse/post" fi if [ -z "$SUPPORTEDLOCALES" ]; then SUPPORTEDLOCALES=/etc/SUPPORTED-short fi NL=' ' warn () { ks_log "$@" } die () { warn "$@" exit 1 } warn_getopt () { warn "Failed to parse $1 options" } warn_bad_opt () { warn "Unimplemented $1 option $2" } warn_bad_arg () { warn "Unimplemented $1 $2 argument $3" } # Allow handler files to register functions to be called at the end of # processing; this lets them build up preseed answers over several handler # calls. final_handlers= register_final () { final_handlers="$final_handlers $1" } # Save %post script for later execution. save_post_script () { if [ -e "$SPOOL/parse/post.section" ]; then mkdir -p "$POSTSPOOL" i=0 while [ -e "$POSTSPOOL/$i.script" ]; do i="$(($i + 1))" done mv "$SPOOL/parse/post.section" "$POSTSPOOL/$i.script" chmod +x "$POSTSPOOL/$i.script" if [ "$post_chroot" = 1 ]; then touch "$POSTSPOOL/$i.chroot" if [ "$post_interpreter" ]; then echo "$post_interpreter" \ > "$POSTSPOOL/$i.interpreter" fi else rm -f "$POSTSPOOL/$i.chroot" fi fi } # Load all handlers. for handler in "$HANDLERS"/*; do . "$handler" done # Expects kickstart file as $1. kickseed () { rm -rf "$SPOOL/parse" mkdir -p "$SPOOL/parse" # Parse and execute %pre sections first. SECTION=main while read -r line; do line="${line%% }" keyword="${line%%[ ]*}" case $keyword in %pre) SECTION=pre pre_handler_section "${line#*[ ]}" > "$SPOOL/parse/pre.section" continue ;; %packages|%post) SECTION="${keyword#%}" continue ;; esac if [ "$SECTION" = pre ]; then echo "$line" >> "$SPOOL/parse/pre.section" fi done < "$1" if [ -e "$SPOOL/parse/pre.section" ]; then chmod +x "$SPOOL/parse/pre.section" CODE=0 ks_run_script pre /bin/sh 0 "$SPOOL/parse/pre.section" || CODE="$?" if [ "$CODE" != 0 ]; then warn "%pre script exited with error code $CODE" fi rm -f "$SPOOL/parse/pre.section" fi # Parse all other sections. SECTION=main (while read -r line; do line="${line%% }" keyword="${line%%[ ]*}" # Deal with %include directives. if [ "$keyword" = '%include' ]; then rest="${line#*[ ]}" arg="${rest%%[ ]*}" cat "$arg" elif [ "$keyword" = '%final' ]; then die "%final reserved for internal use" else echo "$line" fi done < "$1"; echo %final) | while read -r line; do # Work out the section. keyword="${line%%[ ]*}" if [ "$keyword" = '%packages' ]; then save_post_script SECTION=packages continue elif [ "$keyword" = '%pre' ]; then save_post_script SECTION=pre continue elif [ "$keyword" = '%post' ]; then save_post_script args="${line#*[ ]}" if [ "$args" = "$line" ]; then # No arguments. args= fi eval post_handler_section "$args" SECTION=post > "$SPOOL/parse/post.section" continue elif [ "$keyword" = '%final' ]; then save_post_script for handler in $final_handlers; do $handler done break fi if [ "$SECTION" = main ]; then if [ -z "$keyword" ] || [ "${keyword#\#}" != "$keyword" ]; then # Ignore empty lines and comments. continue fi # Delegate to directive handlers. if type "${keyword}_handler" >/dev/null 2>&1; then args="${line#*[ ]}" if [ "$args" = "$line" ]; then # No arguments. args= fi # This gets ...='\$foo' wrong, but it's # better than the alternative (broken # crypted passwords) for now. args="$(printf %s "$args" | sed 's/\$/\\$/g')" eval "${keyword}_handler" "$args" else warn "Unrecognised kickstart command: $keyword" fi elif [ "$SECTION" = packages ]; then if [ -z "$keyword" ] || [ "${keyword#\#}" != "$keyword" ]; then # Ignore empty lines and comments. continue fi group= if [ "$keyword" = '@' ]; then group="${line#*[ ]}" elif [ "${keyword#@}" != "$keyword" ]; then group="${line#@}" fi if [ "$group" ]; then # TODO: temporary hack to make at least the # standard desktop work case $group in *\ Standard) echo 'task:standard' >> "$SPOOL/parse/$SECTION.section" ;; Ubuntu\ Desktop) echo 'task:ubuntu-desktop' >> "$SPOOL/parse/$SECTION.section" ;; Kubuntu\ Desktop) echo 'task:kubuntu-desktop' >> "$SPOOL/parse/$SECTION.section" ;; *\ *) warn "Package group '$group' not implemented" ;; *) # Anything without a space # is assumed to be the name # of a task; useful for # customisers. echo "task:$group" >> "$SPOOL/parse/$SECTION.section" ;; esac else echo "pkg:$line" >> "$SPOOL/parse/$SECTION.section" fi elif [ "$SECTION" = pre ]; then # already handled continue else echo "$line" >> "$SPOOL/parse/$SECTION.section" fi done || exit $? if [ -s "$SPOOL/parse/packages.section" ]; then # Handle %packages. # TODO: doesn't allow removal of packages from ubuntu-base packages="$(cat "$SPOOL/parse/packages.section")" positives=. negatives=. for pkg in $packages; do case $pkg in task:-*|pkg:-*) negatives="$negatives $pkg" ;; *) positives="$positives $pkg" ;; esac done # pattern gets: (~nPOS|~nPOS|~nPOS)!~nNEG!~nNEG!~nNEG joinpositives= for pkg in $positives; do case $pkg in .) continue ;; task:*) element="~t^${pkg#task:}\$" tasklist="${tasklist:+$tasklist, }${pkg#task:}" ;; pkg:*) element="~n^${pkg#pkg:}\$" packagelist="${packagelist:+$packagelist }${pkg#pkg:}" ;; esac joinpositives="${joinpositives:+$joinpositives|}$element" done pattern="($joinpositives)" hasnegatives=false for pkg in $negatives; do case $pkg in .) continue ;; task:-*) element="~t^${pkg#task:-}\$" hasnegatives=: ;; pkg:-*) element="~n^${pkg#pkg:-}\$" hasnegatives=: ;; esac pattern="$pattern!$element" done # requires pkgsel 0.04ubuntu1; obsolete as of pkgsel # 0.07ubuntu1 ks_preseed d-i pkgsel/install-pattern string "$pattern" # requires pkgsel 0.07ubuntu1/0.08 ks_preseed tasksel tasksel/first multiselect "$tasklist" ks_preseed d-i pkgsel/include string "$packagelist" if $hasnegatives; then warn "exclusions in %packages not supported; remove them manually in %post instead" fi fi # Kickstart installations always run at critical priority. ks_preseed d-i debconf/priority 'select' critical } kickseed_post () { # Post-installation parts of handlers. for dir in "$POSTSPOOL"/*.handler; do [ -d "$dir" ] || continue name="${dir##*/}" if type "${name%.handler}_post" >/dev/null 2>&1; then ks_run_handler "${name%.handler}_post" else warn "Missing post-installation handler: $name" fi done # User-supplied post-installation scripts. # TODO: sort numerically for script in "$POSTSPOOL"/*.script; do [ -f "$script" ] || continue CHROOTED=0 if [ -e "${script%.script}.chroot" ]; then CHROOTED=1 fi INTERPRETER=/bin/sh if [ -e "${script%.script}.interpreter" ]; then INTERPRETER="$(cat "${script%.script}.interpreter")" fi CODE=0 ks_run_script post "$INTERPRETER" "$CHROOTED" "$script" || CODE="$?" if [ "$CODE" != 0 ]; then warn "%post script exited with error code $CODE" fi done } kickseed/setup/0000755000000000000000000000000011606014177010671 5ustar kickseed/setup/cdrom0000755000000000000000000000074211515540347011730 0ustar #! /bin/sh -e # Bring up everything that's needed to fetch a Kickstart file from the # CD-ROM. # without this, debconf clients will talk debconf protocol to syslog . /usr/share/debconf/confmodule if [ ! -x /var/lib/dpkg/info/cdrom-detect.postinst ]; then /lib/kickseed/kickseed-anna cdrom-detect fi if [ -x /var/lib/dpkg/info/cdrom-detect.postinst ]; then /lib/kickseed/kickseed-udpkg cdrom-detect else logger -t kickseed "cdrom-detect cannot be installed" exit 1 fi exit 0 kickseed/setup/net0000755000000000000000000000276311606014177011415 0ustar #! /bin/sh -e # Bring up everything that's needed to fetch a Kickstart file from the # network. # without this, debconf clients will talk debconf protocol to syslog . /usr/share/debconf/confmodule . /lib/kickseed/cmdline.sh EXTRA_UDEBS="$@" if [ ! -x /var/lib/dpkg/info/ethdetect.postinst ] || \ [ ! -x /var/lib/dpkg/info/netcfg.postinst ]; then /lib/kickseed/kickseed-anna ethdetect netcfg $EXTRA_UDEBS fi if [ -x /var/lib/dpkg/info/ethdetect.postinst ]; then /lib/kickseed/kickseed-udpkg ethdetect else logger -t kickseed "ethdetect cannot be installed" exit 1 fi set_question () { if ! db_fget "$1" seen || [ "$RET" = false ]; then db_register debian-installer/dummy "$1" if [ "$2" ]; then db_set "$1" "$2" fi db_fset "$1" seen true fi } if [ -x /var/lib/dpkg/info/netcfg.postinst ]; then # Make sure we don't get asked unnecessary networking questions. # Do tell the user about errors, though. KSDEVICE="$(kickseed_cmdline /proc/cmdline ksdevice)" if [ -z "$KSDEVICE" ] || [ "$KSDEVICE" = link ] || \ [ "$KSDEVICE" = bootif ]; then # bootif requires netcfg 1.63 KSDEVICE=auto fi set_question netcfg/choose_interface "$KSDEVICE" set_question netcfg/get_hostname kickseed set_question netcfg/wireless_essid set_question netcfg/wireless_essid_again set_question netcfg/wireless_wep # Run the postinst by hand so that main-menu will run netcfg again # later, possibly with different preseeded answers. /var/lib/dpkg/info/netcfg.postinst configure 2>&1 | logger -t netcfg fi kickseed/setup/hd0000755000000000000000000000131311515540347011212 0ustar #! /bin/sh -e # Bring up everything that's needed to fetch a Kickstart file from a hard # disk. # without this, debconf clients will talk debconf protocol to syslog . /usr/share/debconf/confmodule PACKAGES='ext2-modules vfat-modules fs-core-modules fs-secondary-modules' if [ ! -x /var/lib/dpkg/info/disk-detect.postinst ]; then PACKAGES="$PACKAGES disk-detect" fi /lib/kickseed/kickseed-anna $PACKAGES if [ -x /var/lib/dpkg/info/disk-detect.postinst ]; then /lib/kickseed/kickseed-udpkg disk-detect else logger -t kickseed "disk-detect cannot be installed" exit 1 fi depmod -a >/dev/null 2>&1 || true log-output -t kickseed modprobe -q ext2 || true log-output -t kickseed modprobe -q vfat || true exit 0 kickseed/setup/nfs0000755000000000000000000000032511515540347011407 0ustar #! /bin/sh -e # Bring up everything that's needed to fetch a Kickstart file from NFS. /lib/kickseed/setup/net nfs-modules depmod -a >/dev/null 2>&1 || true log-output -t kickseed modprobe -q nfs || true exit 0 kickseed/kickseed-udpkg0000755000000000000000000000022511515540347012352 0ustar #! /bin/sh # Configure a single package earlier than usual. export UDPKG_QUIET=y udpkg --force-configure --configure "$1" 2>&1 | logger -t kickseed kickseed/kickseed-anna0000755000000000000000000000342111515540347012156 0ustar #! /bin/sh . /usr/share/debconf/confmodule # Back up anna's state. standard_modules_backup=true if db_get anna/standard_modules; then standard_modules_backup="$RET" fi if [ -f /var/lib/anna-install/queue ]; then mv -f /var/lib/anna-install/queue /var/lib/anna-install/queue.backup fi # Don't do the usual installation of everything we can find. db_set anna/standard_modules false anna-install "$@" # We only support specific retrievers here, because some of them are # difficult to use properly at this stage, and not all of them make sense. # For instance, the netboot initrd already has enough packages to retrieve # Kickstart files from the network, and if you were using that initrd it's # unlikely that you'd want to retrieve Kickstart files from a CD. # # Whatever way we do it, this is going to be a hideous layering violation. # The only question is which layers we violate. We call postinsts manually # to avoid leaving packages configured, which would confuse d-i later on. export UDPKG_QUIET=y if [ -x /var/lib/dpkg/info/load-cdrom.postinst ]; then if [ ! -d /cdrom/dists ]; then /lib/kickseed/kickseed-udpkg cdrom-detect fi /var/lib/dpkg/info/load-cdrom.postinst configure elif [ -x /var/lib/dpkg/info/load-iso.postinst ]; then if [ ! -d /cdrom/dists ]; then /lib/kickseed/kickseed-udpkg iso-scan fi /var/lib/dpkg/info/load-iso.postinst configure elif [ -x /var/lib/dpkg/info/load-media.postinst ]; then /var/lib/dpkg/info/load-media.postinst configure else logger -t kickseed "No supported retriever found!" exit 1 fi # Put anna's state back the way it was, to allow d-i's normal run. if [ -f /var/lib/anna-install/queue.backup ]; then mv -f /var/lib/anna-install/queue.backup /var/lib/anna-install/queue fi db_set anna/standard_modules "$standard_modules_backup" exit 0 kickseed/finish-install.d/0000755000000000000000000000000011515540347012701 5ustar kickseed/finish-install.d/01kickseed0000755000000000000000000000107011515540347014550 0ustar #! /bin/sh -e . /lib/kickseed/kickseed.sh ks_log () { logger -t kickseed "$@" } ks_run_script () { TYPE="$1" INTERPRETER="$2" CHROOTED="$3" SCRIPT="$4" if [ "$CHROOTED" = 1 ]; then in_target=in-target root=/target else in_target= root= fi logger -t kickseed "Running $TYPE script $SCRIPT using interpreter $INTERPRETER (chrooted: $CHROOTED):" cp "$SCRIPT" "$root/tmp/ks-script" chmod 700 "$root/tmp/ks-script" log-output -t kickseed --pass-stdout \ $in_target "$INTERPRETER" /tmp/ks-script } ks_run_handler () { eval "$1" } kickseed_post