[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Tentative patch for unified output library



Please do _not_ apply this patch without review.  This patch serves two
purposes: the first, and the one most useful to remember is that it
serves as a way to introduce me to the code base.  The second purpose is
to reduce the size of the code base, and make things slightly more
unified and canonical.

If it's interesting for you, I hope it is useful.  Thanks all,
-- 
 --------------------------------------------------------------------------
|  Stephen Gran                  | Questionable day.  Ask somebody         |
|  steve@lobefin.net             | something.                              |
|  http://www.lobefin.net/~steve |                                         |
 --------------------------------------------------------------------------
diff --git a/packages/apt-setup/apt-setup b/packages/apt-setup/apt-setup
index 28bf749..d3613b2 100755
--- a/packages/apt-setup/apt-setup
+++ b/packages/apt-setup/apt-setup
@@ -2,6 +2,7 @@
 set -e
 
 . /usr/share/debconf/confmodule
+. /lib/output.sh
 
 gendir=/usr/lib/apt-setup/generators
 
@@ -25,13 +26,6 @@ export ROOT
 # generators/01setup will create this; apt honours it (see apt.conf(5))
 export APT_CONFIG=/etc/apt/apt.conf.new
 
-log() {
-        logger -t apt-setup "$@"
-}
-warning() {
-        log "warning: $@"
-}
-
 gencount=`ls "$gendir"/* | wc -l`
 db_capb backup progresscancel
 db_progress START 0 $(expr "$gencount" \* 200) apt-setup/progress/title
@@ -64,7 +58,7 @@ for generator in $gendir/*; do
 	    0)
 		if ! apt-setup-verify $ROOT$tmp
 			$ROOT/etc/apt/sources.list.new -- --from=$PROGRESS_FROM --to=$PROGRESS_TO; then
-			warning "$generator output did not verify"
+			warning apt-setup "$generator output did not verify"
 		fi
 		;;
 	    9)
@@ -73,14 +67,14 @@ for generator in $gendir/*; do
 		;;
 	    10)
 		# TODO handle backup better
-		log "$generator backed up"
+		log apt-setup "$generator backed up"
 		rm -f $ROOT$tmp $ROOT/etc/apt/sources.list.new
 		db_progress STOP
 		db_capb backup
 		exit 10
 		;;
 	    *)
-		warning "$generator returned error code $code; discarding output"
+		warning apt-setup "$generator returned error code $code; discarding output"
 		;;
 	esac
 	rm -f $ROOT$tmp
diff --git a/packages/apt-setup/finish-install.apt-cdrom-setup b/packages/apt-setup/finish-install.apt-cdrom-setup
index c955228..60a61d9 100755
--- a/packages/apt-setup/finish-install.apt-cdrom-setup
+++ b/packages/apt-setup/finish-install.apt-cdrom-setup
@@ -1,12 +1,13 @@
 #! /bin/sh
 set -e
+. /lib/output.sh
 
 # Disable netinst CD image in sources.list if any other sources are present
 if [ -e /cdrom/.disk/base_installable ] && \
    [ -e /cdrom/.disk/cd_type ] && \
    [ "$(cat /cdrom/.disk/cd_type)" = not_complete ] && \
    grep -q "^deb \(ht\|f\)tp" /target/etc/apt/sources.list; then
-	logger -t finish-install "Disabling netinst CD in sources.list"
+	log finish-install "Disabling netinst CD in sources.list"
 	sed -i "/^deb cdrom:/s/^/#/" /target/etc/apt/sources.list
 	log-output -t finish-install chroot /target apt-get update
 fi
diff --git a/packages/apt-setup/generators/50mirror b/packages/apt-setup/generators/50mirror
index 003fc1e..a38bb66 100755
--- a/packages/apt-setup/generators/50mirror
+++ b/packages/apt-setup/generators/50mirror
@@ -2,25 +2,19 @@
 set -e
 
 . /usr/share/debconf/confmodule
+. /lib/output.sh
 
 file="$1"
 
 NL="
 "
 
-log() {
-	logger -t apt-setup "$@"
-}
-warning() {
-	log "warning: $@"
-}
-
 # Ask if a mirror should be used if the base system can be installed from CD
 # Default to false for full CD/DVD images; ask only at medium prio for
 # netinst images and DVDs
 if [ -e /cdrom/.disk/base_installable ]; then
 	if ! search-path choose-mirror; then
-		warning "choose-mirror is not available; cannot offer network mirror"
+		warning apt-setup "choose-mirror is not available; cannot offer network mirror"
 		exit 1
 	fi
 
@@ -93,7 +87,7 @@ if [ -e /cdrom/.disk/base_installable ]; then
 				exit 1
 			fi
 		else
-			logger -t apt-setup "choose-mirror failed with error code $RET"
+			warning apt-setup "choose-mirror failed with error code $RET"
 			exit $RET
 		fi
 	done
diff --git a/packages/apt-setup/generators/50mirror.ubuntu b/packages/apt-setup/generators/50mirror.ubuntu
index 7d73cad..0e1bf3c 100755
--- a/packages/apt-setup/generators/50mirror.ubuntu
+++ b/packages/apt-setup/generators/50mirror.ubuntu
@@ -2,20 +2,14 @@
 set -e
 
 . /usr/share/debconf/confmodule
+. /lib/output.sh
 
 file="$1"
 
-log() {
-	logger -t apt-setup "$@"
-}
-warning() {
-	log "warning: $@"
-}
-
 # Ask if a mirror should be used if the base system can be installed from CD
 if [ -e /cdrom/.disk/base_installable ]; then
 	if ! search-path choose-mirror; then
-		warning "choose-mirror is not available; cannot offer network mirror"
+		warning apt-setup "choose-mirror is not available; cannot offer network mirror"
 		exit 1
 	fi
 
diff --git a/packages/apt-setup/generators/90services-select b/packages/apt-setup/generators/90services-select
index 2d2af06..cc51553 100755
--- a/packages/apt-setup/generators/90services-select
+++ b/packages/apt-setup/generators/90services-select
@@ -7,6 +7,7 @@ set -e
 # using preseeding.
 
 . /usr/share/debconf/confmodule
+. /lib/output.sh
 
 # Returns 0 if the service was actually removed
 disable_service() {
@@ -58,7 +59,7 @@ fi
 
 # Selecting volatile for testing is invalid
 if [ "$volatile" = n ] && disable_service volatile; then
-	logger -t apt-setup "info: invalid selection of volatile for testing disabled"
+	info apt-setup "invalid selection of volatile for testing disabled"
 fi
 
 # No need to set up proxy here if no services were selected
diff --git a/packages/arch/alpha/aboot-installer/debian/postinst b/packages/arch/alpha/aboot-installer/debian/postinst
index 014f5af..d06dd7f 100644
--- a/packages/arch/alpha/aboot-installer/debian/postinst
+++ b/packages/arch/alpha/aboot-installer/debian/postinst
@@ -2,18 +2,7 @@
 export LD_LIBRARY_PATH="/target/lib:/target/usr/lib"
 
 . /usr/share/debconf/confmodule
-
-log() {
-    logger -t aboot-installer "$@"
-}
-
-error() {
-    log "error: $@"
-}
-
-info() {
-    log "info: $@"
-}
+. /lib/output.sh
 
 # Make sure mtab in the chroot reflects the currently mounted partitions
 update_mtab() {
@@ -37,7 +26,7 @@ db_progress STEP 1
 db_progress INFO aboot-installer/progress/step_install
 
 if ! apt-install aboot; then
-	info "Calling 'apt-install aboot' failed"
+	info aboot-installer aboot-installer "Calling 'apt-install aboot' failed"
 	db_input critical aboot-installer/apt-install-failed || [ $? -eq 30 ]
 	db_go
 	db_get aboot-installer/apt-install-failed
@@ -67,7 +56,7 @@ done
 if [ -z "$PARTITIONS" ]; then
 	# error: no viable ext2 partitions found, throw a debconf message
 	# and exit with an error
-	error 'No ext2 partitions found'
+	error aboot-installer 'No ext2 partitions found'
 	db_input critical aboot-installer/no-partitions || [ $? -eq 30 ]
 	db_go
 	db_progress STOP
@@ -111,7 +100,7 @@ db_progress STEP 1
 db_subst aboot-installer/progress/step_install_loader BOOTDISK $bootdisk
 db_progress INFO aboot-installer/progress/step_install_loader
 
-info "Installing aboot on '$bootdisk'"
+info aboot-installer "Installing aboot on '$bootdisk'"
 if [ -e /var/lib/aboot-installer/aboot-partnum ]; then
 	partnum_arg=-f$(cat /var/lib/aboot-installer/aboot-partnum)
 fi
@@ -123,7 +112,7 @@ db_progress STEP 1
 db_subst aboot-installer/progress/step_config_loader PARTNUM $partnum
 db_progress INFO aboot-installer/progress/step_config_loader
 
-info "Configuring aboot to look in partition $partnum"
+info aboot-installer "Configuring aboot to look in partition $partnum"
 chroot /target /sbin/abootconf $bootdisk $partnum
 
 # Edit /etc/aboot.conf to point to partnum.
diff --git a/packages/arch/arm/glantank/debian/glantank-installer.postinst b/packages/arch/arm/glantank/debian/glantank-installer.postinst
index 1d1ac6e..3a582eb 100755
--- a/packages/arch/arm/glantank/debian/glantank-installer.postinst
+++ b/packages/arch/arm/glantank/debian/glantank-installer.postinst
@@ -3,18 +3,10 @@
 set -e
 
 . /usr/share/debconf/confmodule
-
-log() {
-	logger -t glantank-installer "$@"
-}
-
-error() {
-	log "error: $@"
-}
-
+. /lib/output.sh
 
 if ! apt-install glantank-utils; then
-	error "apt-install glantank-utils failed"
+	error glantank-installer "apt-install glantank-utils failed"
 	exit 1
 fi
 
@@ -25,7 +17,7 @@ if ! grep -q glantank-update-kernel /target/etc/kernel-img.conf; then
 fi
 
 if ! in-target glantank-update-kernel; then
-	error "glantank-update-kernel failed"
+	error glantank-installer "glantank-update-kernel failed"
 	exit 1
 fi
 
diff --git a/packages/arch/i386/grub-installer/debian/isinstallable b/packages/arch/i386/grub-installer/debian/isinstallable
index 09b98b9..dd7d6e6 100755
--- a/packages/arch/i386/grub-installer/debian/isinstallable
+++ b/packages/arch/i386/grub-installer/debian/isinstallable
@@ -1,9 +1,6 @@
 #!/bin/sh
 . /usr/share/debconf/confmodule
-
-log() {
-	logger -t grub-installer "$@"
-}
+. /lib/output.sh
 
 findfs () {
 	mount | grep "on /target${1%/} " | cut -d' ' -f1
@@ -30,7 +27,7 @@ case $ARCH in
     i386/mac|amd64/mac)
 	# Note: depends on partman-efi to load the efivars module!
 	if [ -d /sys/firmware/efi ]; then
-		log "GRUB not yet usable on Intel-based Macs booted using EFI"
+		log grub-installer "GRUB not yet usable on Intel-based Macs booted using EFI"
 		exit 1
 	fi
     ;;
@@ -48,7 +45,7 @@ fi
 # certian lvm device names.
 if lvdisplay "$bootfs" | grep -q 'LV Name' 2>/dev/null || [ -e "$(dirname $bootfs)/control" ]; then
 	if ! is_sataraid $bootfs; then
-		log "/boot is a lvm volume ($bootfs), cannot install grub"
+		log grub-installer "/boot is a lvm volume ($bootfs), cannot install grub"
 		exit 1
 	fi
 fi
@@ -57,7 +54,7 @@ bootfstype=$(findfstype /boot)
 [ -n "$bootfstype" ] || bootfstype="$(findfstype /)"
 
 if [ "$bootfstype" = "xfs" ]; then
-	log "/boot on xfs, unsafe to install grub"
+	log grub-installer "/boot on xfs, unsafe to install grub"
 	# Check this first to allow for preseeding forcing grub to xfs.
 	db_get grub-installer/install_to_xfs
 	if [ "$RET" != true ]; then
diff --git a/packages/arch/i386/grub-installer/grub-installer b/packages/arch/i386/grub-installer/grub-installer
index d63b2c4..d8c0af9 100755
--- a/packages/arch/i386/grub-installer/grub-installer
+++ b/packages/arch/i386/grub-installer/grub-installer
@@ -2,6 +2,7 @@
 
 set -e
 . /usr/share/debconf/confmodule
+. /lib/output.sh
 #set -x
 
 if [ "$1" ]; then
@@ -20,20 +21,8 @@ newline="
 
 db_capb backup
 
-log() {
-	logger -t grub-installer "$@"
-}
-
-error() {
-	log "error: $@"
-}
-
-info() {
-	log "info: $@"
-}
-
 ARCH="$(archdetect)"
-info "architecture: $ARCH"
+info grub-installer "architecture: $ARCH"
 
 get_serial_console() {
 	# Get the last 'console=' entry (if none, the whole string is returned)
@@ -213,7 +202,7 @@ hurd_convert () {
 # Run update-grub in $ROOT
 update_grub () {
 	if ! log-output -t grub-installer $chroot $ROOT update-grub -y ; then
-		error "Running 'update-grub -y' failed." 1>&2
+		error grub-installer "Running 'update-grub -y' failed." 1>&2
 		db_input critical grub-installer/update-grub-failed || [ $? -eq 30 ]
 		db_go || true
 		db_progress STOP
@@ -239,7 +228,7 @@ bootfstype=$(findfstype /boot)
 case $ARCH in
     powerpc/*)
       offs=$(findfs /boot/grub)
-      [ -n "$offs" ] || error "GRUB requires that the OF partition is mounted in /boot/grub" 1>&2
+      [ -n "$offs" ] || error grub-installer "GRUB requires that the OF partition is mounted in /boot/grub" 1>&2
     ;;
 esac
 
@@ -281,7 +270,7 @@ if type dmraid >/dev/null 2>&1; then
 	done
 fi
 
-info "Identified partition label for $bootfs: $bootfslabel"
+info grub-installer "Identified partition label for $bootfs: $bootfslabel"
 
 case $ARCH in
     i386/mac|amd64/mac)
@@ -376,7 +365,7 @@ esac
 
 if ! apt-install $grub_package ; then
 	db_progress STOP
-	info "Calling 'apt-install $grub_package' failed"
+	info grub-installer "Calling 'apt-install $grub_package' failed"
 	db_subst grub-installer/apt-install-failed GRUB "$grub_package"
 	db_input critical grub-installer/apt-install-failed || true
 	if ! db_go; then
@@ -516,7 +505,7 @@ db_progress STEP 1
 db_subst grub-installer/progress/step_install_loader BOOTDEV "$bootdev"
 db_progress INFO grub-installer/progress/step_install_loader
 
-info "Installing grub on '$bootdev'"
+info grub-installer "Installing grub on '$bootdev'"
 
 update_mtab
 
@@ -528,10 +517,10 @@ if [ -z "$frdisk" ]; then
 		grub_install_params=
 		if ! is_floppy "$bootdev"; then
 			if $chroot $ROOT grub-install -h 2>&1 | grep -q no-floppy; then
-				info "grub-install supports --no-floppy"
+				info grub-installer "grub-install supports --no-floppy"
 				grub_install_params="$grub_install_params --no-floppy"
 			else
-				info "grub-install does not support --no-floppy"
+				info grub-installer "grub-install does not support --no-floppy"
 			fi
 		fi
 
@@ -544,11 +533,11 @@ if [ -z "$frdisk" ]; then
 			grub_install_params="$grub_install_params --recheck"
 		fi
 
-		info "Running $chroot $ROOT grub-install $grub_install_params \"$bootdev\""
+		info grub-installer "Running $chroot $ROOT grub-install $grub_install_params \"$bootdev\""
 		if log-output -t grub-installer $chroot $ROOT grub-install $grub_install_params "$bootdev"; then
-			info "grub-install ran successfully"
+			info grub-installer "grub-install ran successfully"
 		else
-			error "Running 'grub-install $grub_install_params \"$bootdev\"' failed."
+			error grub-installer "Running 'grub-install $grub_install_params \"$bootdev\"' failed."
 			db_subst grub-installer/grub-install-failed BOOTDEV "$bootdev"
 			db_input critical grub-installer/grub-install-failed || [ $? -eq 30 ]
 			db_go || true
@@ -560,20 +549,20 @@ if [ -z "$frdisk" ]; then
 else
 
 	# Semi-manual grub setup for Serial ATA RAID
-	info "Boot partition is on a Serial ATA RAID disk"
-	info "Installing GRUB to $frdev; grub root is $disc_offered"
+	info grub-installer "Boot partition is on a Serial ATA RAID disk"
+	info grub-installer "Installing GRUB to $frdev; grub root is $disc_offered"
 	case $(archdetect) in
 	    i386/*)
 		stagedir=i386-pc ;;
 	    amd64/*)
 		stagedir=x86_64-pc ;;
 	    *)
-	    	error "Unsupported architecture for SATA RAID installation"
+	    	error grub-installer "Unsupported architecture for SATA RAID installation"
 		exit 1
 		;;
 	esac
 	if [ ! -d $ROOT/usr/lib/grub/$stagedir/ ]; then
-		error "Grub stage files not available"
+		error grub-installer "Grub stage files not available"
 		exit 1
 	fi
 	mkdir -p $ROOT/boot/grub
@@ -735,7 +724,7 @@ for os in $(cat /tmp/os-probed); do
 		esac
 		;;
 	    *)
-		info "unhandled: $os"
+		info grub-installer "unhandled: $os"
 		;;
 	esac
 	IFS="$newline"
diff --git a/packages/arch/i386/lilo-installer/debian/isinstallable b/packages/arch/i386/lilo-installer/debian/isinstallable
index 34a4de9..503e116 100755
--- a/packages/arch/i386/lilo-installer/debian/isinstallable
+++ b/packages/arch/i386/lilo-installer/debian/isinstallable
@@ -1,9 +1,6 @@
 #!/bin/sh
 
-log() {
-	logger -t lilo-installer "$@"
-}
-
+. /lib/output.sh
 ARCH="$(archdetect)"
 case $ARCH in
     i386/mac|amd64/mac)
@@ -11,7 +8,7 @@ case $ARCH in
 	# where /sys/firmware/efi doesn't exist.
 	# Note: depends on partman-efi to load the efivars module!
 	if [ -d /sys/firmware/efi ]; then
-		log "LILO not usable on Intel-based Macs without BIOS compatibility; use elilo"
+		log lilo-installer "LILO not usable on Intel-based Macs without BIOS compatibility; use elilo"
 		exit 1
 	fi
 	;;
diff --git a/packages/arch/i386/lilo-installer/debian/postinst b/packages/arch/i386/lilo-installer/debian/postinst
index e9ba935..ecf3fd9 100755
--- a/packages/arch/i386/lilo-installer/debian/postinst
+++ b/packages/arch/i386/lilo-installer/debian/postinst
@@ -2,22 +2,11 @@
 set -e
 
 . /usr/share/debconf/confmodule
+. /lib/output.sh
 
 newline="
 "
 
-log() {
-	logger -t lilo-installer "$@"
-}
-
-error() {
-	log "error: $@"
-}
-
-info() {
-	log "info: $@"
-}
-
 findfs () {
 	mount | grep "on /target${1%/} " | cut -d' ' -f1
 }
@@ -251,7 +240,7 @@ if db_get base-installer/kernel/linux/link_in_boot; then
 		BOOT="/boot"
 	fi
 else
-	log "warning: Failed to get debconf answer 'base-installer/kernel/linux/link_in_boot'."
+	warn lilo-installer "Failed to get debconf answer 'base-installer/kernel/linux/link_in_boot'."
 fi
 
 if [ -e "/target${BOOT}/initrd.img" ]; then
@@ -418,7 +407,7 @@ other=$mappedpartition
 EOF
 			;;
 			*)
-				info "unhandled: $os"
+				info lilo-installer "unhandled: $os"
 			;;
 		esac
 		IFS="$newline"
@@ -433,7 +422,7 @@ db_progress info lilo-installer/progress_installing
 mount -t proc none /target/proc || true
 
 if ! apt-install lilo ; then
-	info "Calling 'apt-install lilo' failed"
+	info lilo-installer "Calling 'apt-install lilo' failed"
 	# Hm, unable to install lilo into /target/, what should we do?
 	db_input critical lilo-installer/apt-install-failed || [ $? -eq 30 ]
 	if ! db_go; then
diff --git a/packages/arch/ia64/elilo-installer/debian/elilo-installer.postinst b/packages/arch/ia64/elilo-installer/debian/elilo-installer.postinst
index 642a497..ce24a86 100644
--- a/packages/arch/ia64/elilo-installer/debian/elilo-installer.postinst
+++ b/packages/arch/ia64/elilo-installer/debian/elilo-installer.postinst
@@ -2,21 +2,10 @@
 set -e
 
 . /usr/share/debconf/confmodule
+. /lib/output.sh
 
 db_capb backup
 
-log() {
-	logger -t elilo-installer "$@"
-}
-
-error() {
-	log "error: $@"
-}
-
-info() {
-    log "info: $@"
-}
-
 if [ -f /etc/mtab ]; then
     MTAB=/etc/mtab
 else
@@ -82,7 +71,7 @@ db_progress START 0 2 debian-installer/elilo-installer/title
 db_progress INFO elilo-installer/progress_installing
 
 if ! apt-install elilo ; then
-	info "Calling 'apt-install elilo' failed"
+	info elilo-installer "Calling 'apt-install elilo' failed"
 	# Hm, unable to install elilo into /target/, what should we do?
 	db_input critical elilo-installer/apt-install-failed || [ $? -eq 30 ]
 	if ! db_go; then
@@ -104,7 +93,7 @@ db_progress INFO elilo-installer/progress_running
 ## efibootmgr, which is called by elilo, needs this
 if [ ! -f /proc/efivars ] && [ ! -d /sys/firmware/efi/vars ] ; then
   if ! modprobe efivars ; then
-    log "Couldn't load efivars module - is it statically linked?"
+    log elilo-installer "Couldn't load efivars module - is it statically linked?"
   fi
 fi
 
@@ -116,14 +105,14 @@ sysmount=0
 
 if grep -q sysfs /proc/filesystems ; then
   if [ ! -d /target/sys ] ; then
-    error "/target/sys does not exist"
+    error lilo-installer "/target/sys does not exist"
   fi
   ## check to see if sysfs is already mounted in the target
   if ! grep '^sysfs ' /proc/mounts | cut -d' ' -f2 | grep -q '^/target/sys$' ; then
     if mount sysfs /target/sys -t sysfs ; then
       sysmount=1
     else
-      log "Couldn't mount sysfs, continuing in case its not needed"
+      log elilo-installer "Couldn't mount sysfs, continuing in case its not needed"
     fi
   fi
 fi
@@ -135,12 +124,12 @@ chroot /target /usr/sbin/elilo --autoconf --boot $bootpart \
 ## umount sysfs if we mounted it above
 if [ $sysmount -eq 1 ]; then
   if ! umount /target/sys; then
-    log "Couldn't umount sysfs, continuing in case that's ok"
+    log elilo-installer "Couldn't umount sysfs, continuing in case that's ok"
   fi
 fi
 
 if [ "$errcode" = 0 ] ; then
-	info "Boot loader successfully installed into EFI partition"
+	info elilo-installer "Boot loader successfully installed into EFI partition"
 else
 	db_subst elilo-installer/failed ERRCODE "$errcode"
 	db_input critical elilo-installer/failed || [ $? -eq 30 ]
diff --git a/packages/arch/m68k/vmelilo-installer/debian/postinst b/packages/arch/m68k/vmelilo-installer/debian/postinst
index 006e429..f12fab3 100644
--- a/packages/arch/m68k/vmelilo-installer/debian/postinst
+++ b/packages/arch/m68k/vmelilo-installer/debian/postinst
@@ -2,33 +2,7 @@
 set -e
 
 . /usr/share/debconf/confmodule
-
-log() {
-    logger -t vmelilo-installer "$@"
-}
-
-error() {
-    log "error: $@"
-}
-
-info() {
-    log "info: $@"
-}
-
-debug() {
-    log "debug: $@"
-}
-
-die() {
-    template="$1"
-    shift
-
-    error "$@"
-    db_input critical "$template" || [ $? -eq 30 ]
-    db_go
-    db_progress STOP
-    exit 1
-}
+. /lib/output.sh
 
 findfs () {
     df -h "/target$1" | sed '1d;s/[[:space:]].*//'
@@ -42,7 +16,7 @@ write_conf () {
 	  ROOTDEV=$(mapdevfs $ROOTDEV)
 	;;
     esac
-    cat > /target/etc/vmelilo.conf << EOF || die vmelilo-installer/conferr "Error writing /target/etc/vmelilo.conf"
+    cat > /target/etc/vmelilo.conf << EOF || die vmelilo-installer vmelilo-installer/conferr "Error writing /target/etc/vmelilo.conf"
 
 ## vmelilo.conf generated by debian-installer
 ##
@@ -74,7 +48,7 @@ write_bootblock () {
     esac
     
     mount -t proc proc /target/proc
-    log-output -t vmelilo-installer chroot /target /sbin/vmelilo -f || die vmelilo-installer/booterr "Error writing vmelilo"
+    log-output -t vmelilo-installer chroot /target /sbin/vmelilo -f || die vmelilo-installer vmelilo-installer/booterr "Error writing vmelilo"
     umount /target/proc
 }
 
@@ -84,12 +58,12 @@ write_bootblock () {
 db_progress START 0 4 vmelilo-installer/progress
 
 ARCH="$(archdetect)"
-info "architecture: $ARCH"
+info vmelilo-installer "architecture: $ARCH"
 
 db_progress INFO vmelilo-installer/apt-install
 
 if ! apt-install vmelilo; then
-    info "Calling 'apt-install vmelilo' failed"
+    info vmelilo-installer "Calling 'apt-install vmelilo' failed"
     db_input critical vmelilo-installer/apt-install-failed || [ $? -eq 30 ]
     if ! db_go; then
 	db_progress STOP
@@ -106,10 +80,10 @@ db_progress STEP 1
 db_progress INFO vmelilo-installer/root
 
 ROOTDEV="$(findfs /)"
-[ "$ROOTDEV" ] || die vmelilo-installer/noroot 'No root partition found'
+[ "$ROOTDEV" ] || die vmelilo-installer vmelilo-installer/noroot 'No root partition found'
 
 BOOTDEV="`echo $ROOTDEV | sed -e 's/sd\([a-z]\)[0-9]*/sd\1/g' -e 's/part[0-9]*/disc/'`"
-info "root: $ROOTDEV  boot: $BOOTDEV"
+info vmelilo-installer "root: $ROOTDEV  boot: $BOOTDEV"
 
 db_progress STEP 1
 db_progress INFO vmelilo-installer/writeconf
diff --git a/packages/arch/mips/sibyl-installer/debian/postinst b/packages/arch/mips/sibyl-installer/debian/postinst
index 70ca58a..8335164 100755
--- a/packages/arch/mips/sibyl-installer/debian/postinst
+++ b/packages/arch/mips/sibyl-installer/debian/postinst
@@ -2,18 +2,7 @@
 set -e
 
 . /usr/share/debconf/confmodule
-
-log() {
-	logger -t sibyl-installer "$@"
-}
-
-error() {
-	log "error: $@"
-}
-
-info() {
-	log "info: $@"
-}
+. /lib/output.sh
 
 findfs () {
 	mount | grep "on /target${1%/} " | cut -d' ' -f1
@@ -30,7 +19,7 @@ bootdev=`echo $rootfs | sed 's/[0-9]\+$//'`
 db_progress INFO sibyl-installer/apt-install
 
 if ! apt-install sibyl ; then
-	info "Calling 'apt-install sibyl' failed"
+	info sibyl-installer "Calling 'apt-install sibyl' failed"
 	db_input critical sibyl-installer/apt-install-failed || [ $? -eq 30 ]
 	if ! db_go; then
 		exit 10 # back up to menu
@@ -48,10 +37,10 @@ else
 			FLAG="-EL"
 		;;
 		*)
-			error "Unknown architecture `archdetect`"
+			error sibyl-installer "Unknown architecture `archdetect`"
 		;;
 	esac
-	info "Installing sibyl.bin to $bootdev with flag $FLAG"
+	info sibyl-installer "Installing sibyl.bin to $bootdev with flag $FLAG"
 	chroot /target /usr/sbin/installboot $FLAG /usr/lib/sibyl/sibyl.bin $bootdev
 fi
 
@@ -62,7 +51,7 @@ db_progress INFO sibyl-installer/conf
 # that.
 kernel=`find /target/boot -name 'vmlinu*sb1*' | tail -n 1`
 kernel=${kernel#/target/boot/}
-info "Using kernel '$kernel'"
+info sibyl-installer "Using kernel '$kernel'"
 
 # /boot has to be on a separate partition because SiByl can only
 # read from the top-level directory.
diff --git a/packages/arch/mipsel/colo-installer/debian/postinst b/packages/arch/mipsel/colo-installer/debian/postinst
index b2cf766..b1d4564 100755
--- a/packages/arch/mipsel/colo-installer/debian/postinst
+++ b/packages/arch/mipsel/colo-installer/debian/postinst
@@ -2,18 +2,7 @@
 set -e
 
 . /usr/share/debconf/confmodule
-
-log() {
-	logger -t colo-installer "$@"
-}
-
-error() {
-	log "error: $@"
-}
-
-info() {
-	log "info: $@"
-}
+. /lib/output.sh
 
 findfs () {
 	mount | grep "on /target${1%/} " | cut -d' ' -f1
@@ -33,7 +22,7 @@ bootfs_no_dev=${bootfs#/dev/}
 db_progress INFO colo-installer/apt-install
 
 if ! apt-install colo ; then
-	info "Calling 'apt-install colo' failed"
+	info colo-installer "Calling 'apt-install colo' failed"
 	db_input critical colo-installer/apt-install-failed || [ $? -eq 30 ]
 	if ! db_go; then
 		exit 10 # back up to menu
@@ -63,7 +52,7 @@ fi
 if [ "$rootfs" != "$bootfs" ] ; then
 	kernel="${kernel#/boot}"
 fi
-info "Using kernel '$kernel'"
+info colo-installer "Using kernel '$kernel'"
 
 cat > /target/boot/default.colo <<EOF
 #:CoLo:#
diff --git a/packages/arch/powerpc/prep-installer/debian/postinst b/packages/arch/powerpc/prep-installer/debian/postinst
index 3f6f3a2..2abd68f 100644
--- a/packages/arch/powerpc/prep-installer/debian/postinst
+++ b/packages/arch/powerpc/prep-installer/debian/postinst
@@ -7,25 +7,10 @@ set -e
 # Copyright (C) 2005 Sven Luther <luther@debian.org>
 
 . /usr/share/debconf/confmodule
-
-log() {
-    logger -t prep-installer "$@"
-}
-
-error() {
-    log "error: $@"
-}
-
-info() {
-    log "info: $@"
-}
-
-debug() {
-    log "debug: $@"
-}
+. /lib/output.sh
 
 writefile () {
-    cat >>"$1" || die prep-installer/conferr "Error writing $2"
+    cat >>"$1" || die prep-installer prep-installer/conferr "Error writing $2"
 }
 
 findfs () {
@@ -36,24 +21,13 @@ db_capb backup
 
 db_progress START 0 3 prep-installer/progress
 
-die() {
-    template="$1"
-    shift
-
-    error "$@"
-    db_input critical "$template" || [ $? -eq 30 ]
-    db_go || true
-    db_progress STOP
-    exit 1
-}
-
 # Find the boot partition
 
 db_progress STEP 1
 db_progress INFO prep-installer/part
 
 ARCH="$(archdetect)"
-info "architecture: $ARCH"
+info prep-installer "architecture: $ARCH"
 
 PARTITIONS=
 DEFAULT=
@@ -69,8 +43,8 @@ if ([ "$ARCH" = powerpc/prep ] || [ "$ARCH" = powerpc/chrp_rs6k ] || [ "$ARCH" =
 	    PARTITIONS="$PARTITIONS,$part"
 	fi
     done
-    info "partman-supplied bootstrap partitions: $PARTITIONS"
-    info "partman-supplied default bootstrap partition: $DEFAULT"
+    info prep-installer "partman-supplied bootstrap partitions: $PARTITIONS"
+    info prep-installer "partman-supplied default bootstrap partition: $DEFAULT"
     if [ "$PARTITIONS" ] && [ "$DEFAULT" = "$PARTITIONS" ]; then
 	# We have explicit information from partman-prep that only one
 	# bootstrap partition is available, so it's safe to bypass this
@@ -81,7 +55,7 @@ fi
 
 if [ -z "$PARTITIONS" ]; then
     # error: no viable boot partitions found; fall over
-    die prep-installer/nopart 'No prep boot partitions found'
+    die prep-installer prep-installer/nopart 'No prep boot partitions found'
 fi
 
 KERNEL=`ls /target/boot/vmlinuz-2.*`
diff --git a/packages/arch/powerpc/quik-installer/debian/postinst b/packages/arch/powerpc/quik-installer/debian/postinst
index 3e9facc..e48c60f 100644
--- a/packages/arch/powerpc/quik-installer/debian/postinst
+++ b/packages/arch/powerpc/quik-installer/debian/postinst
@@ -5,21 +5,10 @@ set -e
 # powerpc systems.
 
 . /usr/share/debconf/confmodule
-
-log () {
-	logger -t quik-installer "$@"
-}
-
-error () {
-	log "error: $@"
-}
-
-info () {
-	log "info: $@"
-}
+. /lib/output.sh
 
 writefile () {
-	cat >>"$1" || die quik-installer/conferr "Error writing $2"
+	cat >>"$1" || die quik-installer quik-installer/conferr "Error writing $2"
 }
 
 findfs () {
@@ -28,17 +17,6 @@ findfs () {
 
 db_progress START 0 0 quik-installer/progress
 
-die () {
-	template="$1"
-	shift
-
-	error "$@"
-	db_input critical "$template" || [ $? -eq 30 ]
-	db_go
-	db_progress STOP
-	exit 10
-}
-
 # Install quik in /target
 
 db_progress INFO quik-installer/progress/apt-install
@@ -46,7 +24,7 @@ db_progress INFO quik-installer/progress/apt-install
 # Yes, it's a bit silly that we install yaboot. However, where else are we
 # going to get ofpath?
 if ! apt-install quik yaboot powerpc-utils; then
-	info "Calling 'apt-install quik yaboot powerpc-utils' failed"
+	info quik-installer "Calling 'apt-install quik yaboot powerpc-utils' failed"
 	# Hm, unable to install quik into /target/, what should we do?
 	db_input critical quik-installer/apt-install-failed || [ $? -eq 30 ]
 	if ! db_go; then
@@ -71,9 +49,9 @@ mountvirtfs () {
 	if grep -q "[[:space:]]$fstype\$" /proc/filesystems && \
 	   ! grep -q "^[^ ]\+ \+$path " /proc/mounts; then
 		mkdir -p "$path" || \
-			die quik-installer/mounterr "Error creating $path"
+			die quik-installer quik-installer/mounterr "Error creating $path"
 		mount -t "$fstype" "$fstype" "$path" || \
-			die quik-installer/mounterr "Error mounting $path"
+			die quik-installer quik-installer/mounterr "Error mounting $path"
 		trap "umount $path" HUP INT QUIT KILL PIPE TERM EXIT
 	fi
 }
@@ -84,33 +62,33 @@ mountvirtfs proc /target/proc
 mountvirtfs sysfs /target/sys
 
 root_devfs="$(findfs /)"
-[ "$root_devfs" ] || die quik-installer/noroot 'No root partition found'
+[ "$root_devfs" ] || die quik-installer quik-installer/noroot 'No root partition found'
 
 root="$(mapdevfs "$root_devfs")"
-info "root partition: $root"
+info quik-installer "root partition: $root"
 # If ATA (/dev/hd), then it must be on the first disk (/dev/hda).
 if [ "${root#/dev/hd}" != "$root" ] && [ "${root#/dev/hda}" = "$root" ]; then
-	die quik-installer/root_not_on_first_disk '/ not on first disk'
+	die quik-installer quik-installer/root_not_on_first_disk '/ not on first disk'
 fi
 
 boot_devfs="$(findfs /boot)"
 [ "$boot_devfs" ] || boot_devfs="$root_devfs"
 boot="$(mapdevfs "$boot_devfs")"
-info "boot partition: $boot"
+info quik-installer "boot partition: $boot"
 
 # The partition where quik is installed must be ext2 and
 # quik must be installed on the first disk
 if [ "$boot_devfs" != "$root_devfs" ]; then
 	if ! grep '[[:space:]]/target/boot[[:space:]]ext2[[:space:]]' /proc/mounts \
 	   >/dev/null; then
-		die quik-installer/boot_not_ext2 '/boot not ext2'
+		die quik-installer quik-installer/boot_not_ext2 '/boot not ext2'
 	fi
 	if [ "${boot#/dev/hd}" != "$boot" ] && [ "${boot#/dev/hda}" = "$boot" ]; then
-		die quik-installer/boot_not_on_first_disk '/boot not on first disk'
+		die quik-installer quik-installer/boot_not_on_first_disk '/boot not on first disk'
 	fi
 elif ! grep '[[:space:]]/target[[:space:]]ext2[[:space:]]' /proc/mounts \
      >/dev/null; then
-	die quik-installer/boot_not_ext2 '/boot not ext2'
+	die quik-installer quik-installer/boot_not_ext2 '/boot not ext2'
 fi
 
 # Generate quik.conf
@@ -136,7 +114,7 @@ else
 fi
 
 realkernel="$(readlink "/target$kernel")" || \
-	die quik-installer/resolve_vmlinux \
+	die quik-installer quik-installer/resolve_vmlinux \
 	"readlink $kernel failed with exit status $?"
 if [ "${realkernel#/}" = "$realkernel" ]; then
 	# target symlink is relative
@@ -144,7 +122,7 @@ if [ "${realkernel#/}" = "$realkernel" ]; then
 fi
 
 realinitrd="$(readlink "/target$initrd")" || \
-	die quik-installer/resolve_initrd \
+	die quik-installer quik-installer/resolve_initrd \
 	"readlink $initrd failed with exit status $?"
 if [ "$realinitrd" ] && [ "${realinitrd#/}" = "$realinitrd" ]; then
 	# target symlink is relative
@@ -202,7 +180,7 @@ db_progress STEP 1
 db_progress INFO quik-installer/progress/install
 
 ARCH="$(archdetect)"
-info "architecture: $ARCH"
+info quik-installer "architecture: $ARCH"
 
 # Warn that the system may not be bootable after this.
 case $ARCH in
@@ -219,7 +197,7 @@ db_get "$WARNING_TEMPLATE"
 [ "$RET" = true ] || exit 10
 
 log-output -t quik-installer chroot /target $quikinstall || \
-	die quik-installer/quikerr "quik failed with exit status $?"
+	die quik-installer quik-installer/quikerr "quik failed with exit status $?"
 
 # Configure OpenFirmware (OldWorld only)
 
@@ -228,13 +206,13 @@ db_progress INFO quik-installer/progress/openfirmware
 
 if [ "$ARCH" = powerpc/powermac_oldworld ]; then
 	ofpath="`chroot /target ofpath "$disk"`"
-	info "ofpath $disk: $ofpath"
+	info quik-installer "ofpath $disk: $ofpath"
 	log-output -t quik-installer chroot /target nvsetenv boot-device "${ofpath}0" || \
-		die quik-installer/boot-device_failed \
+		die quik-installer quik-installer/boot-device_failed \
 		    "nvsetenv boot-device \"${ofpath}0\" failed with exit status $?"
 	log-output -t quik-installer chroot /target \
 		nvsetenv boot-command "begin ['] boot catch 1000 ms cr again" ||
-		die quik-installer/boot-command_failed \
+		die quik-installer quik-installer/boot-command_failed \
 		    "nvsetenv boot-command failed with exit status $?"
 fi
 
diff --git a/packages/arch/powerpc/yaboot-installer/debian/postinst b/packages/arch/powerpc/yaboot-installer/debian/postinst
index 0f3d0ed..b8d1245 100644
--- a/packages/arch/powerpc/yaboot-installer/debian/postinst
+++ b/packages/arch/powerpc/yaboot-installer/debian/postinst
@@ -2,25 +2,10 @@
 set -e
 
 . /usr/share/debconf/confmodule
-
-log() {
-    logger -t yaboot-installer "$@"
-}
-
-error() {
-    log "error: $@"
-}
-
-info() {
-    log "info: $@"
-}
-
-debug() {
-    log "debug: $@"
-}
+. /lib/output.sh
 
 writefile () {
-    cat >>"$1" || die yaboot-installer/conferr "Error writing $2"
+    cat >>"$1" || die yaboot-installer yaboot-installer/conferr "Error writing $2"
 }
 
 findfs () {
@@ -35,19 +20,8 @@ db_capb backup
 
 db_progress START 0 6 yaboot-installer/progress
 
-die() {
-    template="$1"
-    shift
-
-    error "$@"
-    db_input critical "$template" || [ $? -eq 30 ]
-    db_go || true
-    db_progress STOP
-    exit 1
-}
-
 ARCH="$(archdetect)"
-info "architecture: $ARCH"
+info yaboot-installer "architecture: $ARCH"
 
 # Install yaboot in /target
 
@@ -59,7 +33,7 @@ if [ "$ARCH" = powerpc/powermac_newworld ]; then
 fi
 
 if ! apt-install $PACKAGES; then
-    info "Calling 'apt-install $PACKAGES' failed"
+    info yaboot-installer "Calling 'apt-install $PACKAGES' failed"
     # Hm, unable to install yaboot into /target/, what should we do?
     db_input critical yaboot-installer/apt-install-failed || [ $? -eq 30 ]
     if ! db_go; then
@@ -109,8 +83,8 @@ if [ "$ARCH" = powerpc/powermac_newworld ] && \
 	IFS=,
     done
     IFS="$OLDIFS"
-    info "partman-supplied bootstrap partitions: $PARTITIONS"
-    info "partman-supplied default bootstrap partition: $DEFAULT"
+    info yaboot-installer "partman-supplied bootstrap partitions: $PARTITIONS"
+    info yaboot-installer "partman-supplied default bootstrap partition: $DEFAULT"
     if [ "$PARTITIONS" ] && [ "$DEFAULT" = "$PARTITIONS" ]; then
 	# We have explicit information from partman-newworld that only one
 	# bootstrap partition is available, so it's safe to bypass this
@@ -131,7 +105,7 @@ if [ -z "$PARTITIONS" ]; then
 	    PARTED_FLAGS=
 	    ;;
 	*)
-	    error 'unknown subarchitecture; allowing any bootable partition'
+	    error yaboot-installer 'unknown subarchitecture; allowing any bootable partition'
 	    PARTED_FLAGS='boot'
 	    ;;
     esac
@@ -148,14 +122,14 @@ if [ -z "$PARTITIONS" ]; then
 	done
     done
     if [ "$PARTED_FLAGS" ]; then
-	info "guessed bootstrap partitions: $PARTITIONS"
-	info "guessed default bootstrap partition: $DEFAULT"
+	info yaboot-installer "guessed bootstrap partitions: $PARTITIONS"
+	info yaboot-installer "guessed default bootstrap partition: $DEFAULT"
     fi
 fi
 
 if [ "$PARTED_FLAGS" ] && [ -z "$PARTITIONS" ]; then
     # error: no viable boot partitions found; fall over
-    die yaboot-installer/nopart 'No bootstrap partitions found'
+    die yaboot-installer yaboot-installer/nopart 'No bootstrap partitions found'
 fi
 
 if [ "$PARTITIONS" ]; then
@@ -169,7 +143,7 @@ if [ "$PARTITIONS" ]; then
 
     db_get yaboot-installer/bootdev
     if [ "$RET" = false ]; then
-	die yaboot-installer/nopart 'No bootstrap partition selected (?)'
+	die yaboot-installer yaboot-installer/nopart 'No bootstrap partition selected (?)'
     fi
     # already devfs-mapped
     boot="$RET"
@@ -184,7 +158,7 @@ db_progress STEP 1
 db_progress INFO yaboot-installer/root
 
 rootdev="$(findfs /)"
-[ "$rootdev" ] || die yaboot-installer/noroot 'No root partition found'
+[ "$rootdev" ] || die yaboot-installer yaboot-installer/noroot 'No root partition found'
 
 slashbootdev="$(findfs /boot)"
 [ "$slashbootdev" ] || slashbootdev="$rootdev"
@@ -195,9 +169,9 @@ mountvirtfs () {
     if grep -q "[[:space:]]$fstype\$" /proc/filesystems && \
        ! grep -q "^[^ ]\+ \+$path " /proc/mounts; then
 	mkdir -p "$path" || \
-	    die yaboot-installer/mounterr "Error creating $path"
+	    die yaboot-installer yaboot-installer/mounterr "Error creating $path"
 	mount -t "$fstype" "$fstype" "$path" || \
-	    die yaboot-installer/mounterr "Error mounting $path"
+	    die yaboot-installer yaboot-installer/mounterr "Error mounting $path"
 	trap "umount $path" HUP INT QUIT PIPE TERM EXIT
     fi
 }
@@ -246,9 +220,9 @@ IFS=:
 # persist outside it.
 cat /tmp/os-probed | while read partition title label loadertype; do
     IFS="$OLDIFS"
-    info "probed: $partition:$title:$label:$loadertype"
+    info yaboot-installer "probed: $partition:$title:$label:$loadertype"
     mappedpartition="$(mapdevfs "$partition")"
-    debug "mapped: $mappedpartition"
+    debug yaboot-installer "mapped: $mappedpartition"
     # You only get the first of each non-Linux OS here, as that's all
     # yaboot supports without painful hacking. Sorry.
     case $loadertype in
@@ -257,16 +231,16 @@ cat /tmp/os-probed | while read partition title label loadertype; do
 	    linux-boot-prober "$partition" | while read \
 		    rootpart bootpart label kernel initrd params; do
 		IFS="$OLDIFS"
-		info "linux-boot-probed:" \
+		info yaboot-installer "linux-boot-probed:" \
 		     "$rootpart:$bootpart:$label:$kernel:$initrd:$params"
 		ofrootpart="$(map_of_path "$mappedpartition")" || continue
-		debug "OF root partition: $ofrootpart"
+		debug yaboot-installer "OF root partition: $ofrootpart"
 		# bootpart may or may not be in devfs syntax.
 		mappedbootpart="$(mapdevfs "$bootpart")" || \
 		    mappedbootpart="$bootpart"
-		debug "mapped boot partition: $mappedbootpart"
+		debug yaboot-installer "mapped boot partition: $mappedbootpart"
 		ofbootpart="$(map_of_path "$mappedbootpart")" || continue
-		debug "OF boot partition: $ofbootpart"
+		debug yaboot-installer "OF boot partition: $ofbootpart"
 		if [ -z "$label" ]; then
 		    label="$title"
 		fi
@@ -311,7 +285,7 @@ EOF
 	    fi
 	    ;;
 	*)
-	    info "unhandled: $partition:$title:$label:$loadertype"
+	    info yaboot-installer "unhandled: $partition:$title:$label:$loadertype"
 	    ;;
     esac
     IFS=:
@@ -421,7 +395,7 @@ if [ "$ofpath" ]; then
 device=$ofpath
 EOF
 else
-    info "ofpath returned nothing; leaving out device= line and praying"
+    info yaboot-installer "ofpath returned nothing; leaving out device= line and praying"
 fi
 writeyabootconf <<EOF
 partition=$partnr
@@ -498,7 +472,7 @@ if [ "$ARCH" = powerpc/chrp_pegasos ]; then
     db_input high yaboot-installer/of_pegasos || true
 else
     log-output -t yaboot-installer chroot /target mkofboot -v -f || \
-	die yaboot-installer/ybinerr "mkofboot failed with exit status $?"
+	die yaboot-installer yaboot-installer/ybinerr "mkofboot failed with exit status $?"
 fi
 
 # Done!
diff --git a/packages/autopartkit/debian/isinstallable b/packages/autopartkit/debian/isinstallable
index 6e3a3c9..85733e9 100755
--- a/packages/autopartkit/debian/isinstallable
+++ b/packages/autopartkit/debian/isinstallable
@@ -1,10 +1,6 @@
 #!/bin/sh
 . /usr/share/debconf/confmodule
 
-log() {
-	logger -t autopartkit "$@"
-}
-
 db_get autopartkit/hide
 if [ "$RET" = true ]; then
 	exit 1
diff --git a/packages/autopartkit/debian/postinst b/packages/autopartkit/debian/postinst
index cb96f79..e4aa6a2 100644
--- a/packages/autopartkit/debian/postinst
+++ b/packages/autopartkit/debian/postinst
@@ -1,37 +1,32 @@
 #! /bin/sh -e
 
 . /usr/share/debconf/confmodule
+. /lib/output.sh
 
 template=autopartkit/partition_table
 
-log() {
-    logger -t autopartkit "$@"
-}
-
 run_parts() {
-    partsdir="$1"
-
-    for script in "$partsdir"/*; do
-	if [ -x "$script" ] ; then
-	    if "$script" "$template" ; then
-		:
-	    else
-		log "error: Fragment '$script' returned an error: $?."
-	    fi
-	else
-	    log "error: Fragment '$script' is not executable."
-	fi
-    done
+	partsdir="$1"
+
+	for script in "$partsdir"/*; do
+		if [ -x "$script" ] ; then
+			if ! "$script" "$template" ; then
+				error autopartkit "Fragment '$script' returned an error: $?."
+			fi
+		else
+			error autopartkit "Fragment '$script' is not executable."
+		fi
+	done
 }
 
 modprobe_if_missing() {
-    module=$1
-    if ((cut -d" " -f1 /proc/modules | grep -q "^$module\$") ||
+	module=$1
+	if ((cut -d" " -f1 /proc/modules | grep -q "^$module\$") ||
 	(cut -d" " -f1 /proc/modules | sed -e 's/_/-/g' | grep -q "^$module\$")) ; then
 	:
-    else
-	log-output -t autopartkit modprobe $module || true
-    fi
+	else
+		log-output -t autopartkit modprobe $module || true
+	fi
 }
 
 # Try to load LVM support, and make sure the user tools are installed into
@@ -48,19 +43,19 @@ run_parts /usr/lib/autopartkit.d
 tablefile=`debconf-get $template 2>&1`
 
 if [ -z "$tablefile" -o ! -f "$tablefile" ] ; then
-    log "Unable to find table file '$tablefile'"
+    log autopartkit "Unable to find table file '$tablefile'"
     exit 1
 fi
 
 if autopartkit "$tablefile" ; then
-    log "info: autoparkit ran successfully using table file '$tablefile'."
+    info autopartkit "autoparkit ran successfully using table file '$tablefile'."
 else
     # This should use debconf to report the error.
-    log "error: autopartkit failed."
+    error autopartkit "autopartkit failed."
     exit 1
 fi
 
-log "info: creating /target/etc/fstab."
+info autopartkit "creating /target/etc/fstab."
 /usr/lib/partconf/mkfstab
 
 ##DEBHELPER##
diff --git a/packages/base-installer/library.sh b/packages/base-installer/library.sh
index 8526080..16c3397 100644
--- a/packages/base-installer/library.sh
+++ b/packages/base-installer/library.sh
@@ -24,26 +24,7 @@ NUMCPUS=$(cat /var/numcpus 2>/dev/null) || true
 CPUINFO=/proc/cpuinfo
 SPEAKUP=/proc/speakup
 
-log() {
-	logger -t base-installer "$@"
-}
-error() {
-	log "error: $*"
-}
-warning() {
-	log "warning: $*"
-}
-info() {
-	log "info: $*"
-}
-
-exit_error() {
-	error "exiting on error $1"
-	db_progress stop
-	db_input critical $1 || [ $? -eq 30 ]
-	db_go
-	exit 1
-}
+. /lib/output.sh
 
 waypoint () {
 	WAYPOINTS="$WAYPOINTS $1:$2"
@@ -76,7 +57,7 @@ check_target () {
 	# Partconf causes the latter format.
 	if ! grep -q '/target ' /proc/mounts && \
 	   ! grep -q '/target/ ' /proc/mounts; then
-		exit_error base-installer/no_target_mounted
+		die base-installer base-installer/no_target_mounted
 	fi
 	
 	# Warn about installation over an existing unix.
@@ -88,7 +69,7 @@ check_target () {
 		db_get base-installer/use_unclean_target
 		if [ "$RET" = false ]; then
 			db_reset base-installer/use_unclean_target
-			exit_error base-installer/unclean_target_cancel
+			die base-installer base-installer/unclean_target_cancel
 		fi
 		db_reset base-installer/use_unclean_target
 	fi
@@ -171,12 +152,12 @@ apt_update () {
 		|| apt_update_failed=$?
 	
 	if [ "$apt_update_failed" ]; then
-		warning "apt update failed: $apt_update_failed"
+		warning base-installer "apt update failed: $apt_update_failed"
 	fi
 }
 
 install_extra () {
-	info "Installing queued packages into /target/."
+	info base-installer "Installing queued packages into /target/."
 	
 	if [ -f /var/lib/apt-install/queue ] ; then
 		# We need to install these one by one in case one fails.
@@ -187,7 +168,7 @@ install_extra () {
 			db_progress INFO base-installer/section/install_extra_package
 
 			if ! log-output -t base-installer apt-install $PKG; then
-				warning "Failed to install $PKG into /target/: $?"
+				warning base-installer "Failed to install $PKG into /target/: $?"
 			fi
 
 			# Advance progress bar within space allocated for install_extra
@@ -212,10 +193,10 @@ pre_install_hooks () {
 				if log-output -t base-installer "$script"; then
 					:
 				else
-			    		warning "$script returned error code $?"
+			    		warning base-installer "$script returned error code $?"
 				fi
 		    	else
-				error "Unable to execute $script"
+				error base-installer "Unable to execute $script"
 		    	fi
 		done
 	fi
@@ -239,10 +220,10 @@ post_install_hooks () {
 				if log-output -t base-installer "$script"; then
 					:
 				else
-					warning "$script returned error code $?"
+					warning base-installer "$script returned error code $?"
 				fi
 			else
-				error "Unable to execute $script"
+				error base-installer "Unable to execute $script"
 			fi
 
 			scriptcur="$(($scriptcur + 1))"
@@ -256,7 +237,7 @@ get_mirror_info () {
 		if db_get cdrom/codename && [ "$RET" ] ; then
 			DISTRIBUTION=$RET
 		else
-			exit_error base-installer/no_codename
+			die base-installer base-installer/no_codename
 		fi
 
 		PROTOCOL=file
@@ -278,13 +259,13 @@ get_mirror_info () {
 		# Sanity check: an error reading /cdrom/.disk/base_components can cause
 		# ugly errors in debootstrap because $COMPONENTS will be empty.
 		if [ -z "$COMPONENTS" ]; then
-			exit_error base-installer/cannot_install
+			die base-installer base-installer/cannot_install
 		fi
 	else
 		if db_get mirror/codename && [ "$RET" ] ; then
 			DISTRIBUTION=$RET
 		else
-			exit_error base-installer/no_codename
+			die base-installer base-installer/no_codename
 		fi
 
 		mirror_error=""
@@ -301,7 +282,7 @@ get_mirror_info () {
 		COMPONENTS="main"
 
 		if [ "$mirror_error" = 1 ] || [ -z "$PROTOCOL" ] || [ -z "$MIRROR" ]; then
-			exit_error base-installer/cannot_install
+			die base-installer base-installer/cannot_install
 		fi
 	fi
 }
@@ -315,12 +296,12 @@ kernel_update_list () {
 		if [ -n "$FLAVOUR" ]; then
 			if arch_check_usable_kernel "$candidate" "$FLAVOUR"; then
 				echo "$candidate"
-				info "kernel $candidate usable on $FLAVOUR"
+				info base-installer "kernel $candidate usable on $FLAVOUR"
 			else
-				info "kernel $candidate not usable on $FLAVOUR"
+				info base-installer "kernel $candidate not usable on $FLAVOUR"
 			fi
 		else
-			info "could not determine kernel flavour"
+			info base-installer "could not determine kernel flavour"
 		fi
 	done > "$KERNEL_LIST"
 }
@@ -339,7 +320,7 @@ pick_kernel () {
 	# be usable if possible.
 	kernels=$(sort "$KERNEL_LIST" | tr '\n' ',' | sed -e 's/,$//')
 
-	info "Found kernels '$kernels'"
+	info base-installer "Found kernels '$kernels'"
 
 	if [ "$kernels" ]; then
 		db_subst base-installer/kernel/image KERNELS "$kernels"
@@ -348,7 +329,7 @@ pick_kernel () {
 		db_go || true
 		db_get base-installer/kernel/skip-install
 		if [ "$RET" != true ]; then
-			exit_error base-installer/kernel/no-kernels-found
+			die base-installer base-installer/kernel/no-kernels-found
 		else
 			db_set base-installer/kernel/image "none"
 			KERNEL=none
@@ -360,7 +341,7 @@ pick_kernel () {
 	db_get base-installer/kernel/image
 	if kernel_present "$RET" || [ "$RET" = none ]; then
 		KERNEL="$RET"
-		info "preseeded/current kernel: $KERNEL"
+		info base-installer "preseeded/current kernel: $KERNEL"
 	else
 		# Unset seen flag in case we had an incorrect preseeded value.
 		db_fset base-installer/kernel/image seen false || true
@@ -373,15 +354,15 @@ pick_kernel () {
 	
 		got_arch_kernel=
 		if [ "$arch_kernel" ]; then
-			info "arch_kernel candidates: $arch_kernel"
+			info base-installer "arch_kernel candidates: $arch_kernel"
 			# Walk through recommended list for this architecture in order.
 			for candidate in $arch_kernel; do
 				if kernel_present "$candidate"; then
-					info "arch_kernel: $candidate (present)"
+					info base-installer "arch_kernel: $candidate (present)"
 					KERNEL="$candidate"
 					break
 				else
-					info "arch_kernel: $candidate (absent)"
+					info base-installer "arch_kernel: $candidate (absent)"
 				fi
 			done
 		fi
@@ -424,12 +405,12 @@ pick_kernel () {
 
 	db_get base-installer/kernel/image
 	KERNEL=$RET
-	info "Using kernel '$KERNEL'"
+	info base-installer "Using kernel '$KERNEL'"
 }
 
 install_linux () {
 	if [ "$KERNEL" = none ]; then
-		info "Not installing any kernel"
+		info base-installer "Not installing any kernel"
 		return
 	fi
 	
@@ -454,7 +435,7 @@ install_linux () {
 			do_initrd=yes
 		fi
 	else
-		warning "Failed to get debconf answer 'base-installer/kernel/linux/initrd'."
+		warning base-installer "Failed to get debconf answer 'base-installer/kernel/linux/initrd'."
 		do_initrd=yes
 	fi
 
@@ -465,7 +446,7 @@ install_linux () {
 			link_in_boot=no
 		fi
 	else
-		warning "Failed to get debconf answer 'base-installer/kernel/linux/link_in_boot'."
+		warning base-installer "Failed to get debconf answer 'base-installer/kernel/linux/link_in_boot'."
 		link_in_boot=no
 	fi
 
@@ -475,8 +456,8 @@ install_linux () {
 		mv /target/etc/kernel-img.conf /target/etc/kernel-img.conf.$$
 	fi
 
-	info "Setting do_initrd='$do_initrd'."
-	info "Setting link_in_boot='$link_in_boot'."
+	info base-installer "Setting do_initrd='$do_initrd'."
+	info base-installer "Setting link_in_boot='$link_in_boot'."
 	cat > /target/etc/kernel-img.conf <<EOF
 # Kernel image management overrides
 # See kernel-img.conf(5) for details
@@ -505,7 +486,7 @@ EOF
 		if [ "$rd_generator" = "initramfs-tools" ]; then
 			if ! log-output -t base-installer apt-install busybox; then
 				db_subst base-installer/kernel/failed-package-install PACKAGE busybox
-				exit_error base-installer/kernel/failed-package-install
+				die base-installer base-installer/kernel/failed-package-install
 			fi
 		fi
 
@@ -515,7 +496,7 @@ EOF
 		db_progress INFO base-installer/section/install_kernel_package
 		if ! log-output -t base-installer apt-install "$rd_generator"; then
 			db_subst base-installer/kernel/failed-package-install PACKAGE "$rd_generator"
-			exit_error base-installer/kernel/failed-package-install
+			die base-installer base-installer/kernel/failed-package-install
 		fi
 		
 		# Figure out how to configure the ramdisk creation tool
@@ -525,7 +506,7 @@ EOF
 			: ;;
 		    *)
 			db_subst base-installer/initramfs/unsupported GENERATOR "$rd_generator"
-			exit_error base-installer/initramfs/unsupported
+			die base-installer base-installer/initramfs/unsupported
 			;;
 		esac
 
@@ -540,7 +521,7 @@ EOF
 			FIRSTMODULE=0
 		done
 	else
-		info "Not installing an initrd generator."
+		info base-installer "Not installing an initrd generator."
 	fi
 
 	# Install any extra (kernel related) packages
@@ -552,7 +533,7 @@ EOF
 		EXTRAS="$EXTRAS $RET"
 	fi
 	for package in $EXTRAS; do
-		info "Installing $package."
+		info base-installer "Installing $package."
 		db_subst base-installer/section/install_kernel_package SUBST0 "$package"
 		db_progress INFO base-installer/section/install_kernel_package
 		# The package might not exist; don't worry about it.
@@ -617,7 +598,7 @@ EOF
 
 	if [ "$kernel_install_failed" ]; then
 		db_subst base-installer/kernel/failed-install KERNEL "$KERNEL"
-		exit_error base-installer/kernel/failed-install
+		die base-installer base-installer/kernel/failed-install
 	fi
 }
 
@@ -650,7 +631,7 @@ available_initramfs_generators () {
 			fi
 		fi
 	done
-	info "Available initramfs generator(s): '$irf_list'"
+	info base-installer "Available initramfs generator(s): '$irf_list'"
 
 	[ "$irf_list" ] || return 1
 	echo "$irf_list"
@@ -707,7 +688,7 @@ configure_apt () {
 			fi
 		fi
 		if ! mount -o bind $DIRECTORY /target$DIRECTORY; then
-			warning "failed to bind mount /target$DIRECTORY"
+			warning base-installer "failed to bind mount /target$DIRECTORY"
 		fi
 		# The bind mount is left mounted, for future apt-install
 		# calls to use.
@@ -735,7 +716,7 @@ EOT
 		# Scan CD-ROM or CD image; start with clean sources.list
 		: > /target/etc/apt/sources.list
 		if ! log-output -t base-installer chroot /target apt-cdrom add ; then
-			error "error while running apt-cdrom"
+			error base-installer "error while running apt-cdrom"
 		fi
 	else
 		echo "deb $APTSOURCE $DISTRIBUTION $COMPONENTS" > /target/etc/apt/sources.list
diff --git a/packages/cdrom-detect/debian/cdrom-detect.postinst b/packages/cdrom-detect/debian/cdrom-detect.postinst
index c7c41dd..9622f36 100755
--- a/packages/cdrom-detect/debian/cdrom-detect.postinst
+++ b/packages/cdrom-detect/debian/cdrom-detect.postinst
@@ -2,12 +2,9 @@
 
 set -e
 . /usr/share/debconf/confmodule
+. /lib/output.sh
 #set -x
 
-log() {
-	logger -t cdrom-detect "$@"
-}
-
 fail () {
 	log "CDROM-detect failed; unmounting CD just to be sure"
 	umount /cdrom 2>/dev/null || true
@@ -18,13 +15,13 @@ fail () {
 mount | grep -q 'on /cdrom' && exit 0
 if [ -e /cdrom/.disk/info ]; then
 	CDNAME=`cat /cdrom/.disk/info`
-	log "Detected CD '$CDNAME'"
+	log cdrom-detect "Detected CD '$CDNAME'"
 	exit 0
 fi
 
 hw-detect cdrom-detect/detect_progress_title || true
 
-log "Searching for Debian installation media..."
+log cdrom-detect "Searching for Debian installation media..."
 
 mkdir /cdrom 2>/dev/null || true
 
@@ -35,12 +32,12 @@ do
 	devices="$(list-devices cd; list-devices maybe-usb-floppy)"
 	for device in $devices; do
 		if mount -t iso9660 -o ro,exec $device /cdrom; then
-			log "CD-ROM mount succeeded: device=$device"
+			log cdrom-detect "CD-ROM mount succeeded: device=$device"
 			mounted=1
 			db_set cdrom-detect/cdrom_device $device
 			break
 		else
-			log "CD-ROM mount failed: device=$device"
+			log cdrom-detect "CD-ROM mount failed: device=$device"
 		fi
 	done
 
@@ -54,7 +51,7 @@ do
 		db_go
 		db_get cdrom-detect/retry
 		if [ "$RET" = "true" ]; then
-			log "Unmounting CD just to be sure"
+			log cdrom-detect "Unmounting CD just to be sure"
 			umount /cdrom 2>/dev/null || true
 			continue
 		else
@@ -102,11 +99,11 @@ do
 			modprobe $module
 		fi
 		if mount -t iso9660 -o ro,exec $device /cdrom; then
-			log "CD-ROM mount succeeded: device=$device"
+			log cdrom-detect "CD-ROM mount succeeded: device=$device"
 			mounted=1
 			break
 		else
-			log "CD-ROM mount failed: device=$device"
+			log cdrom-detect "CD-ROM mount failed: device=$device"
 			fail
 		fi
 	else
@@ -116,9 +113,9 @@ done
 
 if [ -e /cdrom/.disk/info ]; then
 	CDNAME=`cat /cdrom/.disk/info`
-	log "Detected CD '$CDNAME'"
+	log cdrom-detect "Detected CD '$CDNAME'"
 else
-	log "The available CD is not a Debian CD!"
+	log cdrom-detect "The available CD is not a Debian CD!"
 	db_input critical cdrom-detect/wrong-cd || [ $? -eq 30 ]
 	db_go
 	fail 
@@ -146,7 +143,7 @@ for dir in $(cat /etc/default-release) $(ls -1 /cdrom/dists/); do
 	if [ -e $relfile ]; then
 		suite=$(sed -n 's/^Suite: *//p' "$relfile")
 		codename=$(sed -n 's/^Codename: *//p' "$relfile")
-		log "Detected CD with '$suite' ($codename) distribution"
+		log cdrom-detect "Detected CD with '$suite' ($codename) distribution"
 		db_set cdrom/suite "$suite"
 		db_set cdrom/codename "$codename"
 
@@ -155,7 +152,7 @@ for dir in $(cat /etc/default-release) $(ls -1 /cdrom/dists/); do
 done
 
 if [ -z "$suite" ]; then
-	log "Error reading Release file; unable to determine distribution"
+	log cdrom-detect "Error reading Release file; unable to determine distribution"
 	db_input critical cdrom-detect/no-release || [ $? -eq 30 ]
 	db_go
 	fail
@@ -171,7 +168,7 @@ db_go
 
 anna-install apt-mirror-setup || true
 if [ ! -e /cdrom/.disk/base_installable ]; then
-	log "Base system not installable from CD, requesting choose-mirror"
+	log cdrom-detect "Base system not installable from CD, requesting choose-mirror"
 	anna-install choose-mirror || true
 else
 	anna-install apt-cdrom-setup || true
diff --git a/packages/cdrom-detect/finish-install b/packages/cdrom-detect/finish-install
index 028d4b0..88f0694 100755
--- a/packages/cdrom-detect/finish-install
+++ b/packages/cdrom-detect/finish-install
@@ -1,25 +1,22 @@
 #! /bin/sh -e
 
 . /usr/share/debconf/confmodule
-
-log() {
-	logger -t cdrom-detect "$@"
-}
+. /lib/output.sh
 
 # Cannot just tell eject to eject /cdrom as it is not compatible
 # with busybox umount. Instead, unmount the cdrom first, and then
 # eject the device.
 CDDEV=$(mount | grep "on /cdrom" | cut -d ' ' -f 1)
 if [ -n "$CDDEV" ]; then
-	log "Unmounting and ejecting '$CDDEV'"
+	log cdrom-detect "Unmounting and ejecting '$CDDEV'"
 	umount /cdrom || true
 
 	db_get cdrom-detect/eject
 	if [ "$RET" = false ]; then
-		log "Not ejecting CD, per debconf setting."
+		log cdrom-detect "Not ejecting CD, per debconf setting."
 	else
 		eject $CDDEV || true
 	fi
 else
-	log "Not ejecting CD, as nothing is mounted."
+	log cdrom-detect "Not ejecting CD, as nothing is mounted."
 fi
diff --git a/packages/cdrom-retriever/cdrom-retriever b/packages/cdrom-retriever/cdrom-retriever
index 089857a..89449c7 100755
--- a/packages/cdrom-retriever/cdrom-retriever
+++ b/packages/cdrom-retriever/cdrom-retriever
@@ -1,16 +1,7 @@
 #!/bin/sh
 
 . /usr/share/debconf/confmodule
-
-log() {
-	logger -t cdrom-retriever "$@"
-}
-error() {
-	log "error: $@"
-}
-warning() {
-	log "warning: $@"
-}
+. /lib/output.sh
 
 CDMNT=/cdrom
 ARCH=`udpkg --print-architecture`
@@ -34,7 +25,7 @@ case "x$cmd" in
 			ln -sf $CDMNT/$1 "$2"
 			exit $?
 		else
-			error "Unable to find '$1'."
+			error cdrom-retriever "Unable to find '$1'."
 			exit 1
 		fi
         ;;
@@ -52,7 +43,7 @@ case "x$cmd" in
 		components="`grep ^Components: $Release | cut -d' ' -f2-`"
 		ret=1
 		if [ -z "$components" ]; then
-			error "No components listed in $Release."
+			error cdrom-retriever "No components listed in $Release."
 			exit 1
 		fi
 		for comp in $components; do
@@ -60,12 +51,12 @@ case "x$cmd" in
 				pkgfile="$comp/debian-installer/binary-$ARCH/Packages$ext"
 				line=`grep $pkgfile\$ $Release 2>/dev/null`
 				if [ $? != 0 ]; then
-					warning "Unable to find $pkgfile in $Release."
+					warning cdrom-retriever "Unable to find $pkgfile in $Release."
 					continue
 				fi
 				Packages="$CDMNT/dists/$codename/$pkgfile"
 				if [ ! -e "$Packages" ]; then
-					warning "File $Packages does not exist."
+					warning cdrom-retriever "File $Packages does not exist."
 					continue
 				fi
 				# TODO: Verify the integrity
@@ -101,7 +92,7 @@ case "x$cmd" in
 	;;
 
 	*)
-		error "Unknown command '$cmd'."
+		error cdrom-retriever "Unknown command '$cmd'."
 		exit 1
 	;;
 esac
diff --git a/packages/clock-setup/debian/clock-setup.postinst b/packages/clock-setup/debian/clock-setup.postinst
index 2ead470..5fd9a08 100755
--- a/packages/clock-setup/debian/clock-setup.postinst
+++ b/packages/clock-setup/debian/clock-setup.postinst
@@ -2,10 +2,7 @@
 set -e
 
 . /usr/share/debconf/confmodule
-
-log() {
-	logger -t clock-setup "$@"
-}
+. /lib/output.sh
 
 db_input medium clock-setup/ntp || true
 if ! db_go; then
@@ -29,9 +26,9 @@ if [ "$RET" = true ]; then
 	db_progress START 0 1 clock-setup/progress/title
 	db_progress INFO clock-setup/progress/ntp
 	if ! RDATE_OUT=`log-output -t clock-setup --pass-stdout rdate -o 123 -nv "$server"`; then
-		log "rdate failed ($?)"
+		log clock-setup "rdate failed ($?)"
 	fi
-	log "$RDATE_OUT"
+	log clock-setup "$RDATE_OUT"
 	# This is commented out as it can cause a hang as described in
 	# #436497.
 	#db_progress step 1
diff --git a/packages/clock-setup/finish-install.d/10clock-setup b/packages/clock-setup/finish-install.d/10clock-setup
index f7e21e8..eb4077d 100755
--- a/packages/clock-setup/finish-install.d/10clock-setup
+++ b/packages/clock-setup/finish-install.d/10clock-setup
@@ -2,13 +2,7 @@
 set -e
 
 . /usr/share/debconf/confmodule
-
-log() {
-	logger -t clock-setup "$@"
-}
-warning() {
-	log "warning: $*"
-}
+. /lib/output.sh
 
 os_needs_local_clock () {
 	while read line; do
@@ -67,8 +61,8 @@ anna-install rtc-modules || true
 
 # This may not be necessary; hwclock can do direct IO if
 # the rtc module is not loaded.
-log-output -t hw-detect modprobe -v rtc || log "rtc module not loaded"
-log-output -t hw-detect modprobe -v rtc-dev || log "rtc-dev module not loaded"
+log-output -t hw-detect modprobe -v rtc || log clock-setup "rtc module not loaded"
+log-output -t hw-detect modprobe -v rtc-dev || log clock-setup "rtc-dev module not loaded"
 update-dev
 
 machine=$(grep "^Hardware" /proc/cpuinfo | sed 's/Hardware\s*:\s*//')
@@ -90,12 +84,12 @@ esac
 if mount -o bind /dev /target/dev; then
 	target_dev_mounted=1
 else
-	warning "failed to bind mount /target/dev"
+	warning clock-setup "failed to bind mount /target/dev"
 fi
 
 cleanup () {
 	if [ "$target_dev_mounted" ] && ! umount /target/dev; then
-		warning "failed to unmount /target/dev bind mount"
+		warning clock-setup "failed to unmount /target/dev bind mount"
 	fi
 }
 
diff --git a/packages/debian-installer-utils/anna-install b/packages/debian-installer-utils/anna-install
index 2434df2..c4e5c2f 100755
--- a/packages/debian-installer-utils/anna-install
+++ b/packages/debian-installer-utils/anna-install
@@ -1,10 +1,11 @@
 #!/bin/sh -e
 
 . /usr/share/debconf/confmodule
+. /lib/output.sh
 
 if db_get anna/retriever && [ "$RET" ]; then
 	# Install the requested modules immediately
-	logger -t anna-install "Installing $@"
+	log anna-install "Installing $@"
 	exec anna install "$@"
 fi
 
@@ -14,7 +15,7 @@ mkdir -p /var/lib/anna-install
 touch $queue
 for pkg in $@ ; do
 	if ! grep -q "^$pkg$" $queue; then
-		logger -t anna-install "Queueing udeb $pkg for later installation"
+		log anna-install "Queueing udeb $pkg for later installation"
 	        echo "$pkg" >> $queue
 	fi
 done
diff --git a/packages/debian-installer-utils/apt-install b/packages/debian-installer-utils/apt-install
index ea6ab2c..ea4825e 100755
--- a/packages/debian-installer-utils/apt-install
+++ b/packages/debian-installer-utils/apt-install
@@ -1,6 +1,7 @@
 #!/bin/sh
 set -e
 . /lib/chroot-setup.sh
+. /lib/output.sh
 
 packages=$@
 
@@ -14,7 +15,7 @@ if [ ! -e /target/etc/apt/sources.list ]; then
 	touch $queue
 	for pkg in $packages; do
 		if ! grep -q "^$pkg$" $queue; then
-			logger -t apt-install "Queueing package $pkg for later installation"
+			log apt-install "Queueing package $pkg for later installation"
 			echo "$pkg" >> $queue
 		fi
 	done
diff --git a/packages/debian-installer-utils/chroot-setup.sh b/packages/debian-installer-utils/chroot-setup.sh
index 2f97cce..2816b53 100644
--- a/packages/debian-installer-utils/chroot-setup.sh
+++ b/packages/debian-installer-utils/chroot-setup.sh
@@ -1,5 +1,6 @@
 # Setup for using apt to install packages in /target.
 
+. /lib/output.sh
 mountpoints () {
 	cut -d" " -f2 /proc/mounts | sort | uniq
 }
@@ -7,10 +8,7 @@ mountpoints () {
 chroot_setup () {
 	# Bail out if directories we need are not there
 	if [ ! -d /target/sbin ] || [ ! -d /target/usr/sbin ] || \
-	   [ ! -d /target/proc ]; then
-		return 1
-	fi
-	if [ ! -d /target/sys ] ; then
+	   [ ! -d /target/proc ] || [ ! -d /target/sys ]; then
 		return 1
 	fi
 
@@ -105,7 +103,7 @@ chroot_cleanup () {
 		     sort -r | uniq -c | grep "^[[:space:]]*1[[:space:]]" | \
 		     sed "s/^[[:space:]]*[0-9][[:space:]]//"); do
 		if ! umount $dir ; then
-			logger -t $0 "warning: Unable to umount '$dir'"
+			log $0 "warning: Unable to umount '$dir'"
 		fi
 	done
 	rm -f /tmp/mount.pre
diff --git a/packages/debian-installer-utils/debian/rules b/packages/debian-installer-utils/debian/rules
index f4a6aef..44f75ca 100755
--- a/packages/debian-installer-utils/debian/rules
+++ b/packages/debian-installer-utils/debian/rules
@@ -44,6 +44,7 @@ binary-arch: install
 			      register-module search-path update-dev \
 			      user-params in-target list-devices bin
 	dh_install -pdi-utils chroot-setup.sh lib
+	dh_install -pdi-utils ouput.sh lib
 	dh_installdirs -pdi-utils usr/lib/post-base-installer.d
 	install register-module.post-base-installer debian/di-utils/usr/lib/post-base-installer.d/10register-module
 	dh_install -pdi-utils-mapdevfs mapdevfs bin
diff --git a/packages/debian-installer-utils/in-target b/packages/debian-installer-utils/in-target
index 2850a7e..95a2e0a 100755
--- a/packages/debian-installer-utils/in-target
+++ b/packages/debian-installer-utils/in-target
@@ -1,9 +1,10 @@
 #!/bin/sh
 set -e
 . /lib/chroot-setup.sh
+. /lib/output.sh
 
 if ! chroot_setup; then
-	logger -t in-target -- "Unexpected error; command not executed: '$@'"
+	log in-target -- "Unexpected error; command not executed: '$@'"
 	exit 1
 fi
 
diff --git a/packages/debian-installer-utils/list-devices b/packages/debian-installer-utils/list-devices
index b86dea9..2b27ece 100755
--- a/packages/debian-installer-utils/list-devices
+++ b/packages/debian-installer-utils/list-devices
@@ -1,9 +1,11 @@
 #! /bin/sh -e
 TYPE="$1"
 
+. /lib/output.sh
+
 case $TYPE in
     maybe-floppy)
-	logger -t list-devices "deprecated parameter maybe-floppy"
+	log list-devices "deprecated parameter maybe-floppy"
 	TYPE=floppy
 	;;
     cd|disk|partition|floppy|maybe-usb-floppy) ;;
diff --git a/packages/debian-installer-utils/output.sh b/packages/debian-installer-utils/output.sh
new file mode 100644
index 0000000..0fe0f53
--- /dev/null
+++ b/packages/debian-installer-utils/output.sh
@@ -0,0 +1,34 @@
+log() {
+	prog=$1
+	shift 1
+	logger -t $prog "$@"
+}
+
+warning() {
+	prog=$1
+	shift 1
+	log $prog "warning: $@"
+}
+
+error() {
+	prog=$1
+	shift 1
+	log $prog "error: $@"
+}
+
+info() {
+	prog=$1
+	shift 1
+	log $prog "info: $@"
+}
+
+die() {
+	prog=$1
+	template="$2"
+	shift 2
+	error $prog "info: $@"
+	db_input critical "$template" || [ $? -eq 30 ]
+	db_go || true
+	db_progress STOP
+	exit 1
+}
diff --git a/packages/debian-installer-utils/register-module.post-base-installer b/packages/debian-installer-utils/register-module.post-base-installer
index 2efdfdf..e2c920c 100755
--- a/packages/debian-installer-utils/register-module.post-base-installer
+++ b/packages/debian-installer-utils/register-module.post-base-installer
@@ -3,6 +3,8 @@ QUEUE=/var/lib/register-module
 MODFILE=/target/etc/modules
 MODUTILSDIR=/target/etc/modprobe.d/
 
+. /lib/output.sh
+
 create () {
 	if [ ! -e $1 ]; then
 		echo "# Local module settings" > $1
@@ -50,5 +52,5 @@ for QUEUEFILE in $QUEUE/*.blacklist; do
 done
 
 if [ -x /target/sbin/update-modules ]; then
-	chroot /target update-modules < /dev/null 2>&1 | logger "register-modules"
+	chroot /target update-modules < /dev/null 2>&1 | log register-module "register-modules"
 fi
diff --git a/packages/finish-install/debian/postinst b/packages/finish-install/debian/postinst
index b452344..41abbe4 100755
--- a/packages/finish-install/debian/postinst
+++ b/packages/finish-install/debian/postinst
@@ -1,13 +1,10 @@
 #!/bin/sh
 
 . /usr/share/debconf/confmodule
+. /lib/output.sh
 
 set -e
 
-log() {
-	logger -t finish-install "$@"
-}
-
 partsdir="/usr/lib/finish-install.d"
 scriptcount=$(ls "$partsdir"/* | wc -l)
 
@@ -21,21 +18,21 @@ for script in "$partsdir"/*; do
 	fi
 
 	if [ -x "$script" ] ; then
-		log "info: Running $script"
+		log finish-install "info: Running $script"
 		# Else needed so we don't loose the exit code
 		if log-output -t finish-install "$script"; then
 			:
 		else
 			code="$?"
 			if [ "$code" = 10 ]; then
-				log "$script backed up"
+				log finish-install "$script backed up"
 				db_progress STOP
 				exit 10
 			fi
-			log "warning: $script returned error code $code"
+			log finish-install "warning: $script returned error code $code"
 		fi
 	else
-		log "error: Unable to execute $script"
+		log finish-install "error: Unable to execute $script"
 	fi
 
 	db_progress STEP 1
diff --git a/packages/finish-install/finish-install.d/90console b/packages/finish-install/finish-install.d/90console
index 6e49248..4f58e32 100755
--- a/packages/finish-install/finish-install.d/90console
+++ b/packages/finish-install/finish-install.d/90console
@@ -1,9 +1,7 @@
 #!/bin/sh
 set -e
 
-log() {
-	logger -t finish-install "$@"
-}
+. /lib/output.sh
 
 write_console() {
 	if ! grep -q "$1" "$2"; then
@@ -28,8 +26,8 @@ console=${console#/dev/}
 # Testing for hvc and hvsi here may be useless as they would normally be
 # redirected to /dev/console, which is covered by the code section below.
 case "$console" in
-    tty[A-Z]*|hvc*|hvsi*)
-	log "Configuring init for serial console"
+	tty[A-Z]*|hvc*|hvsi*)
+	log finish-install "Configuring init for serial console"
 	consoletype=${console%%[0-9]*}
 	ttyline=${console#$consoletype}
 	ttyspeed=$(chroot /target stty --file /dev/$console speed)
@@ -68,7 +66,7 @@ if [ -e $DT_ROOT/chosen/linux,stdout-path ]; then
 		    hvterm|hvterm1)
 			console=hvc0 ;;
 		    *)
-			log "Unable to determine type of virtualized console"
+			log finish-install "Unable to determine type of virtualized console"
 			exit 1
 			;;
 		esac
@@ -81,7 +79,7 @@ if [ -e $DT_ROOT/chosen/linux,stdout-path ]; then
 		exit 0 ;;
 	esac
 
-	log "Setting up virtualized serial console on /dev/$console"
+	log finish-install "Setting up virtualized serial console on /dev/$console"
 	if [ -f /target/etc/inittab ]; then
 		# Disable regular VTs
 		sed -i -e "s/^\([1-6]\):/#\1:/" /target/etc/inittab
diff --git a/packages/flash-kernel/debian/flash-kernel-installer.postinst b/packages/flash-kernel/debian/flash-kernel-installer.postinst
index e108417..dcb3127 100755
--- a/packages/flash-kernel/debian/flash-kernel-installer.postinst
+++ b/packages/flash-kernel/debian/flash-kernel-installer.postinst
@@ -2,14 +2,7 @@
 set -e
 
 . /usr/share/debconf/confmodule
-
-log() {
-	logger -t flash-kernel-installer "$@"
-}
-
-error() {
-	log "error: $@"
-}
+. /lib/output.sh
 
 db_progress START 0 2 flash-kernel-installer/progress
 db_progress INFO flash-kernel-installer/prepare
@@ -17,7 +10,7 @@ db_progress INFO flash-kernel-installer/prepare
 apt-install initramfs-tools || true # probably already installed; make sure
 
 if ! apt-install flash-kernel; then
-	error "apt-install flash-kernel failed"
+	error flash-kernel-installer "apt-install flash-kernel failed"
 	exit 1
 fi
 
@@ -32,7 +25,7 @@ case "$machine" in
 	"Linksys NSLU2")
 		for i in NPE-A NPE-B NPE-C; do
 			if [ -e /lib/firmware/$i ]; then
-				log "Installing microcode $i"
+				log flash-kernel-installer "Installing microcode $i"
 				file=$(basename $(readlink /lib/firmware/$i))
 				cp -f /lib/firmware/$file /target/lib/firmware/
 				ln -sf $file /target/lib/firmware/$i
@@ -49,15 +42,15 @@ case "$machine" in
 			cp -af $file /target/$file
 		done
 		if [ $ixp400_found -gt 0 ]; then
-			log "copied ixp400 driver to /target"
+			log flash-kernel-installer "copied ixp400 driver to /target"
 			chroot /target depmod -a || true
 		fi
 		if ! apt-install nslu2-utils; then
-			error "apt-install nslu2-utils failed"
+			error flash-kernel-installer "apt-install nslu2-utils failed"
 			exit 1
 		fi
 		if ! apt-install apex-nslu2; then
-			error "apt-install apex-nslu2 failed"
+			error flash-kernel-installer "apt-install apex-nslu2 failed"
 			exit 1
 		fi
 	;;
@@ -73,7 +66,7 @@ db_progress INFO flash-kernel-installer/flashing
 mount -o bind /dev /target/dev
 if ! in-target flash-kernel; then
 	umount /target/dev || true
-	error "flash-kernel failed"
+	error flash-kernel-installer "flash-kernel failed"
 	exit 1
 fi
 umount /target/dev || true
diff --git a/packages/floppy-retriever/debian/load-floppy.postinst b/packages/floppy-retriever/debian/load-floppy.postinst
index 3d7e1da..a347b09 100755
--- a/packages/floppy-retriever/debian/load-floppy.postinst
+++ b/packages/floppy-retriever/debian/load-floppy.postinst
@@ -2,13 +2,7 @@
 set -e
 
 . /usr/share/debconf/confmodule
-
-log() {
-	logger -t load-floppy "$@"
-}
-warning() {
-	log "warning: $@"
-}
+. /lib/output.sh
 
 FLOPPYMNT=/floppy
 
@@ -56,7 +50,7 @@ while true; do
 		   [ "$disk_type" != "$old_disk_type" ]; then
 			# BEGIN WITH DISK1
 			disk_name_1=$(echo $disk_name | sed "s/[0-9]$/1/")
-			warning "Loading $disk_name instead of $disk_name_1"
+			warning load-floppy "Loading $disk_name instead of $disk_name_1"
 			db_subst $W DISK_LABEL "$disk_type 1"
 			db_subst $W DISK_NAME "$disk_name_1"
 			db_input critical $W || true
@@ -72,7 +66,7 @@ while true; do
 		fi
 	else
 		# UNKNOWN FLOPPY
-		warning "Unknown floppy present"
+		warning load-floppy "Unknown floppy present"
 		db_set $U false || true
 		db_input critical $U || true
 		db_go
diff --git a/packages/hw-detect/disk-detect.sh b/packages/hw-detect/disk-detect.sh
index 325cf4b..e0b5275 100755
--- a/packages/hw-detect/disk-detect.sh
+++ b/packages/hw-detect/disk-detect.sh
@@ -2,6 +2,7 @@
 
 set -e
 . /usr/share/debconf/confmodule
+. /lib/output.sh
 #set -x
 
 if [ "$(uname)" != Linux ]; then
@@ -154,15 +155,15 @@ if [ "$RET" = true ]; then
 		fi
 
 		if [ "$(dmraid -c -s)" != "No RAID disks" ]; then
-			logger -t disk-detect "Serial ATA RAID disk(s) detected; enabling dmraid support"
+			log disk-detect "Serial ATA RAID disk(s) detected; enabling dmraid support"
 			if anna-install partman-dmraid; then
 				# Activate devices
 				log-output -t disk-detect dmraid -ay
 			else
-				logger -t disk-detect "Error loading partman-dmraid; dmraid devices not activated"
+				log disk-detect "Error loading partman-dmraid; dmraid devices not activated"
 			fi
 		else
-			logger -t disk-detect "No Serial ATA RAID disks detected"
+			log disk-detect "No Serial ATA RAID disks detected"
 		fi
 	fi
 fi
diff --git a/packages/hw-detect/hotplug-pcmcia.sh b/packages/hw-detect/hotplug-pcmcia.sh
index e528156..469ac49 100755
--- a/packages/hw-detect/hotplug-pcmcia.sh
+++ b/packages/hw-detect/hotplug-pcmcia.sh
@@ -3,35 +3,33 @@
 # hotplug-pcmcia.sh - Handle hotplug events for PCMCIA devices during detection
 #
 
-log () {
-	logger -t hotplug-pcmcia "$@"
-}
-
 TYPE="$1"
 
+. /lib/output.sh
+
 case $TYPE in
     net)
 	if [ "$INTERFACE" = "" ]; then
-		log "Got net event without interface"
+		log hotplug-pcmcia "Got net event without interface"
 		exit 1
 	fi
 
-	log "Detected PCMCIA network interface $INTERFACE"
+	log hotplug-pcmcia "Detected PCMCIA network interface $INTERFACE"
 	echo $INTERFACE >>/etc/network/devhotplug
 	;;
 
     # PCI hotplugging is deprecated (2.4 kernels only)
     pci)
-	log "PCI event is deprecated."
+	log hotplug-pcmcia "PCI event is deprecated."
 	exit 1
 	;;
 
     pcmcia_socket)
-	log "Got pcmcia_socket event"
+	log hotplug-pcmcia "Got pcmcia_socket event"
 	;;
 	
     *)
-	log "Got unsupported event type \"$TYPE\""
+	log hotplug-pcmcia "Got unsupported event type \"$TYPE\""
 	exit 1
 	;;
 esac
diff --git a/packages/hw-detect/hw-detect.sh b/packages/hw-detect/hw-detect.sh
index 3ba95b0..1ea57d3 100755
--- a/packages/hw-detect/hw-detect.sh
+++ b/packages/hw-detect/hw-detect.sh
@@ -2,6 +2,7 @@
 
 set -e
 . /usr/share/debconf/confmodule
+. /lib/output.sh
 #set -x
 
 if [ -z "$1" ]; then
@@ -26,10 +27,6 @@ if [ -x /sbin/depmod ]; then
 	depmod -a > /dev/null 2>&1 || true
 fi
 
-log () {
-	logger -t hw-detect "$@"
-}
-
 is_not_loaded() {
 	! ((cut -d" " -f1 /proc/modules | grep -q "^$1\$") || \
 	   (cut -d" " -f1 /proc/modules | sed -e 's/_/-/g' | grep -q "^$1\$"))
@@ -92,7 +89,7 @@ load_module() {
 		fi
 		IFS="$IFS_SAVE"
 	else   
-		log "Error loading '$module'"
+		log hw-detect "Error loading '$module'"
 		if [ "$module" != floppy ] && [ "$module" != ide-floppy ] && \
 		   [ "$module" != ide-cd ]; then
 			db_subst hw-detect/modprobe_error CMD_LINE_PARAM "modprobe -v $module"
@@ -191,7 +188,7 @@ if [ -d /sys/bus/pci/devices ] && \
 	db_subst hw-detect/load_progress_step MODULE "yenta_socket"
 	db_progress INFO hw-detect/load_progress_step
 	
-	log "Detected Cardbus bridge, loading yenta_socket"
+	log hw-detect "Detected Cardbus bridge, loading yenta_socket"
 	load_module yenta_socket
 	# Ugly hack, but what's the alternative?
 	sleep 3 || true
@@ -266,7 +263,7 @@ for device in $(list_to_lines); do
 	if [ -z "$module" ] ; then module="[Unknown]" ; fi
 	if [ -z "$cardname" ] ; then cardname="[Unknown]" ; fi
 
-	log "Detected module '$module' for '$cardname'"
+	log hw-detect "Detected module '$module' for '$cardname'"
 
 	if is_not_loaded "$module"; then
 		db_subst hw-detect/load_progress_step CARDNAME "$cardname"
@@ -380,7 +377,7 @@ if [ "$PCMCIA_INIT" ]; then
 	fi
 	if db_go && db_get hw-detect/start_pcmcia && [ "$RET" = true ]; then
 		db_progress INFO hw-detect/pcmcia_step
-		$PCMCIA_INIT start 2>&1 | log
+		$PCMCIA_INIT start 2>&1 | log hw-detect
 		db_progress STEP $OTHER_STEPSIZE
 	fi
 fi
@@ -415,7 +412,7 @@ fi
 # Try to do this only once..
 if [ "$have_pcmcia" -eq 1 ] && \
    ! grep -q pcmciautils /var/lib/apt-install/queue 2>/dev/null; then
-	log "Detected PCMCIA, installing pcmciautils."
+	log hw-detect "Detected PCMCIA, installing pcmciautils."
 	apt-install pcmciautils || true
 
 	if db_get hw-detect/pcmcia_resources && [ -n "$RET" ]; then
@@ -477,7 +474,7 @@ db_progress SET $MAX_STEPS
 db_progress STOP
 
 if [ -n "$MISSING_MODULES_LIST" ]; then
-	log "Missing modules '$MISSING_MODULES_LIST"
+	log hw-detect "Missing modules '$MISSING_MODULES_LIST"
 fi
 
 sysfs-update-devnames
diff --git a/packages/hw-detect/net-hotplug.sh b/packages/hw-detect/net-hotplug.sh
index 1005253..7a98564 100755
--- a/packages/hw-detect/net-hotplug.sh
+++ b/packages/hw-detect/net-hotplug.sh
@@ -3,18 +3,16 @@
 # Hook into net events so that we can record hotpluggable interfaces for
 # netcfg.
 
-log () {
-	logger -t net/hw-detect.hotplug "$@"
-}
+. /lib/output.sh
 
 if [ -z "$INTERFACE" ]; then
-	log "Got net event without interface"
+	log net/hw-detect.hotplug "Got net event without interface"
 	exit 1
 fi
 
 case $ACTION in
     add|register)
-	log "Detected hotpluggable network interface $INTERFACE"
+	log net/hw-detect.hotplug "Detected hotpluggable network interface $INTERFACE"
 	mkdir -p /etc/network
 	echo "$INTERFACE" >>/etc/network/devhotplug
 	;;
diff --git a/packages/installation-report/httpd b/packages/installation-report/httpd
index 5896987..f276444 100755
--- a/packages/installation-report/httpd
+++ b/packages/installation-report/httpd
@@ -3,10 +3,6 @@
 PORT=80
 DOCROOT=/var/log
 
-log () {
-	logger -t httpd "$@"
-}
-
 run_nc () {
 	nc -p $PORT -l -e $1 </dev/null >/dev/null 2>/dev/null &
 }
diff --git a/packages/iso-scan/debian/iso-scan.postinst b/packages/iso-scan/debian/iso-scan.postinst
index 55a3ebd..448b66e 100755
--- a/packages/iso-scan/debian/iso-scan.postinst
+++ b/packages/iso-scan/debian/iso-scan.postinst
@@ -1,5 +1,6 @@
 #!/bin/sh
 . /usr/share/debconf/confmodule
+. /lib/output.sh
 set -e
 
 ISO_COUNT=0
@@ -7,10 +8,6 @@ ISO_MOUNT_COUNT=0
 MOUNTABLE_DEVS_COUNT=0
 TOPLEVEL_DIRS_COUNT=0
 
-log () {
-    logger -t iso-scan "$@"
-}
-
 mount_device () {
 	dev_to_mount=$1
 	db_subst iso-scan/progress_mount DRIVE $dev_to_mount
@@ -36,7 +33,7 @@ register_cd () {
 	   	then
 			suite=$(sed -n 's/^Suite: *//p' $relfile)
 			codename=$(sed -n 's/^Codename: *//p' $relfile)
-			log "Detected ISO with '$suite' ($codename) distribution"
+			log iso-scan "Detected ISO with '$suite' ($codename) distribution"
 			db_set cdrom/suite $suite
 			db_set cdrom/codename $codename
 			db_subst iso-scan/success SUITE $suite
@@ -72,21 +69,21 @@ try_iso () {
 	
 				anna-install apt-mirror-setup || true
 				if [ ! -e /cdrom/.disk/base_installable ]; then
-					log "Base system not installable from CD image, requesting choose-mirror"
+					log iso-scan "Base system not installable from CD image, requesting choose-mirror"
 					anna-install choose-mirror || true
 				else
 					anna-install apt-cdrom-setup || true
 				fi
 				exit 0
 			else
-				log "Debian ISO not usable, skipping"
+				log iso-scan "Debian ISO not usable, skipping"
 			fi
 		else
-			log "Not a Debian ISO"
+			log iso-scan "Not a Debian ISO"
 			umount /cdrom
 		fi
 	else
-		log "Failed mounting $iso_to_try"
+		log iso-scan "Failed mounting $iso_to_try"
 	fi
 }
 
@@ -107,7 +104,7 @@ modprobe loop >/dev/null || true
 mkdir /cdrom 2>/dev/null || true
 mkdir /hd-media 2>/dev/null || true
 
-log "First pass: Look for ISOs near top-level of each filesystem."
+log iso-scan "First pass: Look for ISOs near top-level of each filesystem."
 DEVS="$(list-devices disk; list-devices partition; list-devices maybe-usb-floppy)"
 # Repeat twice if necessary, to accomodate devices that need some
 # time to initialise, like USB devices.
@@ -121,7 +118,7 @@ for i in 1 2; do
 
 	for dev in $DEVS; do
 		if ! mount_device $dev; then
-			log "Waiting for $dev to possibly get ready.."
+			log iso-scan "Waiting for $dev to possibly get ready.."
 			sleep 3
 			if ! mount_device $dev; then
 				continue
@@ -129,7 +126,7 @@ for i in 1 2; do
 		fi
 
 		db_subst iso-scan/progress_scan DRIVE $dev
-		log "Mounted $dev for first pass"
+		log iso-scan "Mounted $dev for first pass"
 		MOUNTABLE_DEVS="$MOUNTABLE_DEVS $dev"
 		MOUNTABLE_DEVS_COUNT=$(expr $MOUNTABLE_DEVS_COUNT + 1)
 		cd /hd-media
@@ -142,7 +139,7 @@ for i in 1 2; do
 				db_progress INFO iso-scan/progress_scan
 				for iso in $dir/*.iso $dir/*.ISO; do
 					if [ -e $iso ]; then
-						log "Found ISO $iso on $dev"
+						log iso-scan "Found ISO $iso on $dev"
 						ISO_COUNT=$(expr $ISO_COUNT + 1)
 						try_iso $iso $dev
 					fi
@@ -183,19 +180,19 @@ if [ "$MOUNTABLE_DEVS_COUNT" != 0 ]; then
 	db_get iso-scan/ask_second_pass
 	if [ "$RET" = true ]; then
 		db_progress START 0 $TOPLEVEL_DIRS_COUNT iso-scan/progress_title
-		log "Second pass: Search whole filesystems for ISOs."
+		log iso-scan "Second pass: Search whole filesystems for ISOs."
 		# To save time, only ones we mounted successfully before.
 		for dev in $MOUNTABLE_DEVS; do
 			if mount_device $dev; then
 				db_subst iso-scan/progress_scan DRIVE $dev
-				log "Mounted $dev for second pass"
+				log iso-scan "Mounted $dev for second pass"
 				cd /hd-media
 				for dir in *; do
 					if [ -d "$dir" ]; then
 						db_subst iso-scan/progress_scan DIRECTORY "$dir/"
 						db_progress INFO iso-scan/progress_scan
 						for iso in $(find $dir 2>/dev/null | grep -i '\.iso$'); do
-							log "Found ISO $iso on $dev"
+							log iso-scan "Found ISO $iso on $dev"
 							ISO_COUNT=$(expr $ISO_COUNT + 1)
 							try_iso $iso $dev
 						done
@@ -222,5 +219,5 @@ else
 	db_input critical iso-scan/other-isos || true
 fi
 db_go || true
-log "Failing with ISO_COUNT = $ISO_COUNT, MOUNTABLE_DEVS_COUNT = $MOUNTABLE_DEVS_COUNT, ISO_MOUNT_COUNT = $ISO_MOUNT_COUNT"
+log iso-scan "Failing with ISO_COUNT = $ISO_COUNT, MOUNTABLE_DEVS_COUNT = $MOUNTABLE_DEVS_COUNT, ISO_MOUNT_COUNT = $ISO_MOUNT_COUNT"
 exit 1
diff --git a/packages/kickseed/cmdline.sh b/packages/kickseed/cmdline.sh
index 6d5ffaa..b4b6eb0 100644
--- a/packages/kickseed/cmdline.sh
+++ b/packages/kickseed/cmdline.sh
@@ -1,5 +1,6 @@
 #! /bin/sh
 
+. /lib/output.sh
 if [ -z "$SPOOL" ]; then
 	SPOOL=/var/spool/kickseed
 fi
@@ -59,7 +60,7 @@ kickseed_file () {
 			echo "$spoolpath"
 			;;
 		*)
-			logger -t kickseed "Kickstart location $1 not supported"
+			log kickseed "Kickstart location $1 not supported"
 			;;
 	esac
 }
diff --git a/packages/kickseed/finish-install.d/01kickseed b/packages/kickseed/finish-install.d/01kickseed
index ceca5a9..ff0e68e 100755
--- a/packages/kickseed/finish-install.d/01kickseed
+++ b/packages/kickseed/finish-install.d/01kickseed
@@ -1,10 +1,7 @@
 #! /bin/sh -e
 
 . /lib/kickseed/kickseed.sh
-
-ks_log () {
-	logger -t kickseed "$@"
-}
+. /lib/output.sh
 
 ks_run_script () {
 	TYPE="$1"
@@ -20,7 +17,7 @@ ks_run_script () {
 		root=
 	fi
 
-	logger -t kickseed "Running $TYPE script $SCRIPT using interpreter $INTERPRETER (chrooted: $CHROOTED):"
+	log 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 \
diff --git a/packages/kickseed/handlers/clearpart.sh b/packages/kickseed/handlers/clearpart.sh
index c4a324f..90defcf 100644
--- a/packages/kickseed/handlers/clearpart.sh
+++ b/packages/kickseed/handlers/clearpart.sh
@@ -1,5 +1,6 @@
 #! /bin/sh
 
+. /lib/output.sh
 clearpart_handler () {
 	eval set -- "$(getopt -o '' -l linux,all,drives:,initlabel -- "$@")" || { warn_getopt clearpart; return; }
 	while :; do
@@ -9,7 +10,7 @@ clearpart_handler () {
 				shift
 				;;
 			--all)
-				ks_log "can't clear multiple drives; assuming just the first one"
+				log kickseed "can't clear multiple drives; assuming just the first one"
 				# needed as of partman-auto 55
 				ks_preseed d-i partman-auto/method string regular
 				# TODO: I bet this isn't safe for installs
@@ -34,7 +35,7 @@ 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'"
+	log kickseed "Clearing first disk ($FIRSTDISK) for Kickstart 'clearpart --all'"
 	db_set partman-auto/disk "$FIRSTDISK"
 fi
 
diff --git a/packages/kickseed/initrd-kickseed b/packages/kickseed/initrd-kickseed
index 24e374e..9e37f00 100755
--- a/packages/kickseed/initrd-kickseed
+++ b/packages/kickseed/initrd-kickseed
@@ -5,10 +5,7 @@
 . /lib/kickseed/kickseed.sh
 . /lib/kickseed/cmdline.sh
 . /lib/preseed/preseed.sh
-
-ks_log () {
-	logger -t kickseed "$@"
-}
+. /lib/output.sh
 
 ks_preseed () {
 	echo "$@" >> "$SPOOL/parse/preseed.cfg"
@@ -21,7 +18,7 @@ ks_run_script () {
 	INTERPRETER="$2"
 	SCRIPT="$4"
 
-	logger -t kickseed "Running $TYPE script $SCRIPT using interpreter $INTERPRETER:"
+	log kickseed "Running $TYPE script $SCRIPT using interpreter $INTERPRETER:"
 	log-output -t kickseed --pass-stdout "$INTERPRETER" "$SCRIPT"
 }
 
@@ -56,7 +53,7 @@ fetch_url () {
 		if FETCH_ERROR="$(wget -q "$url" -O "$file" 2>&1)"; then
 			return 0
 		fi
-		echo "$FETCH_ERROR" | logger -t kickseed
+		echo "$FETCH_ERROR" | log kickseed
 		iters=$(($iters + 1))
 	done
 	return 1
@@ -67,9 +64,9 @@ KSCFG="$(kickseed_file "$KS")"
 
 case $KS in
 	ftp://*/*|http://*/*)
-		logger -t kickseed "Downloading kickstart file from $KS"
+		log kickseed "Downloading kickstart file from $KS"
 		if ! fetch_url "$KS" "$KSCFG"; then
-			logger -t kickseed "... failed"
+			log kickseed "... failed"
 			db_subst initrd-kickseed/wget-failed URL "$KS"
 			db_subst initrd-kickseed/wget-failed \
 				ERROR "$FETCH_ERROR"
@@ -79,13 +76,13 @@ case $KS in
 		fi
 		;;
 	nfs:*:/*)
-		logger -t kickseed "Retrieving kickstart file from $KS"
+		log 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"
+			log kickseed "... failed"
 			db_subst initrd-kickseed/nfs-mount-failed \
 				DIR "${file%/*}"
 			db_subst initrd-kickseed/nfs-mount-failed \
@@ -121,7 +118,7 @@ case $KSCFG in
 		# not handled in initrd (yet?)
 		: ;;
 	*)
-		logger -t kickseed "Reading kickstart file from $KSCFG"
+		log kickseed "Reading kickstart file from $KSCFG"
 
 		kickseed "$KSCFG"
 
diff --git a/packages/kickseed/kickseed-anna b/packages/kickseed/kickseed-anna
index 932de4a..b99facf 100755
--- a/packages/kickseed/kickseed-anna
+++ b/packages/kickseed/kickseed-anna
@@ -1,6 +1,7 @@
 #! /bin/sh
 
 . /usr/share/debconf/confmodule
+. /lib/output.sh
 
 # Back up anna's state.
 standard_modules_backup=true
@@ -41,7 +42,7 @@ elif [ -x /var/lib/dpkg/info/load-iso.postinst ]; then
 elif [ -x /var/lib/dpkg/info/load-floppy.postinst ]; then
 	/var/lib/dpkg/info/load-floppy.postinst configure
 else
-	logger -t kickseed "No supported retriever found!"
+	log kickseed "No supported retriever found!"
 	exit 1
 fi
 
diff --git a/packages/kickseed/kickseed-udpkg b/packages/kickseed/kickseed-udpkg
index 370d964..a143db1 100755
--- a/packages/kickseed/kickseed-udpkg
+++ b/packages/kickseed/kickseed-udpkg
@@ -1,5 +1,6 @@
 #! /bin/sh
 # Configure a single package earlier than usual.
 
+. /lib/output.sh
 export UDPKG_QUIET=y
-udpkg --force-configure --configure "$1" 2>&1 | logger -t kickseed
+udpkg --force-configure --configure "$1" 2>&1 | log kickseed
diff --git a/packages/kickseed/setup/cdrom b/packages/kickseed/setup/cdrom
index ecf5fdc..5695fb5 100755
--- a/packages/kickseed/setup/cdrom
+++ b/packages/kickseed/setup/cdrom
@@ -4,6 +4,7 @@
 
 # without this, debconf clients will talk debconf protocol to syslog
 . /usr/share/debconf/confmodule
+. /lib/output.sh
 
 if [ ! -x /var/lib/dpkg/info/cdrom-detect.postinst ]; then
 	/lib/kickseed/kickseed-anna cdrom-detect
@@ -12,7 +13,7 @@ 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"
+	log kickseed "cdrom-detect cannot be installed"
 	exit 1
 fi
 
diff --git a/packages/kickseed/setup/hd b/packages/kickseed/setup/hd
index 629c692..7e4c3ad 100755
--- a/packages/kickseed/setup/hd
+++ b/packages/kickseed/setup/hd
@@ -4,6 +4,7 @@
 
 # without this, debconf clients will talk debconf protocol to syslog
 . /usr/share/debconf/confmodule
+. /lib/output.sh
 
 PACKAGES='ext2-modules vfat-modules fs-core-modules fs-secondary-modules'
 if [ ! -x /var/lib/dpkg/info/disk-detect.postinst ]; then
@@ -15,7 +16,7 @@ fi
 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"
+	log kickseed "disk-detect cannot be installed"
 	exit 1
 fi
 
diff --git a/packages/kickseed/setup/net b/packages/kickseed/setup/net
index 9869a57..9ecc6bb 100755
--- a/packages/kickseed/setup/net
+++ b/packages/kickseed/setup/net
@@ -6,6 +6,7 @@
 . /usr/share/debconf/confmodule
 
 . /lib/kickseed/cmdline.sh
+. /lib/output.sh
 
 EXTRA_UDEBS="$@"
 
@@ -17,7 +18,7 @@ fi
 if [ -x /var/lib/dpkg/info/ethdetect.postinst ]; then
 	/lib/kickseed/kickseed-udpkg ethdetect
 else
-	logger -t kickseed "ethdetect cannot be installed"
+	log kickseed "ethdetect cannot be installed"
 	exit 1
 fi
 
@@ -38,7 +39,7 @@ if [ -x /var/lib/dpkg/info/netcfg.postinst ]; then
 	if [ -z "$KSDEVICE" ] || [ "$KSDEVICE" = link ]; then
 		KSDEVICE=auto
 	elif [ "$KSDEVICE" = bootif ]; then
-		logger -t kickseed "ksdevice=bootif not supported yet; defaulting to first available interface"
+		log kickseed "ksdevice=bootif not supported yet; defaulting to first available interface"
 		KSDEVICE=auto
 	fi
 	set_question netcfg/choose_interface "$KSDEVICE"
@@ -49,5 +50,5 @@ if [ -x /var/lib/dpkg/info/netcfg.postinst ]; then
 
 	# 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
+	/var/lib/dpkg/info/netcfg.postinst configure 2>&1 | log netcfg
 fi
diff --git a/packages/localechooser/localechooser b/packages/localechooser/localechooser
index 9433e9a..1e1674c 100755
--- a/packages/localechooser/localechooser
+++ b/packages/localechooser/localechooser
@@ -2,6 +2,7 @@
 set -e
 
 . /usr/share/debconf/confmodule
+. /lib/output.sh
 
 db_capb backup
 
@@ -24,16 +25,6 @@ SUPPORTEDLOCALES=/etc/SUPPORTED-short
 SHORTLISTS=/etc/shortlists
 LANGUAGELISTFILE=/usr/share/localechooser/languagelist
 
-error() {
-	logger -t localechooser "error: $@"
-	exit 1
-}
-
-log() {
-	logger -t localechooser "info: $@"
-}
-
-
 code2country() {
 	if [ -z "$1" ]; then
 		echo
@@ -54,7 +45,7 @@ code2country() {
 		# country2code.
 		echo $line | cut -b 4-
 	else
-		error "Missing argument"
+		error localechooser "Missing argument"
 	fi
 }
 
@@ -105,7 +96,7 @@ locale2countrycode() {
 			echo
 		fi
 	else
-		error "Missing argument"
+		error localechooser "Missing argument"
 	fi
 }
 
@@ -117,13 +108,13 @@ locale2langcode() {
 			echo
 		fi
 	else
-		error "Missing argument"
+		error localechooser "Missing argument"
 	fi
 }
 
 do_preseed() {
 	LOCALE="$1"
-	log "Locale has been preseeded to $LOCALE"
+	log localechooser "Locale has been preseeded to $LOCALE"
 
 	# Only mark variables seen if this one was preseeded seen.
 	db_fget $localecode seen
@@ -136,7 +127,7 @@ do_preseed() {
 	LANGNAME=$(locale2langname "$LOCALE")
 	if [ -n "$LANGNAME" ]; then
 		db_set $langname_template $LANGNAME
-		log "Set $langname_template = '$LANGNAME'"
+		log localechooser "Set $langname_template = '$LANGNAME'"
 		db_fset $langname_template seen $seenflag || true
 		COUNTRY=$(locale2countrycode "$LOCALE")
 		if [ -n "$COUNTRY" ]; then
@@ -148,14 +139,14 @@ do_preseed() {
 			fi
 			if [ "$SL" ]; then
 				db_set $shortlist-$SL "$COUNTRY"
-				log "Set $shortlist-$SL = '$COUNTRY'"
+				log localechooser "Set $shortlist-$SL = '$COUNTRY'"
 				db_fset $shortlist-$SL seen $seenflag || true
 			fi
 			db_fset $fulllist seen $seenflag || true
 			if grep -q "^$LOCALE$" $SUPPORTEDLOCALES ; then
 				db_set $localecode $LOCALE
 				db_fset $localecode seen $seenflag || true
-				log "Set $localecode = '$LOCALE'"
+				log localechooser "Set $localecode = '$LOCALE'"
 			else
 				# The locale was invalid, empty it
 				LOCALE=""
@@ -256,27 +247,27 @@ if db_go; then
 		. languagemap
 		if [ -z "$LANGUAGELIST" ]; then
 			db_set "$languagecode" "$LANGUAGE"
-			log "Set $languagecode = '$LANGUAGE'"
+			log localechooser "Set $languagecode = '$LANGUAGE'"
 			LANGUAGELIST="$LANGUAGE"
 		else
 			db_set "$languagecode" "$LANGUAGELIST"
-			log "Set $languagecode = '$LANGUAGELIST'"
+			log localechooser "Set $languagecode = '$LANGUAGELIST'"
 		fi
 		db_set "$localecode"   "$LOCALE"
-		log "Set $localecode = '$LOCALE'"
+		log localechooser "Set $localecode = '$LOCALE'"
 		db_set "$fallbacklocalecode"   "$FALLBACKLOCALE"
-		log "Set $fallbacklocalecode = '$FALLBACKLOCALE'"
+		log localechooser "Set $fallbacklocalecode = '$FALLBACKLOCALE'"
 		if [ -n "$COUNTRY" ]; then
 			db_set "$countrycode"  "$COUNTRY"
-			log "Set $countrycode = '$COUNTRY'"
+			log localechooser "Set $countrycode = '$COUNTRY'"
 		else
 			if db_get "$countrycode" && [ "$RET" ]; then
 				COUNTRY="$RET"
 			fi
-			log "No default country; preserving current value '$COUNTRY'"
+			log localechooser "No default country; preserving current value '$COUNTRY'"
 		fi
 		db_set "$consoledisplay"  "$CONSOLE"
-		log "Set $consoledisplay = '$CONSOLE'"
+		log localechooser "Set $consoledisplay = '$CONSOLE'"
 	else
 		# Error, not sure how to handle it
 		:
@@ -293,7 +284,7 @@ if [ "$X_INSTALLATION_MEDIUM" = "floppy" ] && [ $LANGUAGE != en ]; then
 fi
 
 db_set "debconf/language" "$LANGUAGELIST"
-log "Set debconf/language = '$LANGUAGELIST'"
+log localechooser "Set debconf/language = '$LANGUAGELIST'"
 
 # Install specific packages depending on selected language   
 # Those we install here are those required immediately
@@ -399,7 +390,7 @@ while [ "$STATE" != 0 ] && [ "$STATE" -le "$LASTSTATE" ]; do
 			if [ "$DEFAULT_COUNTRY" ]; then
 				# Set correct default
 				db_set $fulllist "$DEFAULT_COUNTRY"
-				log "Set $fulllist = '$DEFAULT_COUNTRY'"
+				log localechooser "Set $fulllist = '$DEFAULT_COUNTRY'"
 			fi
 		fi
 
@@ -429,7 +420,7 @@ if [ "$STATE" = 0 ]; then
 	exit 10 # back out to main menu
 fi
 db_set "$countrycode"  "$COUNTRYCODE"
-log "Set $countrycode = '$COUNTRYCODE'"
+log localechooser "Set $countrycode = '$COUNTRYCODE'"
 
 
 # DETERMINE DEFAULT LOCALE
@@ -485,13 +476,13 @@ if [ "$LOCALE" != "C" ]; then
 		else
 			LOCALE=$(echo $FALLBACKLOCALE | sed -e 's/[.@].*$//')
 		fi
-		log "Falling back to locale '$LOCALE'"
+		log localechooser "Falling back to locale '$LOCALE'"
 	fi
 fi
 
 # Set the locale.
 db_set "$localecode" "$LOCALE"
-log "Set $localecode = '$LOCALE'"
+log localechooser "Set $localecode = '$LOCALE'"
 
 # The code below adds lang_COUNTRY at the beginning of the language
 # list we got from languagechooser
@@ -502,7 +493,7 @@ if [ "$COUNTRYCODE" != "$COUNTRYCODE_LANGUAGECHOOSER" ] && \
    [ "$LOCALE" != "C" ] && [ "$LANGUAGELIST" != "$LANGUAGE" ]; then
 	LANGUAGELIST=${LANGUAGE}_${COUNTRYCODE}:$LANGUAGELIST
 	db_set "$languagecode" "$LANGUAGELIST"
-	log "Set $languagecode = '$LANGUAGELIST'"
+	log localechooser "Set $languagecode = '$LANGUAGELIST'"
 fi
 
 
diff --git a/packages/lowmem/debian-installer-startup.d/S15lowmem b/packages/lowmem/debian-installer-startup.d/S15lowmem
index 22e1cac..517407b 100644
--- a/packages/lowmem/debian-installer-startup.d/S15lowmem
+++ b/packages/lowmem/debian-installer-startup.d/S15lowmem
@@ -1,5 +1,6 @@
 #!/bin/sh
 
+. /lib/output.sh
 ram=$(grep ^MemTotal: /proc/meminfo | { read x y z; echo $y; }) || true # in kilobytes
 
 if [ -z "$ram" ]; then
@@ -79,12 +80,12 @@ else
 	user_level=$(grep "lowmem=[12]" /proc/cmdline | \
 			sed "s/^.*lowmem=\([0-9]*\).*$/\1/")
 	if [ "$user_level" ] && [ $user_level -gt $use_level ]; then
-		logger -t lowmem "Using $user_level instead of default level $use_level"
+		log lowmem "Using $user_level instead of default level $use_level"
 		use_level=$user_level
 	fi
 
 	if [ $use_level -gt 0 ]; then
-		logger -t lowmem "Entering low memory mode"
+		log lowmem "Entering low memory mode"
 
 		if [ $use_level -lt 9 ]; then
 			echo $use_level > /var/lib/lowmem
diff --git a/packages/mdcfg/mdcfg.sh b/packages/mdcfg/mdcfg.sh
index 8e89594..771bbe0 100755
--- a/packages/mdcfg/mdcfg.sh
+++ b/packages/mdcfg/mdcfg.sh
@@ -2,6 +2,7 @@
 
 ### Magic debconf stuff :-) ###
 . /usr/share/debconf/confmodule
+. /lib/output.sh
 
 ### Functions ###
 md_get_devices() {
@@ -34,7 +35,7 @@ md_delete_verify() {
 			# Stop the MD device, and zero the superblock
 			# of all the component devices
       DEVICES=`mdadm -Q --detail /dev/md/${NUMBER} | grep "\(active\|spare\)" | sed -e 's/.* //'`
-			logger -t mdcfg "Removing /dev/md/$NUMBER ($DEVICES)"
+			log mdcfg "Removing /dev/md/$NUMBER ($DEVICES)"
 			log-output -t mdcfg mdadm --stop /dev/md/${NUMBER} || return 1
 			for DEV in "$DEVICES"; do
 				log-output -t mdcfg \
@@ -183,7 +184,7 @@ md_create_raid0() {
 		let MD_NUM++
 	fi
 
-	logger -t mdcfg "Number of devices in the RAID0 array md${MD_NUM}: ${SELECTED}"
+	log mdcfg "Number of devices in the RAID0 array md${MD_NUM}: ${SELECTED}"
 
 	RAID_DEVICES="$(echo ${RET} | sed -e 's/,//g')"
 	log-output -t mdcfg \
@@ -321,9 +322,9 @@ md_create_raid1() {
 		let MD_NUM++
 	fi
 
-	logger -t mdcfg "Selected spare count: ${NAMED_SPARES}"
-	logger -t mdcfg "Raid devices count: ${DEV_COUNT}"
-	logger -t mdcfg "Spare devices count: ${SPARE_COUNT}"
+	log mdcfg "Selected spare count: ${NAMED_SPARES}"
+	log mdcfg "Raid devices count: ${DEV_COUNT}"
+	log mdcfg "Spare devices count: ${SPARE_COUNT}"
 	log-output -t mdcfg \
 		mdadm --create /dev/md/${MD_NUM} --auto=yes --force -R -l raid1 \
 		      -n ${DEV_COUNT} -x ${SPARE_COUNT} ${RAID_DEVICES} ${MISSING_DEVICES} \
@@ -463,9 +464,9 @@ md_create_raid5() {
 		let MD_NUM++
 	fi
 
-	logger -t mdcfg "Selected spare count: ${NAMED_SPARES}"
-	logger -t mdcfg "Raid devices count: ${DEV_COUNT}"
-	logger -t mdcfg "Spare devices count: ${SPARE_COUNT}"
+	log mdcfg "Selected spare count: ${NAMED_SPARES}"
+	log mdcfg "Raid devices count: ${DEV_COUNT}"
+	log mdcfg "Spare devices count: ${SPARE_COUNT}"
 	log-output -t mdcfg \
 		mdadm --create /dev/md/${MD_NUM} --auto=yes --force -R -l raid5 \
 		      -n ${DEV_COUNT} -x ${SPARE_COUNT} ${RAID_DEVICES} \
diff --git a/packages/net-retriever/net-retriever b/packages/net-retriever/net-retriever
index 77a1cda..2866413 100755
--- a/packages/net-retriever/net-retriever
+++ b/packages/net-retriever/net-retriever
@@ -1,14 +1,7 @@
 #!/bin/sh
 
 . /usr/share/debconf/confmodule
-
-log() {
-	logger -t net-retriever "$@"
-}
-error() {
-	log "error: $@"
-	exit 1
-}
+. /lib/output.sh
 
 db_get mirror/protocol
 protocol="$RET"
@@ -60,15 +53,17 @@ checkmatch() {
 		while read md5 size file; do
 			if [ "$file" = "$packages" ]; then
 				if [ "$md5" != "$pkgmd5" ]; then
-					error "MD5 mismatch for $packages ($md5 != $pkgmd5)."
+					error net-retriever "MD5 mismatch for $packages ($md5 != $pkgmd5)."
+					exit 1
 				fi
 				if [ "$size" != "$pkgsize" ]; then
-					error "Size mismatch for $packages ($size != $pkgsize)."
+					error net-retriever "Size mismatch for $packages ($size != $pkgsize)."
+					exit 1
 				fi
 				return 0
 			fi
 		done
-		error "$packages not found in $release."
+		erroe "$packages not found in $release."
 	)
 	set +e
 }
@@ -112,27 +107,30 @@ case "$cmd" in
 	# mandatory by default.
 	if type gpgv >/dev/null && [ -f "$keyring" ]; then
 		if db_get debian-installer/allow_unauthenticated && [ "$RET" = true ]; then
-			log "Not verifying Release signature: unauthenticated mode enabled"
+			log net-retriever "Not verifying Release signature: unauthenticated mode enabled"
 		else
 			if ! fetch "dists/$codename/Release.gpg" "$Release.gpg"; then
-				error "dists/$codename/Release is unsigned."
+				error net-retriever "dists/$codename/Release is unsigned."
+				exit 1
 			fi
 			if ! log-output -t net-retriever --pass-stdout \
 			     gpgv --status-fd 1 --keyring "$keyring" \
 			     --ignore-time-conflict \
 			     "$Release.gpg" "$Release" | read_gpg_status; then
-				error "Bad signature on $Release."
+				error net-retriever "Bad signature on $Release."
+				exit 1
 			fi
 		fi
 	else
-		log "Not verifying Release signature: gpgv not available"
+		log net-retriever "Not verifying Release signature: gpgv not available"
 	fi
 
 	ARCH=`udpkg --print-architecture`
 	components="`grep ^Components: $Release | cut -d' ' -f2-`"
 	ret=1
 	if [ -z "$components" ]; then
-		error "No components listed in $Release."
+		error net-retriever "No components listed in $Release."
+		exit 1
 	fi
 	for comp in $components; do
 		for ext in '.gz' ''; do
diff --git a/packages/nobootloader/debian/postinst b/packages/nobootloader/debian/postinst
index edf88f2..1b5589f 100755
--- a/packages/nobootloader/debian/postinst
+++ b/packages/nobootloader/debian/postinst
@@ -3,38 +3,21 @@
 set -e
 
 . /usr/share/debconf/confmodule
-
-log () {
-	logger -t nobootloader "$@"
-}
-
-error () {
-	log "error: $@"
-}
+. /lib/output.sh
 
 findfs () {
 	mount | grep "on /target${1%/} " | cut -d' ' -f1
 }
 
-die () {
-	template="$1"
-	shift
-
-	error "$@"
-	db_input critical "$template" || [ $? -eq 30 ]
-	db_go || true
-	exit 1
-}
-
 mountvirtfs () {
 	fstype="$1"
 	path="$2"
 	if grep -q "[[:space:]]$fstype\$" /proc/filesystems && \
 	   ! grep -q "^[^ ]\+ \+$path " /proc/mounts; then
 		mkdir -p "$path" || \
-			die nobootloader/mounterr "Error creating $path"
+			die nobootloader nobootloader/mounterr "Error creating $path"
 		mount -t "$fstype" "$fstype" "$path" || \
-			die nobootloader/mounterr "Error mounting $path"
+			die nobootloader nobootloader/mounterr "Error mounting $path"
 		trap "umount $path" HUP INT QUIT KILL PIPE TERM EXIT
 	fi
 }
diff --git a/packages/oldsys-preseed/oldsys-preseed b/packages/oldsys-preseed/oldsys-preseed
index 7f5c0ad..7db9a5a 100755
--- a/packages/oldsys-preseed/oldsys-preseed
+++ b/packages/oldsys-preseed/oldsys-preseed
@@ -7,13 +7,10 @@
 set -e
 
 . /usr/lib/oldsys-preseed/functions
-
-log() {
-	logger -t oldsys-preseed "$@"
-}
+. /lib/output.sh
 
 exit_unknown() {
-	log "Unknown system - not writing preseed file"
+	log oldsys-preseed "Unknown system - not writing preseed file"
 	exit 0
 }
 
@@ -31,7 +28,7 @@ case "`archdetect`" in
 			check_file /proc/mtd
 			sysconf=$(get_mtdblock "SysConf")
 			if [ -z "$sysconf" ]; then
-				log "Can't find SysConf MTD partition"
+				log oldsys-preseed "Can't find SysConf MTD partition"
 				exit
 			fi
 			parse_sysconf "/dev/$sysconf"
@@ -69,7 +66,7 @@ case "`archdetect`" in
 			check_file /proc/mtd
 			config=$(get_mtdblock "user")
 			if [ -z "$config" ]; then
-				log "Can't find MTD partition holding config data"
+				log oldsys-preseed "Can't find MTD partition holding config data"
 				exit
 			fi
 			path=/tmp/oldsys-preseed
@@ -135,14 +132,14 @@ case "`archdetect`" in
 			check_file /proc/mtd
 			config=$(get_mtdblock "config")
 			if [ -z "$config" ]; then
-				log "Can't find MTD partition holding Linux config"
+				log oldsys-preseed "Can't find MTD partition holding Linux config"
 				exit
 			fi
 			path=/tmp/oldsys-preseed
 			mkdir -p $path/mnt $path/lpr
 			mount -t minix /dev/$config $path/mnt
 			if [ ! -e $path/mnt/config.lrp ]; then
-				log "config.lrp does not exist in $path/mnt"
+				log oldsys-preseed "config.lrp does not exist in $path/mnt"
 				umount $path/mnt
 				exit
 			fi
diff --git a/packages/os-prober/os-probes/init/common/10filesystems b/packages/os-prober/os-probes/init/common/10filesystems
index 6f1d1e4..538f524 100755
--- a/packages/os-prober/os-probes/init/common/10filesystems
+++ b/packages/os-prober/os-probes/init/common/10filesystems
@@ -2,6 +2,7 @@
 # Make sure filesystems are available.
 set +e	# ignore errors from modprobe
 
+. /lib/output.sh
 FILESYSTEMS='ext2 ext3 reiserfs xfs jfs msdos vfat ntfs minix hfs hfsplus qnx4 ufs'
 # The Ubuntu kernel udebs put a number of filesystem modules in
 # fs-{core,secondary}-modules. It's fairly cheap to check for these too.
@@ -24,7 +25,7 @@ if [ ! -e /var/lib/os-prober/modules ]; then
 			fs-*)
 				;;
 			*)
-				modprobe $fs 2>/dev/null | logger -t os-prober
+				modprobe $fs 2>/dev/null | log os-prober
 				;;
 		esac
 	done
diff --git a/packages/os-prober/os-probes/mounted/powerpc/20macosx b/packages/os-prober/os-probes/mounted/powerpc/20macosx
index b4fe9b3..e971cdb 100755
--- a/packages/os-prober/os-probes/mounted/powerpc/20macosx
+++ b/packages/os-prober/os-probes/mounted/powerpc/20macosx
@@ -1,19 +1,16 @@
 #!/bin/sh -e
 # Detects Mac OS X. I don't yet know how Mac OS <= 9 fits into this.
 . /usr/share/os-prober/common.sh
+. /lib/output.sh
 
 partition=$1
 mpoint=$2
 type=$3
 
-debug() {
-  logger -t macosx-prober "debug: $@"
-}
-
 # Weed out stuff that doesn't apply to us
 case "$type" in
-  hfsplus) debug "$1 is an HFS+ partition" ;;
-  *) debug "$1 is not an HFS+ partition: exiting"; exit 1 ;;
+  hfsplus) debug macosx-prober "$1 is an HFS+ partition" ;;
+  *) debug macosx-prober "$1 is not an HFS+ partition: exiting"; exit 1 ;;
 esac
 
 # Could use a better test than this.
diff --git a/packages/partitioner/scripts/m68k.sh b/packages/partitioner/scripts/m68k.sh
index 7fb9f9e..5021639 100644
--- a/packages/partitioner/scripts/m68k.sh
+++ b/packages/partitioner/scripts/m68k.sh
@@ -1,3 +1,4 @@
+. /lib/output.sh
 
 DISK="$1"
 [ -z "$DISK" ] && exit 1
@@ -27,8 +28,8 @@ case "`archdetect`" in
 esac
 
 if type update-dev >/dev/null 2>&1; then
-	logger -t "partitioner" "userdevfs: update-dev"
-	update-dev 2>&1 | logger -t "update-dev"
+	log "partitioner" "userdevfs: update-dev"
+	update-dev 2>&1 | log "update-dev"
 fi
 
 exit $?
diff --git a/packages/partman/partman-auto-raid/auto-raidcfg b/packages/partman/partman-auto-raid/auto-raidcfg
index befa779..b979db6 100755
--- a/packages/partman/partman-auto-raid/auto-raidcfg
+++ b/packages/partman/partman-auto-raid/auto-raidcfg
@@ -1,6 +1,7 @@
 #!/bin/sh
 
 . /usr/share/debconf/confmodule
+. /lib/output.sh
 
 # Mostly based on mdcfg
 
@@ -65,8 +66,8 @@ create_raid() {
 
 	echo "Raid devices count: $DEV_COUNT"
 	if [ "$RAID_TYPE" != "0" ]; then
-		logger -t partman-auto-raid "Selected spare count: $NAMED_SPARES"
-		logger -t partman-auto-raid "Spare devices count: $SPARE_COUNT"
+		log partman-auto-raid "Selected spare count: $NAMED_SPARES"
+		log partman-auto-raid "Spare devices count: $SPARE_COUNT"
 		MDADM_PARAMS="-x $SPARE_COUNT $RAID_DEVICES $MISSING_DEVICES $SPARE_DEVICES $MISSING_SPARES"
 	else
 		MDADM_PARAMS="$RAID_DEVICES"
@@ -76,7 +77,7 @@ create_raid() {
 		mdadm --create /dev/md/$MD_NUM --auto=yes --force -R -l raid$RAID_TYPE \
 		      -n $DEV_COUNT $MDADM_PARAMS
 	then
-		logger -t partman-auto-raid "Error creating array /dev/md/$MD_NUM"
+		log partman-auto-raid "Error creating array /dev/md/$MD_NUM"
 		exit 1
 	fi
 }
@@ -105,7 +106,7 @@ apt-install mdadm || true
 # Check we have recipe(s)
 db_get partman-auto-raid/recipe
 if [ -z "$RET" ]; then
-	logger -t partman-auto-raid "Error: No recipe specified in partman-auto-raid/recipe"
+	log partman-auto-raid "Error: No recipe specified in partman-auto-raid/recipe"
 	exit 1
 fi
 
diff --git a/packages/partman/partman-auto-raid/display.d/initial_auto_raid_fs b/packages/partman/partman-auto-raid/display.d/initial_auto_raid_fs
index 1c6b818..707838c 100755
--- a/packages/partman/partman-auto-raid/display.d/initial_auto_raid_fs
+++ b/packages/partman/partman-auto-raid/display.d/initial_auto_raid_fs
@@ -3,6 +3,7 @@
 # Set the filesystems for the newly created preseeded RAID config
 
 . /lib/partman/lib/base.sh
+. /lib/output.sh
 
 fix_raid_fs() {
 	raidnum=$1
@@ -11,7 +12,7 @@ fix_raid_fs() {
 
 	dev="/var/lib/partman/devices/=dev=md=$raidnum"
 	if [ ! -d $dev ]; then
-		logger -t partman-auto-raid "Error: directory for /dev/md/$raidnum not found"
+		log partman-auto-raid "Error: directory for /dev/md/$raidnum not found"
 		db_set partman-auto-raid/error false
 		db_input critical partman-auto-raid/error
 		db_go
@@ -21,7 +22,7 @@ fix_raid_fs() {
 
 	id=$(ls -d 0-*)
 	if [ -z $id ]; then
-		logger -t partman-auto-raid "Error: incorrect directory for /dev/md/$raidnum"
+		log partman-auto-raid "Error: incorrect directory for /dev/md/$raidnum"
 		db_set partman-auto-raid/error false
 		db_input critical partman-auto-raid/error
 		db_go
@@ -54,7 +55,7 @@ rm /var/lib/partman/do_initial_auto_raid_fs
 # Check we have the stashed value of the first RAID dev we created
 db_get partman-auto-raid/raidnum
 if [ -z "$RET" ]; then
-	logger -t partman-auto-raid "Error: cannot determine device number for RAID device"
+	log partman-auto-raid "Error: cannot determine device number for RAID device"
 	db_set partman-auto-raid/error false
 	db_input critical partman-auto-raid/error
 	db_go
diff --git a/packages/partman/partman-auto/display.d/initial_auto b/packages/partman/partman-auto/display.d/initial_auto
index ff486db..2a611ab 100755
--- a/packages/partman/partman-auto/display.d/initial_auto
+++ b/packages/partman/partman-auto/display.d/initial_auto
@@ -1,6 +1,7 @@
 #!/bin/sh
 
 . /lib/partman/lib/base.sh
+. /lib/output.sh
 
 # Only run the first time
 if [ -f /var/lib/partman/initial_auto ]; then
@@ -108,7 +109,7 @@ if [ "$method" ] && [ "$disks" ]; then
 		exit 0
 		;;
 	    *)
-		logger -t partman-auto "Unsupported method '$method'"
+		log partman-auto "Unsupported method '$method'"
 		exit 1
 		;;
 	esac
diff --git a/packages/partman/partman-auto/lib/recipes.sh b/packages/partman/partman-auto/lib/recipes.sh
index 444a5af..2a86e4f 100644
--- a/packages/partman/partman-auto/lib/recipes.sh
+++ b/packages/partman/partman-auto/lib/recipes.sh
@@ -1,3 +1,4 @@
+. /lib/output.sh
 # If you are curious why partman-auto is so slow, it is because
 # update-all is slow
 update_all () {
@@ -279,7 +280,7 @@ choose_recipe () {
 		if [ $(min_size) -le $free_size ]; then
 			return 0
 		else
-			logger -t partman-auto \
+			log partman-auto \
 			"Expert recipe too large ($(min_size) > $free_size); skipping"
 		fi
 	fi
diff --git a/packages/partman/partman-base/partman b/packages/partman/partman-base/partman
index 4815434..2ce112e 100755
--- a/packages/partman/partman-base/partman
+++ b/packages/partman/partman-base/partman
@@ -1,6 +1,7 @@
 #!/bin/sh
 
 . /lib/partman/lib/base.sh
+. /lib/output.sh
 
 abort () {
 	if [ -f /var/run/parted_server.pid ]; then
@@ -37,7 +38,7 @@ load_extra () {
 			anna-install partman-lvm
 		fi
 	else
-		logger -t partman "Insufficient free memory to load LVM support"
+		log partman "Insufficient free memory to load LVM support"
 	fi
 	if [ ! -f /lib/partman/lib/crypto-base.sh ] && \
 	   [ $(memfree) -ge $memreq_crypto ]; then
@@ -47,7 +48,7 @@ load_extra () {
 			anna-install partman-crypto
 		fi
 	else
-		logger -t partman "Insufficient free memory to load crypto support"
+		log partman "Insufficient free memory to load crypto support"
 	fi
 }
 
diff --git a/packages/partman/partman-crypto/blockdev-keygen b/packages/partman/partman-crypto/blockdev-keygen
index d023ff4..51f028a 100755
--- a/packages/partman/partman-crypto/blockdev-keygen
+++ b/packages/partman/partman-crypto/blockdev-keygen
@@ -19,6 +19,7 @@
 #
 
 . /usr/share/debconf/confmodule
+. /lib/output.sh
 
 umask 077
 
@@ -206,7 +207,7 @@ if ! ([ "$description" ] && [ "$keytype" ] && [ "$keyfile" ]); then
 fi
 
 # Log available entropy
-logger -t partman-crypto "kernel entropy_avail: $(cat /proc/sys/kernel/random/entropy_avail) bits"
+log partman-crypto "kernel entropy_avail: $(cat /proc/sys/kernel/random/entropy_avail) bits"
 
 if [ "$keytype" = random ] || [ "$keytype" = keyfile ]; then
 	if ! have_entropy_plugin; then
diff --git a/packages/partman/partman-lvm/choose_partition/lvm/do_option b/packages/partman/partman-lvm/choose_partition/lvm/do_option
index 87a6cc3..57c6e10 100755
--- a/packages/partman/partman-lvm/choose_partition/lvm/do_option
+++ b/packages/partman/partman-lvm/choose_partition/lvm/do_option
@@ -1,6 +1,7 @@
 #!/bin/sh
 
 . /lib/partman/lib/lvm-base.sh
+. /lib/output.sh
 
 #####################################
 #
@@ -538,7 +539,7 @@ while [ 1 ]; do
 	    deletelv)	do_lv_delete ;;
 	    finish)	break ;;
 	    *)
-		logger -t partman-lvm "Unknown selection '$option'"
+		log partman-lvm "Unknown selection '$option'"
 		break ;;
 	esac
 done
diff --git a/packages/partman/partman-partitioning/active_partition/resize/do_option b/packages/partman/partman-partitioning/active_partition/resize/do_option
index 05cc0d3..e941a1a 100755
--- a/packages/partman/partman-partitioning/active_partition/resize/do_option
+++ b/packages/partman/partman-partitioning/active_partition/resize/do_option
@@ -2,6 +2,7 @@
 
 . /lib/partman/lib/base.sh
 . /lib/partman/lib/resize.sh
+. /lib/output.sh
 
 dev=$2
 oldid=$3
@@ -35,7 +36,7 @@ else
 fi
 
 if [ -z "$maxsize" ]; then
-	logger -t partman "Error: unable to determine maximum new size for partition"
+	log partman "Error: unable to determine maximum new size for partition"
 	db_input critical partman-partitioning/impossible_resize || true
 	db_go || true
 	exit 1
diff --git a/packages/partman/partman-partitioning/lib/resize.sh b/packages/partman/partman-partitioning/lib/resize.sh
index 8d1d838..2c120d3 100644
--- a/packages/partman/partman-partitioning/lib/resize.sh
+++ b/packages/partman/partman-partitioning/lib/resize.sh
@@ -1,3 +1,4 @@
+. /lib/output.sh
 # Sets $virtual; used by other functions here.
 check_virtual () {
     open_dialog VIRTUAL $oldid
@@ -22,7 +23,7 @@ get_real_device () {
 		bdev=$bdev$num
 		;;
 	    *)
-		log "get_real_device: strange device name $bdev"
+		log resize.sh "get_real_device: strange device name $bdev"
 		return
 		;;
 	esac
@@ -37,7 +38,7 @@ do_ntfsresize () {
 	ntfsresize="$(ntfsresize $@ 2>&1)"
 	RET=$?
 	echo "$ntfsresize" | grep -v "percent completed" | \
-		logger -t ntfsresize
+		log ntfsresize
 	return $RET
 }
 
@@ -49,7 +50,7 @@ get_ntfs_resize_range () {
     get_real_device
     if [ "$bdev" ]; then
 	if ! do_ntfsresize -f -i $bdev; then
-	    logger -t partman "Error running 'ntfsresize --info'"
+	    log partman "Error running 'ntfsresize --info'"
 	    return 1
 	fi
 	size=$(echo "$ntfsresize" \
@@ -70,7 +71,7 @@ get_ext2_resize_range () {
     get_real_device
     if [ "$bdev" ]; then
 	if ! tune2fs="$(tune2fs -l $bdev)"; then
-	    logger -t partman "Error running 'tune2fs -l $bdev'"
+	    log partman "Error running 'tune2fs -l $bdev'"
 	    return 1
 	fi
 	block_size="$(echo "$tune2fs" | grep '^Block size:' | head -n1 | sed 's/.*:[[:space:]]*//')"
@@ -174,7 +175,7 @@ perform_resizing () {
 	    # Wait for the device file to be created again
 	    update-dev
 	    if ! echo y | do_ntfsresize -f $path; then
-		logger -t partman "Error resizing the NTFS file system to the partition size"
+		log partman "Error resizing the NTFS file system to the partition size"
 		db_input high partman-partitioning/new_size_commit_failed || true
 		db_go || true
 		db_progress STOP
@@ -195,14 +196,14 @@ perform_resizing () {
 		# Wait for the device file to be created
 		update-dev
 		if ! echo y | do_ntfsresize -f $path; then
-		    logger -t partman "Error resizing the NTFS file system to the partition size"
+		    log partman "Error resizing the NTFS file system to the partition size"
 		    db_input high partman-partitioning/new_size_commit_failed || true
 		    db_go || true
 		    db_progress STOP
 		    exit 100
 		fi
 	    else
-		logger -t partman "Error resizing the NTFS file system"
+		log partman "Error resizing the NTFS file system"
 		db_input high partman-partitioning/new_size_commit_failed || true
 		db_go || true
 		db_progress STOP
@@ -266,7 +267,7 @@ perform_resizing () {
 	db_progress SET 500
 	if longint_le "$cursize" "$newsize"; then
 	    if ! resize2fs $path; then
-		logger -t partman "Error resizing the ext2/ext3 file system to the partition size"
+		log partman "Error resizing the ext2/ext3 file system to the partition size"
 		db_input high partman-partitioning/new_size_commit_failed || true
 		db_go || true
 		db_progress STOP
@@ -280,14 +281,14 @@ perform_resizing () {
 		# Wait for the device file to be created
 		update-dev
 		if ! resize2fs $path; then
-		    logger -t partman "Error resizing the ext2/ext3 file system to the partition size"
+		    log partman "Error resizing the ext2/ext3 file system to the partition size"
 		    db_input high partman-partitioning/new_size_commit_failed || true
 		    db_go || true
 		    db_progress STOP
 		    exit 100
 		fi
 	    else
-		logger -t partman "Error resizing the ext2/ext3 file system"
+		log partman "Error resizing the ext2/ext3 file system"
 		db_input high partman-partitioning/new_size_commit_failed || true
 		db_go || true
 		db_progress STOP
diff --git a/packages/pkgsel/debian/postinst b/packages/pkgsel/debian/postinst
index 2e68f27..1226318 100755
--- a/packages/pkgsel/debian/postinst
+++ b/packages/pkgsel/debian/postinst
@@ -1,16 +1,13 @@
 #!/bin/sh
 set -e
 . /usr/share/debconf/confmodule
+. /lib/output.sh
 
 # Avoid perl warnings in any of the chroot calls below
 export LANG=C
 
 DIVERTS='/usr/bin/scrollkeeper-update /usr/bin/scrollkeeper-rebuilddb /usr/bin/fc-cache'
 
-log() {
-	logger -t pkgsel "$@"
-}
-
 cleanup () {
 	for divert in $DIVERTS; do
 		rm -f "/target$divert"
@@ -95,7 +92,7 @@ if [ "$ret" != 0 ]; then
 	# TODO useful error message here (for ret != 30)
 	db_progress INFO pkgsel/progress/cleanup
 	if ! cleanup; then
-		log "cleanup failed"
+		log pkgsel "cleanup failed"
 	fi
 	db_progress STOP
 	load_cd1
@@ -115,7 +112,7 @@ if [ "$RET" ]; then
 		# TODO useful error message here (for ret != 30)
 		db_progress INFO pkgsel/progress/cleanup
 		if ! cleanup; then
-			log "cleanup failed"
+			log pkgsel "cleanup failed"
 		fi
 		db_progress STOP
 		load_cd1
@@ -125,7 +122,7 @@ fi
 
 db_progress INFO pkgsel/progress/cleanup
 if ! cleanup; then
-	log "cleanup failed"
+	log pkgsel "cleanup failed"
 fi
 db_progress STEP 2
 
diff --git a/packages/preseed/preseed.sh b/packages/preseed/preseed.sh
index fe407e9..e9b478b 100644
--- a/packages/preseed/preseed.sh
+++ b/packages/preseed/preseed.sh
@@ -1,19 +1,7 @@
 #!/bin/sh
 
 logfile=/var/lib/preseed/log
-
-log () {
-	logger -t preseed "$@"
-}
-
-error () {
-	error="$1"
-	location="$2"
-	db_subst preseed/$error LOCATION "$location"
-	db_input critical preseed/$error || true
-	db_go || true
-	exit 1
-}
+. /lib/output.sh
 
 # Function to implement the behaviour documented in README.preseed_fetch
 make_absolute_url() {
@@ -46,11 +34,13 @@ preseed_location () {
 	local tmp=/tmp/debconf-seed
 	
 	if ! preseed_fetch "$location" "$tmp"; then
-		error retrieve_error "$location"
+		db_subst preseed/"$location" LOCATION
+		die preseed preseed/retrieve_error
 	fi
 	if [ -n "$checksum" ] && \
 	   [ "$(md5sum $tmp | cut -d' ' -f1)" != "$checksum" ]; then
-		error retrieve_error "$location"
+		db_subst preseed/"$location" LOCATION
+		die preseed preseed/retrieve_error
 	fi
 
 	db_set preseed/include ""
@@ -62,11 +52,12 @@ preseed_location () {
 		UNSEEN=--unseen
 	fi
 	if ! debconf-set-selections $UNSEEN $tmp; then
-		error load_error "$location"
+		db_subst preseed/"$location" LOCATION
+		die preseed preseed/load_error
 	fi
 	rm -f $tmp
 
-	log "successfully loaded preseed file from $location"
+	log preseed "successfully loaded preseed file from $location"
 	local last_location="$location"
 	
 	while true ; do
@@ -109,15 +100,17 @@ preseed_location () {
 			# BTW -- is this test for empty strings really needed?
 			if [ -n "$location" ]; then
 				if ! preseed_fetch "$location" "$tmp"; then
-					log "error fetching \"$location\""
-					error retrieve_error "$location"
+					log preseed "error fetching \"$location\""
+					db_subst preseed/"$location" LOCATION
+					die preseed preseed/retrieve_error
 				fi
 				chmod +x $tmp
 				if ! log-output -t preseed/run $tmp; then
-					log "error running \"$location\""
-					error load_error "$location"
+					log preseed "error running \"$location\""
+					db_subst preseed/"$location" LOCATION
+					die preseed preseed/load_error
 				fi
-				log "successfully ran \"$location\""
+				log preseed "successfully ran \"$location\""
 				rm -f $tmp
 			fi
 		done
diff --git a/packages/preseed/preseed_command b/packages/preseed/preseed_command
index 80bea76..1a3bda0 100755
--- a/packages/preseed/preseed_command
+++ b/packages/preseed/preseed_command
@@ -3,15 +3,12 @@
 ct=$1
 
 . /usr/share/debconf/confmodule
-
-log () {
-	logger -t preseed "$@"
-}
+. /lib/output.sh
 
 db_get "$ct"
 command="$RET"
 if [ "$command" != "" ]; then
-	log "running preseed command $ct: $command"
+	log preseed "running preseed command $ct: $command"
 	code=0
 	log-output sh -c "$command" || code=$?
 	if [ "$code" != 0 ]; then
diff --git a/packages/rescue/debian/rescue-mode.postinst b/packages/rescue/debian/rescue-mode.postinst
index 7abb22c..515b58f 100755
--- a/packages/rescue/debian/rescue-mode.postinst
+++ b/packages/rescue/debian/rescue-mode.postinst
@@ -1,15 +1,12 @@
 #! /bin/sh -e
 
 . /usr/share/debconf/confmodule
+. /lib/output.sh
 
 # Be nice to monolithic users.
 db_get rescue/enable
 [ "$RET" = true ] || exit 0
 
-log () {
-	logger -t rescue-mode "$@"
-}
-
 try_load_module () {
 	log-output -t rescue modprobe "$1" || true
 }
@@ -146,19 +143,19 @@ choose_root () {
 	if [ -z "$PARTITIONS" ]; then
 		# TODO: need a sensible error here, or perhaps drop through
 		# to a fallback shell?
-		log "no partitions found!"
+		log rescue-mode "no partitions found!"
 		exit 1
 	fi
-	log "partitions found: $PARTITIONS"
+	log rescue-mode "partitions found: $PARTITIONS"
 	db_subst rescue/root PARTITIONS "$PARTITIONS"
 
 	db_input critical rescue/root
 	db_go || exit 10
 	db_get rescue/root
 	export RESCUE_ROOTDEV="$RET"
-	log "selected root device '$RESCUE_ROOTDEV'"
+	log rescue-mode "selected root device '$RESCUE_ROOTDEV'"
 	if [ ! -e "$RESCUE_ROOTDEV" ]; then
-		log "'$RESCUE_ROOTDEV' does not exist"
+		log rescue-mode "'$RESCUE_ROOTDEV' does not exist"
 		db_subst rescue/no-such-device DEVICE "$RESCUE_ROOTDEV"
 		db_input critical rescue/no-such-device
 		# Since continuing returns to the rescue/root question,
@@ -170,7 +167,7 @@ choose_root () {
 	mkdir -p /target
 	umount_all
 	if ! log-output -t rescue mount "$RESCUE_ROOTDEV" /target; then
-		log "mount '$RESCUE_ROOTDEV' /target failed"
+		log rescue-mode "mount '$RESCUE_ROOTDEV' /target failed"
 		db_subst rescue/mount-failed DEVICE "$RESCUE_ROOTDEV"
 		db_input critical rescue/mount-failed
 		# Since continuing returns to the rescue/root question,
@@ -263,7 +260,7 @@ while :; do
 			db_get rescue/menu
 			item="$(get_menu_item "$RET")"
 			if [ -z "$item" ]; then
-				log "Could not find menu item for '$RET'!"
+				log rescue-mode "Could not find menu item for '$RET'!"
 				continue
 			fi
 			db_subst "rescue/${item#[0-9][0-9]}/intro" \
diff --git a/packages/rootskel-gtk/src/usr/bin/gtk-set-font b/packages/rootskel-gtk/src/usr/bin/gtk-set-font
index 4233a0d..f235b15 100644
--- a/packages/rootskel-gtk/src/usr/bin/gtk-set-font
+++ b/packages/rootskel-gtk/src/usr/bin/gtk-set-font
@@ -3,6 +3,7 @@
 set -e
 
 . /usr/share/debconf/confmodule
+. /lib/output.sh
 
 [ "$DEBIAN_FRONTEND" = "gtk" ] || exit 0
 
@@ -63,10 +64,10 @@ fi
 
 # Fall back to default if font does not exist; default is assumed to exist
 if fc-list | grep -q "$FONT_NAME"; then
-	logger -t gtk-set-font "Switching to font '$FONT_NAME' for '$language'"
+	log gtk-set-font "Switching to font '$FONT_NAME' for '$language'"
 else
 	FONT_NAME=$DEFAULT_FONT
-	logger -t gtk-set-font "Requested font for '$language' not found; using default"
+	log gtk-set-font "Requested font for '$language' not found; using default"
 fi
 
 sed -i "s/^gtk-font-name.*$/gtk-font-name = \"$FONT_NAME $FONT_SIZE\"/" $GTKRC
diff --git a/packages/rootskel-gtk/src/usr/bin/gtk-set-theme b/packages/rootskel-gtk/src/usr/bin/gtk-set-theme
index ecdc774..b808730 100644
--- a/packages/rootskel-gtk/src/usr/bin/gtk-set-theme
+++ b/packages/rootskel-gtk/src/usr/bin/gtk-set-theme
@@ -2,6 +2,7 @@
 
 set -e
 
+. /lib/output.sh
 [ "$DEBIAN_FRONTEND" = "gtk" ] || exit 0
 
 THEME="$1"
@@ -12,7 +13,7 @@ CONFFILE="/etc/gtk-2.0/gtkrc"
 
 #TODO: test that theme actually exists
 
-logger -t gtk-set-theme "Switching to theme '$THEME'"
+log gtk-set-theme "Switching to theme '$THEME'"
 if grep -q "^gtk-theme-name" $CONFFILE ; then
 	sed -i "s/^gtk-theme-name.*$/gtk-theme-name = \"$THEME\"/" $CONFFILE
 else
diff --git a/packages/sarge-support/finish-install.d/21sarge-quirks b/packages/sarge-support/finish-install.d/21sarge-quirks
index 27427f0..40f823a 100644
--- a/packages/sarge-support/finish-install.d/21sarge-quirks
+++ b/packages/sarge-support/finish-install.d/21sarge-quirks
@@ -9,10 +9,6 @@ set -e
 
 TEMPLATE_ROOT=sarge-support
 
-log() {
-	logger -t sarge-support "$@"
-}
-
 # Only run if we're installing Sarge
 if db_get mirror/codename && [ "$RET" ]; then
 	if [ "$RET" != sarge ]; then
diff --git a/packages/sarge-support/finish-install.d/51target-network-sarge b/packages/sarge-support/finish-install.d/51target-network-sarge
index 5546b24..21c53f5 100644
--- a/packages/sarge-support/finish-install.d/51target-network-sarge
+++ b/packages/sarge-support/finish-install.d/51target-network-sarge
@@ -9,10 +9,6 @@ set -e
 
 TEMPLATE_ROOT=sarge-support
 
-log() {
-	logger -t sarge-support "$@"
-}
-
 # Only run if we're installing Sarge
 if db_get mirror/codename && [ "$RET" ]; then
 	if [ "$RET" != sarge ]; then
diff --git a/packages/sarge-support/finish-install.d/91base-config-prep b/packages/sarge-support/finish-install.d/91base-config-prep
index dba447c..a7a3208 100644
--- a/packages/sarge-support/finish-install.d/91base-config-prep
+++ b/packages/sarge-support/finish-install.d/91base-config-prep
@@ -6,13 +6,10 @@
 set -e
 
 . /usr/share/debconf/confmodule
+. /lib/output.sh
 
 TEMPLATE_ROOT=sarge-support
 
-log() {
-	logger -t sarge-support "$@"
-}
-
 config_ncc_user () {
 	echo 'installer:x:0:0:installer:/:/usr/sbin/base-config-network-console' >> /target/etc/passwd
 	grep "^installer:" /etc/shadow >> /target/etc/shadow
@@ -31,8 +28,8 @@ setup_ssh_install () {
 		db_go
 		return 0
 	else
-		log "Package $NCC could not be installed"
-		log "The system will not be set up to run base configuration over SSH"
+		log sarge-support "Package $NCC could not be installed"
+		log sarge-support "The system will not be set up to run base configuration over SSH"
 		db_subst $TEMPLATE_ROOT/nc-finish-install-failure PACKAGE $NCC
 		db_input critical $TEMPLATE_ROOT/nc-finish-install-failure
 		db_go
@@ -56,18 +53,18 @@ config_inittab () {
 	console=${console#/dev/}
 
 	if setup_ssh_install ; then
-		log "Network installation: not configuring /etc/inittab to run base-config after reboot"
+		log sarge-support "Network installation: not configuring /etc/inittab to run base-config after reboot"
 	else
 		case "$console" in
 		    ttyS*)
-			log "Configuring /etc/inittab to run base-config for serial console"
+			log sarge-support "Configuring /etc/inittab to run base-config for serial console"
 			mv /target/etc/inittab /target/etc/inittab.real
 			sed -e "s/^\([23]\):/#\1:/" \
 			    -e "s#CONSOLEDEV#/dev/$console#g" \
 			    /usr/share/sarge-support/inittab > /target/etc/inittab
 			;;
 		    *)
-			log "Configuring /etc/inittab to run base-config for regular console"
+			log sarge-support "Configuring /etc/inittab to run base-config for regular console"
 			mv /target/etc/inittab /target/etc/inittab.real
 			sed -e "s#CONSOLEDEV#/dev/$console#g" \
 			    /usr/share/sarge-support/inittab > /target/etc/inittab
diff --git a/packages/sarge-support/termwrap b/packages/sarge-support/termwrap
index 4b8a706..5fb088b 100755
--- a/packages/sarge-support/termwrap
+++ b/packages/sarge-support/termwrap
@@ -29,6 +29,7 @@ fi
 ##	Some functions
 ######################################################################
 
+. /lib/output.sh
 # Get a variable from the debconf database of the first stage installer.
 get_db () {
 	DI_DB=/var/log/debian-installer/cdebconf/questions.dat
@@ -41,33 +42,20 @@ get_db () {
 	fi
 }
 
-info() {
-	echo "info: $@"
-	logger -p user.info -t termwrap "info: $@"
-}
-warning() {
-	echo "warning: $@"
-	logger -p user.warning -t termwrap "warning: $@"
-}
-error() {
-	echo "error: $@"
-	logger -p user.crit -t termwrap "error: $@"
-}
-
 unset_lang_language() {
 	# The requested charset is not supported.  Do not use the
 	# given locale.	 If it was used, the translated texts might be
 	# completely unreadable in the current terminal
 
 	if [ "$LANG" ] ; then
-		warning "Disabling unsupported locale '$LANG'."
+		warning termwrap "Disabling unsupported locale '$LANG'."
 		unset LANG
 		unset LC_ALL
 		unset LC_COLLATE
 		unset ENCODING
 	fi
 	if [ "$LANGUAGE" ] ; then
-		warning "Disabling unsupported language list '$LANGUAGE'."
+		warning termwrap "Disabling unsupported language list '$LANGUAGE'."
 		unset LANGUAGE
 	fi
 }
@@ -81,7 +69,7 @@ try_load_charset() {
 	# ACM name is from /usr/share/consoletrans/$ACM.acm.gz
 	case $TERMINAL in
 	    console)
-		info "Switching console charset mapping to $ENCODING"
+		info termwrap "Switching console charset mapping to $ENCODING"
 		for vc in `seq 0 6` 
 		do
 			consolechars --tty=/dev/tty$vc -f $FONT
@@ -89,7 +77,7 @@ try_load_charset() {
 		done
 		;;
 	    *)
-		error "Unable to switch charset mapping to $ENCODING with terminal '$TERMINAL'"
+		error termwrap "Unable to switch charset mapping to $ENCODING with terminal '$TERMINAL'"
 		unset_lang_language
 		;;
 	esac
@@ -162,7 +150,7 @@ if [ "$LANG_INST" ]; then
 				fi
 			fi
 		else
-			warning "Package 'locales' not installed.  Unable to generate locale '$LANG'"
+			warning termwrap "Package 'locales' not installed.  Unable to generate locale '$LANG'"
 		fi
 
 		# Make sure the locale is valid

Reply to: