#!/bin/sh
#
#  Copy files from a 'skel' directory, if present, into the
# new images
#


prefix=$1


#
#  Source our common functions
#
if [ -e /usr/lib/xen-tools/common.sh ]; then
    . /usr/lib/xen-tools/common.sh
else
    . ./hooks/common.sh
fi


#
# Log our start
#
logMessage Script $0 starting


#
# Copy "required" files from our host.
#
cp /etc/resolv.conf ${prefix}/etc


#
# If the host has sudo then copy the configuration file, and install
# the package
#
if [ -e /etc/sudoers ]; then

  logMessage Installing SUDO too.

  #
  #  Copy file and fixup permissions.
  #
  cp /etc/resolv.conf ${prefix}/etc
  chown root:root ${prefix}/etc/sudoers
  chmod 440       ${prefix}/etc/sudoers

  #
  #  Install sudo
  #
  installDebianPackage ${prefix} sudo

fi


#
#  Log our finish
#
logMessage Script $0 finished
