2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-05-17 11:54:16 +00:00
Files
xcat-core/xCAT-genesis-scripts/usr/bin/raidcmd
T
Vinícius Ferrão e239e04843 genesis-scripts: improve shell quoting and syntax hygiene
Replace backtick command substitutions with $(), quote variable
expansions to prevent word splitting, replace useless cat pipes with
redirections, use grep -q instead of redirecting to /dev/null, and use
bash parameter expansion for case conversion.

Based on the work from PR #6366, rebased and adapted to current master.
Shebangs already merged separately via df64bf8fe are excluded.

Co-Authored-By: Samveen <samveen@yahoo.com>
2026-05-07 18:17:00 -03:00

137 lines
2.9 KiB
Bash
Executable File

#!/bin/bash
#
# There are functions to handle iprconfig commands.
#
iprconfig="iprconfig"
########################################
#
# iprconfig show-config
#
########################################
function cmd_show_config {
local lines=""
lines="$($iprconfig -c show-config)"
echo "$lines"
}
########################################
#
# iprconfig show-ioas
#
########################################
function cmd_show_ioas {
local lines=""
lines="$($iprconfig -c show-ioas)"
echo "$lines"
}
########################################
#
# iprconfig -c show-details
#
########################################
function cmd_show_details {
local lines=""
local dev=$*
lines="$($iprconfig -c show-details $dev)"
echo "$lines"
}
########################################
#
# iprconfig -c show-arrays
#
########################################
function cmd_show_arrays {
local lines=""
lines="$($iprconfig -c show-arrays)"
echo "$lines"
}
###################################################################
#
# dev is raid array or not
# input : dev
# return : 1 ----- not raid array
# 0 ----- raid array
#
###################################################################
function is_array {
local lines=""
local dev=$*
lines="$($iprconfig -c show-details $dev | grep -sq "RAID Level")"
echo "$?"
}
########################################
#
# iprconfig -c alt-status <dev>
#
########################################
function cmd_alt_status {
local lines=""
local dev=$*
lines="$($iprconfig -c alt-status $dev)"
echo "$lines"
}
########################################
#
# iprconfig -c show-status <dev>
#
########################################
function cmd_show_status {
local lines=""
local dev=$*
lines="$($iprconfig -c status $dev)"
echo "$lines"
}
########################################
#
# iprconfig -c show-alt-config
#
########################################
function cmd_show_alt_config {
local lines=""
local dev=$*
lines="$($iprconfig -c show-alt-config)"
echo "$lines"
}
########################################
#
# iprconfig -c query-raid-delete <ioa>
#
########################################
function cmd_query_raid_delete {
local lines=""
local ioa=$*
lines="$($iprconfig -c query-raid-delete $ioa)"
echo "$lines"
}
########################################
#
# iprconfig -c raid-delete <array>
#
########################################
function cmd__raid_delete {
local lines=""
local array=$*
lines="$($iprconfig -c raid-delete "$array")"
}
##################################################################
#
# iprconfig -c raid-create $iprconfig_args $member_sgs
#
###################################################################
function cmd_raid_create {
local iprconfig_args=$1
local member_sgs=$2
lines="$($iprconfig -c raid-create $iprconfig_args $member_sgs)"
}