1#!/usr/bin/env bash
2
3###############################################################################
4#
5# Copyright (C) 2009-2013 Nintendo.  All rights reserved.
6#
7# These coded instructions, statements, and computer programs contain
8# proprietary information of Nintendo of America Inc. and/or Nintendo
9# Company Ltd., and are protected by Federal copyright law.  They may
10# not be disclosed to third parties or copied or duplicated in any form,
11# in whole or in part, without the prior written consent of Nintendo.
12#
13###############################################################################
14
15# Syncronize the session data directory from $CAFE_ROOT/data to $CAFE_DATA_DIR for PCFSServer
16if [ $SESSION_MANAGER -eq 1 ]
17then
18    # Release any files in the DEST directory
19    cafestop
20
21    SYNCTOOL_SRC=`cygpath -w "$CAFE_ROOT/data"`
22    SYNCTOOL_DEST=`cygpath -w "$CAFE_DATA_DIR"`
23    SYNCTOOL_CFG=`cygpath -w "$CAFE_ROOT/system/bin/tool/synctool.data.xml"`
24    SYNCTOOL_LOG=`cygpath -w "$CAFE_ROOT/${SESSION_PATH_PREFIX}sync.log"`
25
26    echo "Syncronizing $SYNCTOOL_SRC ===> $SYNCTOOL_DEST..."
27
28    synctool.exe -cfgxml "$SYNCTOOL_CFG" "$SYNCTOOL_SRC" "$SYNCTOOL_DEST" > "$SYNCTOOL_LOG" 2>&1
29    SYNCTOOL_RVAL=$?
30
31    if [ $SYNCTOOL_RVAL -ne 0 ]
32    then
33        # Alert user to the failure and to the log file
34        echo "  Session data sync FAILED with exit code $SYNCTOOL_RVAL!"
35        echo "    See $SYNCTOOL_LOG for details."
36    else
37        echo "  Session data sync log at $SYNCTOOL_LOG"
38        #rm -f "$SYNCTOOL_LOG"
39    fi
40fi
41