#!/bin/sh -efu

. install2-init-functions

# if autoinstall.scm was used, AUTOINSTALL gets set;
# might want to skip the script then
#[ -z "$AUTOINSTALL" ] || exit 0

# other variable values to expect:
#   $destdir  -- root of the new system
#   $METHOD   -- installation method, e.g. "cdrom"
#   $CDROMDEV -- mountable device, e.g. "/dev/cdrom"
#   $PATH     -- _without_ /sbin:/usr/sbin

# exec_chroot doesn't suppress stdout *and* resets environment,
# setting only PATH, HOME=/root, TMPDIR=/tmp
#exec_chroot echo "hello world"

# run_chroot is the same but stdout is suppressed
# NB: take care that scripts don't bail out if at all possible,
# since one failed script will silently fail the rest after it!
#run_chroot chkconfig something on ||:

# when we need a bit more flexibility...
#sed -ir 's,^Enable=false,Enable=true,' "$destdir/etc/sysconfig/something" ||:
#env PATH="/sbin:/usr/sbin:$PATH" HOME="/root" TMPDIR="/tmp" chroot "$destdir" some-amazing-script 2>&1 \
#| tee $destdir/root/.install-log/some-amazing.log ||:
