#!/bin/sh # Script Description: # This script is used to auto setup the nicsensor tool and its extensions. SCRIPT_VERSION="1.0.0" SUPPORT_TOOL_VERSION="1.11" # Default values source_extension_dir="./extension" destination_tool_dir="/extlog/nicsensor" destination_extension_dir="/extlog/nicsensor/extension" exec_path="/extlog/nicsensor/nicsensor.sh" # PRINT SCRIPT INFO echo "=== Nicsensor Quick Setup Script! ===" echo "Setup Tool Version : $SCRIPT_VERSION" echo "Support nicsensor tool Version : $SUPPORT_TOOL_VERSION" # Check if the destination extension directory exists, if not, create it if [ ! -d "$destination_extension_dir" ]; then echo "Step 0 : Create directory $destination_extension_dir" mkdir -p "$destination_extension_dir" fi # Get script Path script_dir=$(pwd) source_extension_dir="$script_dir/extension" # check if the source extension directory exists, if not, exit if [ ! -d "$source_extension_dir" ]; then echo "Error : Source extension directory $source_extension_dir does not exist" exit 1 fi # copy the extension files to the destination directory echo "Step 1 : Copy extension files to $destination_extension_dir" cp -rf "$source_extension_dir"/* "$destination_extension_dir" # Add execute permission for extension files echo "Step 2 : Add execute permission for extension files" chmod +x "$destination_extension_dir"/* # copy the project config to the destination directory echo "Step 3 : Copy project.config to $destination_tool_dir" cp -f "./project.config" "$destination_tool_dir" # copy the exec file to the destination directory echo "Step 4 : Copy nicsensor to $exec_path" cp -f "./nicsensor.sh" "$exec_path" # Add execute permission for exec file echo "Step 5 : Add execute permission for nicsensor" chmod +x "$exec_path" echo "Complete auto setup nicsensor tool and its extensions."