#!/bin/sh
source /OSM/script/os_load_base.sh
PATCH_START()
{
    OS_echo "nas_proto_cfg in sph016 begin."
}
PATCH_END()
{
    chmod 775 /OSM/bin/nas_proto_cfg
    mv /OSM/bin/nas_proto_cfg /OSM/bin/nas_proto_cfg.tgz
    tar zxf /OSM/bin/nas_proto_cfg.tgz -C /OSM/bin
    chmod 500 /OSM/bin/nas_proto_cfg
    rm -f /OSM/bin/nas_proto_cfg.tgz
    checkproc cmr_store
    if [ $? -eq 0 ] ;then 
        setsid /OSM/script/nfs41_switch_check.sh 1> /dev/null 2>&1
    else
        OS_echo "Cmr_store not running, not check NFSv41 switch."
    fi
}

PATCH_ROLLBACK()
{
    OS_echo "nas_proto_cfg in sph016 begin ROLLBACK."
}
PATCH_ROLLEND()
{
    chmod 775 /OSM/bin/nas_proto_cfg
    
    tar zxf /OSM/bin/nas_proto_cfg -C /OSM/bin 1> /dev/null 2>&1
    if [ $? -eq 0 ] ;then
        OS_echo "Tar zipped nas_proto_cfg success."
    fi
    
    chmod 500 /OSM/bin/nas_proto_cfg

}
L_CMD=$1
case $L_CMD in
    "start") PATCH_START
               ;;
    "end") PATCH_END
               ;;
    "rollstart") PATCH_ROLLBACK
               ;;
    "rollend") PATCH_ROLLEND
  ;;
    *)
        OS_echo "unsupported option."
esac
exit 0