#!/bin/sh

ARCSRC="home"
ARCDIR="/release"
ARCNAME="home"
EXCLUDE=""

 cd /

mount / / -o remount,rw,sync

if [ ! -e $ARCDIR ]
then
   mkdir $ARCDIR
fi
 
if [ -e $ARCDIR/$ARCNAME.tar.gz ]
then
echo " !"
echo -n " [$ARCNAME]: "
read tar
if [ "$tar"x = x ]
then tar=$ARCNAME;
fi

else
tar=$ARCNAME
fi

if [ -e $ARCSRC"/lost+found" ]
then
   EXCLUDE="--exclude lost+found" 
fi
 
 tar -c $EXCLUDE -f - $ARCSRC | gzip -c - > $ARCDIR/$tar.tar.gz

mount / / -o remount,ro
 