From d71261692dad394468029caa3708ec6cad889ff4 Mon Sep 17 00:00:00 2001 From: leimingsheng Date: Wed, 26 Feb 2025 16:28:01 +0800 Subject: [PATCH] code sync --- tool/plugin/autoauth.sh | 22 ++++++++++++++++++++++ tool/plugin/nicsensor.sh | 15 +++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/tool/plugin/autoauth.sh b/tool/plugin/autoauth.sh index 1a24852..33cd4db 100644 --- a/tool/plugin/autoauth.sh +++ b/tool/plugin/autoauth.sh @@ -1 +1,23 @@ #!/bin/sh + +# Get file conut first +file_num=`ls -l | wc -l` + +i=2 + +while true +do + i=$(($i+1)) + + # Get filename by ls and awk + file=`ls -l | awk -v cnt=$i 'NR==cnt{print $9}'` + cmd="chmod +x $file" + echo "File ID: $i , $cmd" + # perform chmod + $cmd + + if [ $i -eq $file_num ];then + echo "Done to add exec auth for every file" + break + fi +done \ No newline at end of file diff --git a/tool/plugin/nicsensor.sh b/tool/plugin/nicsensor.sh index 05e92b9..226b3b8 100644 --- a/tool/plugin/nicsensor.sh +++ b/tool/plugin/nicsensor.sh @@ -22,6 +22,15 @@ print_helper(){ echo "For Detect: ./nicsensor.sh detect [ocp/pcie]" } +perform_detect(){ + if [ ! -e $server_script ];then + $fmt_print "console" "Error" "Server Script $server_script not exist! Maybe unsupport for now!" + exit 1 + fi + + $server_script "detect" +} + conf_pre_check(){ if [ $param_num -lt 1 ];then @@ -91,6 +100,12 @@ start_sensor_reading(){ # --------------------------------------------------------- # Start Execute Script # --------------------------------------------------------- +# check if is detect option +if [ "$1" = "detect" ];then + perform_detect + exit 0 +fi + conf_pre_check parse_slot_name