nicsensor/setup.sh
leimingsheng 88f871c880 feat(master) update to 1.10 base dev 2
1.[新增功能]解耦脚本参数配置功能, 脚本配置全部放到project.config中
2.[新增功能]增加对pmbus set命令的支持
3.[新增功能]增加setup.sh, 用于一键部署脚本
4.[功能优化]代码结构目录重新归档
2026-04-17 17:09:43 +08:00

58 lines
1.8 KiB
Bash

#!/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."