#!/bin/sh
# Filename:      grml-home
# Purpose:       copy skeleton files if not already present
# Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
# Bug-Reports:   see http://grml.org/bugs/
# License:       This file is licensed under the GPL v2.
# Latest change: Don Sep 28 16:36:03 CEST 2006 [mika]
################################################################################
### BEGIN INIT INFO
# Provides:          grml-home
# Required-Start:    $all
# Required-Stop:
# Default-Start:     S 2 3 4 5
# Default-Stop:
### END INIT INFO

# user with UID 1000
fstabuser=$(getent passwd 1000 | cut -d: -f1)

if [ -r /etc/grml_cd ] ; then # run only in live modus
  chown "${fstabuser}": /home/"$fstabuser" # this is important for the home=/dev/ice bootparam
  su -s /bin/sh "$fstabuser" -c "rsync -Ha --ignore-existing /etc/skel/ /home/${fstabuser}/"
  #  ^^^^^^^^^^
  #  this is important to prevent startup of the zsh/newuser module
fi

## END OF FILE #################################################################
