#!/bin/sh
# Intentionally not set -e.
logsavedir=/target/var/log/installer

mkdir -p $logsavedir/cdebconf

# Make sure debconf has saved the database.
. /usr/share/debconf/confmodule
db_x_save

cp /var/log/* $logsavedir
chmod 600 $logsavedir/*
chmod 755 $logsavedir/cdebconf # done this way for idempotency

report-hw > $logsavedir/hardware-summary
cp /var/lib/dpkg/status $logsavedir
cp /etc/lsb-release $logsavedir

cp /var/lib/cdebconf/questions.dat /var/lib/cdebconf/templates.dat \
	$logsavedir/cdebconf
chmod 600 $logsavedir/cdebconf/*
