#!/bin/sh

export ROOT=/home/$1/ng_release/ng_root
if [[ xx"$1" == xx"" || x"$2" == x"" || yy"$2" == yy"" ]]; then 
    echo "Usage: $0 {build_user} {build} {curdate}\n"
    exit 1
else
    echo "Archiving \$ROOT for $2 build for date $3"
fi

# Create a tar archive of $ROOT
mkdir -p /home/$1/export/$2
cd $ROOT
tar czf /home/$1/export/$2/root_$3.tgz .

#
# Reset "latest" symlink to point to the new archive
#
cd /home/$1/export/$2
rm -f latest
ln -s root_$3.tgz latest

cd /home/$1/
