#!/bin/sh
PATCH_START()
{
    #add your code here
    return 
}
PATCH_END()
{
    #add your code here   
    
    mkdir /tmp/cli_path_008_cli
    tar -xf /ISM/cli_v5r7C61_DTS202008310E77ENP0I00.tgz -C /tmp/cli_path_008_cli/
    
    #back up file
	mkdir /ISM/cli_bak_008
	mkdir -p /ISM/cli_bak_008/cmd_autogen/
	mkdir -p /ISM/cli_bak_008/help/
	mkdir -p /ISM/cli_bak_008/help_developer/
	mkdir -p /ISM/cli_bak_008/help_engineer/
	mkdir -p /ISM/cli_bak_008/vstore_help/
	mkdir -p /ISM/cli_bak_008/vstore_help_developer/
	mkdir -p /ISM/cli_bak_008/vstore_help_engineer/
	
    cp -arf /ISM/cli/cmd_autogen/change.file_system.general /ISM/cli_bak_008/cmd_autogen/
	
	cp -arf /ISM/cli/help/file_system /ISM/cli_bak_008/help/
	cp -arf /ISM/cli/help_developer/file_system /ISM/cli_bak_008/help_developer/
	cp -arf /ISM/cli/help_engineer/file_system /ISM/cli_bak_008/help_engineer/
	cp -arf /ISM/cli/vstore_help/file_system /ISM/cli_bak_008/vstore_help/
	cp -arf /ISM/cli/vstore_help_developer/file_system /ISM/cli_bak_008/vstore_help_developer/
	cp -arf /ISM/cli/vstore_help_engineer/file_system /ISM/cli_bak_008/vstore_help_engineer/
	
	#cp file
    cp -rf /tmp/cli_path_008_cli/change.file_system.general /ISM/cli/cmd_autogen/
	
		
	cp -arf /tmp/cli_path_008_cli/help/file_system /ISM/cli/help/
	cp -arf /tmp/cli_path_008_cli/help_developer/file_system /ISM/cli/help_developer/
	cp -arf /tmp/cli_path_008_cli/help_engineer/file_system /ISM/cli/help_engineer/
	cp -arf /tmp/cli_path_008_cli/vstore_help/file_system /ISM/cli/vstore_help/
	cp -arf /tmp/cli_path_008_cli/vstore_help_developer/file_system /ISM/cli/vstore_help_developer/
	cp -arf /tmp/cli_path_008_cli/vstore_help_engineer/file_system /ISM/cli/vstore_help_engineer/
	
	cp -rf /tmp/cli_path_008_cli/resource.res /ISM/cli/conf/
	cp -rf /tmp/cli_path_008_cli/resource.res /ISM/cli/conf_v2r2/
    
	#restart server
	killall -s 9 CLI_Server
	
    rm -rf /tmp/cli_path_008_cli
    return
}
PATCH_ROLLBACK()
{
    #add your code here
    #rollback file	
    cp -rf /ISM/cli_bak_008/cmd_autogen/change.file_system.general /ISM/cli/cmd_autogen/
	
	cp -arf /ISM/cli_bak_008/help/file_system /ISM/cli/help/
	cp -arf /ISM/cli_bak_008/help_developer/file_system /ISM/cli/help_developer/
	cp -arf /ISM/cli_bak_008/help_engineer/file_system /ISM/cli/help_engineer/
	cp -arf /ISM/cli_bak_008/vstore_help/file_system /ISM/cli/vstore_help/
	cp -arf /ISM/cli_bak_008/vstore_help_developer/file_system /ISM/cli/vstore_help_developer/
	cp -arf /ISM/cli_bak_008/vstore_help_engineer/file_system /ISM/cli/vstore_help_engineer/
    
	#restart server
	killall -s 9 CLI_Server
	
    rm -rf /ISM/cli_bak_008	
    return
}
PATCH_ROLLEND()
{
    #add your code here
    return
}
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
