#
# clean the system mounted for initial boot 
#
# root may be changed by environment variable ROOTPATH
#
#
# part of the LiveBackup project:  
#
#                     http://livebackup.sourceforge.net/
#
# Copyright 2006 by Wolfgang Rohrmoser <info@rohrmoser-engineering.de>
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
#


empty $ROOTPATH/etc/ioctl.save
empty $ROOTPATH/etc/pnm2ppa.conf

# this may cause trouble, so skip it here
# you may add it into config/etc/rcS.d/S00Livebackup
# clean_dir $ROOTPATH/var/log l

empty  $ROOTPATH/var/log/messages 
empty  $ROOTPATH/var/log/syslog 
empty  $ROOTPATH/var/log/debug 
empty  $ROOTPATH/var/log/dmesg 

# clean /var/run
clean_dir $ROOTPATH/var/run/ f

# clean for gdm
clean_dir $ROOTPATH/var/lib/gdm/ f


# Create empty utmp and wtmp
empty $ROOTPATH/var/run/utmp $ROOTPATH/var/run/wtmp
rm -f $ROOTPATH/var/log/utmp $ROOTPATH/var/log/wtmp
( cd $ROOTPATH/var/log
    ln -s /var/run/utmp utmp
    ln -s /var/run/wtmp wtmp
)


# misc to remove if it exists
rm -f $ROOTPATH/etc/nologin

# prepare clean tmp directories
rm -rf $ROOTPATH/tmp
mkdir -p $ROOTPATH/tmp
chmod 777 $ROOTPATH/tmp
chmod +t $ROOTPATH/tmp

rm -rf $ROOTPATH/var/tmp
mkdir -p $ROOTPATH/var/tmp
chmod 777 $ROOTPATH/var/tmp
chmod +t $ROOTPATH/var/tmp


if [ -d $ROOTPATH/etc/apt ]; then
  mkdir -p $ROOTPATH/var/cache/apt/archives/partial/
fi

#
# Local Variables: 
# mode: shell-script
# End: 
#
