Skip to content

Commit 5bd0180

Browse files
author
olevole
committed
wip: ext cmd -> MACROS_CMD
1 parent 3c69417 commit 5bd0180

File tree

210 files changed

+958
-946
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

210 files changed

+958
-946
lines changed

bhyve.subr

+23-23
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ init_bhyve()
7171

7272
tmuxcmd=$( which tmux )
7373
[ -z "${tmuxcmd}" -o ! -x "${tmuxcmd}" ] && err 1 "${N1_COLOR}The current version requires ${N2_COLOR}tmux${N1_COLOR}\nPlease run ${N2_COLOR}pkg install tmux ${N1_COLOR} or ${N2_COLOR}make -C /usr/ports/sysutils/tmux install${N1_COLOR} it.${N0_COLOR}"
74-
tmuxcmd="/usr/local/bin/tmux -Lcbsd-${jname}"
74+
tmuxcmd="${TMUX_CMD} -Lcbsd-${jname}"
7575
return 0
7676
}
7777

@@ -119,7 +119,7 @@ add_bhyve_pci_id_busy()
119119

120120
# use $_buf_file as an intermediate buffer for share
121121
# and exchange $bhyve_pci_id_busy_list vars
122-
/usr/sbin/sysrc -qf ${_buf_file} bhyve_pci_id_busy_list="${bhyve_pci_id_busy_list}" > /dev/null 2>&1
122+
${SYSRC_CMD} -qf ${_buf_file} bhyve_pci_id_busy_list="${bhyve_pci_id_busy_list}" > /dev/null 2>&1
123123

124124
return 0
125125
}
@@ -168,7 +168,7 @@ store_bhyve_pci_slot()
168168

169169
_search_condition="pcislot_name=\"${_pcislot_name}\""
170170
[ -n "${_pcislot_desc}" ] && _search_condition="${_search_condition} AND pcislot_desc=\"${_pcislot_desc}\""
171-
_tmp_bhyve_pci_index=$( cbsdsqlro ${_mydb} SELECT pcislot_bus FROM pcibus WHERE ${_search_condition} LIMIT 1 | /usr/bin/awk '{printf $1}' )
171+
_tmp_bhyve_pci_index=$( cbsdsqlro ${_mydb} SELECT pcislot_bus FROM pcibus WHERE ${_search_condition} LIMIT 1 | ${AWK_CMD} '{printf $1}' )
172172

173173
if [ -n "${_tmp_bhyve_pci_index}" ]; then
174174
# update modified flags
@@ -233,7 +233,7 @@ next_pci_id()
233233
_search_condition="pcislot_name=\"${_pcislot_name}\""
234234
[ -n "${_pcislot_desc}" ] && _search_condition="${_search_condition} AND pcislot_desc=\"${_pcislot_desc}\""
235235
#echo "x: ${_search_condition}" >> /tmp/query.txt
236-
_tmp_bhyve_pci_index=$( cbsdsqlro ${_mydb} SELECT pcislot_bus FROM pcibus WHERE ${_search_condition} LIMIT 1 | /usr/bin/awk '{printf $1}' )
236+
_tmp_bhyve_pci_index=$( cbsdsqlro ${_mydb} SELECT pcislot_bus FROM pcibus WHERE ${_search_condition} LIMIT 1 | ${AWK_CMD} '{printf $1}' )
237237
if [ -n "${_tmp_bhyve_pci_index}" ]; then
238238
#echo "found!!: ${_tmp_bhyve_pci_index}" >> /tmp/query.txt
239239

@@ -275,7 +275,7 @@ next_nmdm_id()
275275
nmdm_index=0
276276

277277
for _i in $( /usr/bin/seq 0 500 ); do
278-
/bin/ls /dev/nmdm${_i}A* > /dev/null 2>&1
278+
${LS_CMD} /dev/nmdm${_i}A* > /dev/null 2>&1
279279
if [ $? -ne 0 ]; then
280280
nmdm_index=${_i}
281281
return 0
@@ -684,7 +684,7 @@ compile_dsk_controller_args()
684684

685685
dsk_controller_args="-s ${_pcislot_args},${_dsk_controller_type}"
686686

687-
_dsk_path=$( cbsdsqlro ${jailsysdir}/${jname}/local.sqlite SELECT dsk_path FROM bhyvedsk WHERE dsk_controller=\"${_dsk_controller_name}\" | /usr/bin/xargs )
687+
_dsk_path=$( cbsdsqlro ${jailsysdir}/${jname}/local.sqlite SELECT dsk_path FROM bhyvedsk WHERE dsk_controller=\"${_dsk_controller_name}\" | ${XARGS_CMD} )
688688

689689
for dsk_path in ${_dsk_path}; do
690690
# test for full path. If path not started from '/' - append $data dir
@@ -715,7 +715,7 @@ compile_nvme_args()
715715

716716
nvme_args=
717717

718-
cur_nvme_count=$( cbsdsqlro ${jailsysdir}/${jname}/local.sqlite 'SELECT COUNT(id) FROM bhyve_nvme' | /usr/bin/awk '{printf $1}' )
718+
cur_nvme_count=$( cbsdsqlro ${jailsysdir}/${jname}/local.sqlite 'SELECT COUNT(id) FROM bhyve_nvme' | ${AWK_CMD} '{printf $1}' )
719719

720720
[ "${cur_nvme_count}" = "0" ] && return 1
721721

@@ -770,7 +770,7 @@ normalize_nic_hwaddr()
770770
local _hwaddr
771771
[ -z "${1}" ] && return 0
772772

773-
_hwaddr=$( echo "${1}" | /usr/bin/tr -d ":" | /usr/bin/sed -e 's/\([0-9A-Fa-f]\{2\}\)/\1:/g' -e 's/\(.*\):$/\1/' )
773+
_hwaddr=$( echo "${1}" | ${TR_CMD} -d ":" | ${SED_CMD} -e 's/\([0-9A-Fa-f]\{2\}\)/\1:/g' -e 's/\(.*\):$/\1/' )
774774
printf ${_hwaddr}
775775
}
776776

@@ -793,7 +793,7 @@ compile_nic_args()
793793
local _parent_mtu
794794
local _ret=
795795
local _is_bridge=
796-
local autoconn_iface=$( /usr/sbin/sysrc -n cbsd_autoconnect_bridge 2>&1 )
796+
local autoconn_iface=$( ${SYSRC_CMD} -n cbsd_autoconnect_bridge 2>&1 )
797797
local _pcislot_args= _pref
798798
local IFS OIFS
799799

@@ -821,7 +821,7 @@ compile_nic_args()
821821
if [ ${nic_persistent} -eq 1 ]; then
822822
_pref3=$( substr --pos=0 --len=3 --str=${nic_parent} )
823823
[ "${_pref3}" != "tap" ] && err 1 "errmsg=\"only tap interface can persistent, not: ${nic_parent}\""
824-
/sbin/ifconfig ${nic_parent} > /dev/null 2>&1
824+
${IFCONFIG_CMD} ${nic_parent} > /dev/null 2>&1
825825
[ $? -ne 0 ] && err 1 "errmsg=\"interface ${nic_parent} marked as persistent but not exist\""
826826
nic_hwaddr="0"
827827
mytap="${nic_parent}"
@@ -842,7 +842,7 @@ compile_nic_args()
842842
cbsdlogger NOTICE ${CBSD_APP}: compile_nic_args for ${jname}: nic_parent is auto, detected by default gateway: ${nic_parent}
843843
fi
844844

845-
_is_bridge=$( /sbin/ifconfig ${nic_parent} | /usr/bin/awk '/groups:/{print $2}' | /usr/bin/grep -o bridge )
845+
_is_bridge=$( ${IFCONFIG_CMD} ${nic_parent} | ${AWK_CMD} '/groups:/{print $2}' | ${GREP_CMD} -o bridge )
846846
if [ "${_is_bridge}" != "bridge" ]; then
847847
# this is not bridge, detect uplink iface
848848
cbsdlogger NOTICE ${CBSD_APP}: compile_nic_args for ${jname}: ${nic_parent} is not bridge
@@ -851,7 +851,7 @@ compile_nic_args()
851851

852852
if [ "${interface}" != "disable" ]; then
853853
# always up parent device
854-
/sbin/ifconfig ${interface} up
854+
${IFCONFIG_CMD} ${interface} up
855855
if ! mybridge=$( get_my_device bridge ${interface} ); then
856856
err 1 "errmsg=\"Error:get_my_device_bridge_for_${interface}: ${mybridge}\""
857857
fi
@@ -860,7 +860,7 @@ compile_nic_args()
860860
mybridge="disable"
861861
fi
862862
else
863-
/sbin/ifconfig ${nic_parent} > /dev/null 2>&1
863+
${IFCONFIG_CMD} ${nic_parent} > /dev/null 2>&1
864864
_ret=$?
865865
[ ${_ret} -ne 0 ] && err 1 "errmsg=\"Error:no_such_bridge: ${nic_parent}. Please create it\""
866866
mybridge="${nic_parent}"
@@ -883,7 +883,7 @@ compile_nic_args()
883883
cbsdlogger NOTICE ${CBSD_APP}: compile_nic_args for ${jname}: mtu set to auto, parent ${mybridge} MTU: ${_parent_mtu}
884884

885885
if [ ${_ret} -eq 0 ]; then
886-
[ -n "${_parent_mtu}" ] && _ret=$( /sbin/ifconfig ${mytap} mtu ${_parent_mtu} )
886+
[ -n "${_parent_mtu}" ] && _ret=$( ${IFCONFIG_CMD} ${mytap} mtu ${_parent_mtu} )
887887
fi
888888
else
889889
# Get parent MTU size
@@ -894,17 +894,17 @@ compile_nic_args()
894894
# [ ${nic_mtu} -gt ${_parent_mtu} ]
895895
#fi
896896
[ "${nic_mtu}" = "0" ] && nic_mtu="1500" # case when mybridge = "disable"
897-
_ret=$( /sbin/ifconfig ${mytap} mtu ${nic_mtu} )
897+
_ret=$( ${IFCONFIG_CMD} ${mytap} mtu ${nic_mtu} )
898898
cbsdlogger NOTICE ${CBSD_APP}: compile_nic_args for ${jname}: MTU fixed: ${nic_mtu}
899899
fi
900900

901-
/sbin/ifconfig ${mytap} description "${jname}-nic${_id}" group vm-port up
901+
${IFCONFIG_CMD} ${mytap} description "${jname}-nic${_id}" group vm-port up
902902

903903
if [ "${mybridge}" != "disable" ]; then
904904
if [ "${autoconn_iface}" = "NO" ]; then
905-
/sbin/ifconfig ${mybridge} addm ${mytap} >/dev/null 2>&1
905+
${IFCONFIG_CMD} ${mybridge} addm ${mytap} >/dev/null 2>&1
906906
else
907-
/sbin/ifconfig ${mybridge} addm ${interface} addm ${mytap} >/dev/null 2>&1
907+
${IFCONFIG_CMD} ${mybridge} addm ${interface} addm ${mytap} >/dev/null 2>&1
908908
fi
909909
fi
910910

@@ -933,7 +933,7 @@ compile_nic_args()
933933
;;
934934
esac
935935
# ipv type + mask
936-
/sbin/ifconfig ${mytap} ${proto} ${ip} alias
936+
${IFCONFIG_CMD} ${mytap} ${proto} ${ip} alias
937937
IFS=","
938938
done
939939
IFS="${OIFS}"
@@ -950,7 +950,7 @@ compile_nic_args()
950950
fi
951951

952952
if [ "${clean_arp_table_by_vm}" = "1" ]; then
953-
/usr/sbin/arp -an | /usr/bin/awk -v pattern=" ${nic_hwaddr} " '$0 ~ pattern { print $2 }' | /usr/bin/sort | /usr/bin/tr -d '()' | while read _ip; do
953+
/usr/sbin/arp -an | ${AWK_CMD} -v pattern=" ${nic_hwaddr} " '$0 ~ pattern { print $2 }' | /usr/bin/sort | ${TR_CMD} -d '()' | while read _ip; do
954954
cbsdlogger NOTICE ${CBSD_APP}: compile_nic_args for ${jname}: clean_arp_table_by_vm set to 1: prune ${nic_hwaddr} for ${_ip} in ARP table
955955
/usr/sbin/arp -n -d ${_ip} > /dev/null 2>&1 || true
956956
done
@@ -1412,7 +1412,7 @@ compile_live_migration_args()
14121412
fi
14131413

14141414
# store info into ascii files
1415-
/bin/cat > ${jailsysdir}/${jname}/live_migration.conf << EOF
1415+
${CAT_CMD} > ${jailsysdir}/${jname}/live_migration.conf << EOF
14161416
live_migration_src_nodename="${_src_nodename}" # nodename of the CBSD source node
14171417
live_migration_dst_nodename="${_dst_nodename}" # nodename of the CBSD destination node
14181418
live_migration_dst_port="${_dst_port}" # port for migration data exchange on destination node
@@ -1628,11 +1628,11 @@ check_for_bhyve_process()
16281628
esac
16291629

16301630
cmd_pref=$( substr --pos=0 --len=${strlen_search_cmd} --str="${command}" )
1631-
b_jname=$( echo "${command}" | /usr/bin/awk '/bhyve: /{print $2}' )
1631+
b_jname=$( echo "${command}" | ${AWK_CMD} '/bhyve: /{print $2}' )
16321632
if [ -z "${b_jname}" ]; then
16331633
# second change: find for: /usr/sbin/bhyve -c ... <jname>
16341634
# this is bhyve stage on early start (e.g vncwait)
1635-
b_jname=$( echo "${command}" | /usr/bin/awk '/bhyve/{print $NF}' )
1635+
b_jname=$( echo "${command}" | ${AWK_CMD} '/bhyve/{print $NF}' )
16361636
fi
16371637
[ -z "${b_jname}" ] && continue
16381638
[ "${b_jname}" != "${jname}" ] && continue

bin/cbsdsftp.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ usage()
5151
printf("require:\n");
5252
printf("opt: 192.168.0.1 port user password /remote/file /local/file\n\n");
5353
printf("return 0 if success\n");
54-
printf("Example: cbsd cbsdsftp 192.168.0.1 22 cbsd password /bin/date /tmp/date\n");
54+
printf("Example: cbsd cbsdsftp 192.168.0.1 22 cbsd password ${DATE_CMD} /tmp/date\n");
5555
exit(0);
5656
}
5757

bin/cbsdsftp6.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ usage()
5353
printf("require:\n");
5454
printf("opt: 192.168.0.1 port user password /remote/file /local/file\n\n");
5555
printf("return 0 if success\n");
56-
printf("Example: cbsd cbsdsftp 192.168.0.1 22 cbsd password /bin/date /tmp/date\n");
56+
printf("Example: cbsd cbsdsftp 192.168.0.1 22 cbsd password ${DATE_CMD} /tmp/date\n");
5757
exit(0);
5858
}
5959

bin/rexe

+12-12
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ get_next_host() {
7979

8080
# get next host
8181
NEXT_HOST=$( /usr/bin/head -1 $TEMP_DIR/hostlist)
82-
HOSTFILE_LEN=$( /usr/bin/wc -l $TEMP_DIR/hostlist | /usr/bin/awk '{print $1}')
82+
HOSTFILE_LEN=$( /usr/bin/wc -l $TEMP_DIR/hostlist | ${AWK_CMD} '{print $1}')
8383

8484
if [ -z "$HOSTFILE_LEN" -o "$HOSTFILE_LEN" = 0 ] ; then
8585
/bin/rm -f "$TEMP_DIR/hostlist.lock"
@@ -112,7 +112,7 @@ run_child() {
112112
# solution: avoid subshell here by directing to a file.
113113
/bin/rm -f $TEMP_DIR/$CHILDNUM.next_host
114114
get_next_host >$TEMP_DIR/$CHILDNUM.next_host
115-
HOST=$( /bin/cat $TEMP_DIR/$CHILDNUM.next_host )
115+
HOST=$( ${CAT_CMD} $TEMP_DIR/$CHILDNUM.next_host )
116116

117117
if [ -z "$HOST" ] ; then
118118
/bin/rm -f "$TEMP_DIR/$CHILDNUM.pid"
@@ -141,7 +141,7 @@ run_child() {
141141
fi
142142

143143
# ssh_connect > $TEMP_DIR/$HOST.out
144-
# /bin/cat $TEMP_DIR/$HOST.out
144+
# ${CAT_CMD} $TEMP_DIR/$HOST.out
145145
ssh_connect
146146
ret=$?
147147
[ $ret -eq 0 ] && update_idle ${HOSTLIST}
@@ -165,7 +165,7 @@ destroy_temp() {
165165
########################################
166166
shutdown() {
167167
[ "$DEBUG" -ge 1 ] && echo "DEBUG: shutting down children." 1>&2
168-
CPIDS=$( /bin/cat $TEMP_DIR/*.pid 2>/dev/null)
168+
CPIDS=$( ${CAT_CMD} $TEMP_DIR/*.pid 2>/dev/null)
169169

170170
for CPID in $CPIDS ; do
171171
[ "$DEBUG" -ge 2 ] && echo "DEBUG: Killing pid: $CPID" 1>&2
@@ -183,9 +183,9 @@ shutdown() {
183183

184184
spew_hostlist() {
185185
echo "HOSTS RUNNING:" 1>&2
186-
/bin/cat $TEMP_DIR/*.active 2>/dev/null | sed 's/^/ /' 1>&2
186+
${CAT_CMD} $TEMP_DIR/*.active 2>/dev/null | sed 's/^/ /' 1>&2
187187
echo "HOSTS REMAINING:" 1>&2
188-
/bin/cat $TEMP_DIR/hostlist 2>/dev/null | sed 's/^/ /' 1>&2
188+
${CAT_CMD} $TEMP_DIR/hostlist 2>/dev/null | sed 's/^/ /' 1>&2
189189
return
190190
}
191191

@@ -220,29 +220,29 @@ fi
220220

221221
if [ -n "${nodelist}" ]; then
222222
[ ! -f "${nodelist}" ] && err 1 "${nodelist} file doesn't exist"
223-
HOSTLIST="$( /bin/cat $nodelist | /usr/bin/sed -e 's/#.*//' | /usr/bin/egrep -v "^ *$" )"
223+
HOSTLIST="$( ${CAT_CMD} $nodelist | ${SED_CMD} -e 's/#.*//' | ${EGREP_CMD} -v "^ *$" )"
224224
shift
225225
fi
226226

227227
if [ -n "${netgroup}" ]; then
228228
# Negtgoup
229229
NETGROUP=$2
230-
NETGROUP_LIST="$( /usr/bin/getent netgroup $NETGROUP | /usr/bin/xargs -n 1 echo | /usr/bin/sed -n '/^(.*,$/s/[,(]//gp')"
230+
NETGROUP_LIST="$( /usr/bin/getent netgroup $NETGROUP | ${XARGS_CMD} -n 1 echo | ${SED_CMD} -n '/^(.*,$/s/[,(]//gp')"
231231
[ -z "${NETGROUP_LIST}" ] && err 1 "Failed to get netgroup: $NETGROUP"
232232
HOSTLIST="$NETGROUP_LIST $HOSTLIST"
233233
shift
234234
fi
235235

236236
if [ -n "${cmdfile}" ]; then
237237
[ ! -e "$cmdfile" ] && err 1 "myssh: Script File '$SCRIPTFILE' does not exist!"
238-
THESCRIPT="$THESCRIPT $( /bin/cat $cmdfile )"
238+
THESCRIPT="$THESCRIPT $( ${CAT_CMD} $cmdfile )"
239239
shift
240240
fi
241241

242-
HOSTLIST=$(echo "$HOSTLIST" | /usr/bin/sed -e 's/#.*//' | /usr/bin/egrep -v "^ *$" )
242+
HOSTLIST=$(echo "$HOSTLIST" | ${SED_CMD} -e 's/#.*//' | ${EGREP_CMD} -v "^ *$" )
243243
[ -z "${HOSTLIST}" ] && err 1 "host list is empty"
244244

245-
COUNT_HOSTS=$(echo "$HOSTLIST" |/usr/bin/wc -w|/usr/bin/awk '{printf $1}')
245+
COUNT_HOSTS=$(echo "$HOSTLIST" |/usr/bin/wc -w|${AWK_CMD} '{printf $1}')
246246
CONCURRENT=$COUNT_HOSTS
247247
[ "$COUNT_HOSTS" = "1" ] && MULTIHOST=0
248248
[ -z "${cmd}" -a -z "${cmdfile}" ] && THESCRIPT=$@
@@ -301,7 +301,7 @@ RETVAL=$?
301301
while [ "$RETVAL" -gt 128 ] ; do
302302
[ "$DEBUG" -ge 2 ] && echo "DEBUG: wait returned with a value of $RETVAL" 1>&2
303303
DO_WAIT=0
304-
for CPID in $( /bin/cat $TEMP_DIR/*.pid 2>/dev/null) ; do
304+
for CPID in $( ${CAT_CMD} $TEMP_DIR/*.pid 2>/dev/null) ; do
305305
if [ -d "/proc/$CPID" ] ; then
306306
DO_WAIT=1
307307
[ "$DEBUG" -ge 2 ] && echo "DEBUG: $CPID is still running." 1>&2

build.subr

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fi
1515
[ -z "${target_arch}" ] && target_arch="${arch}"
1616

1717
if [ -z "${ver}" -o "${ver}" = "native" ]; then
18-
# ver=$( /sbin/sysctl -n kern.osrelease| /usr/bin/cut -d - -f 1 )
18+
# ver=$( ${SYSCTL_CMD} -n kern.osrelease| ${CUT_CMD} -d - -f 1 )
1919
# we preffer uname as source, due to some environment have UNAME_r for overwrite version
2020
tmpver=$( /usr/bin/uname -r )
2121
ver=${tmpver%%-*}
@@ -31,5 +31,5 @@ if [ "${ver}" = "head" ]; then
3131
ver="13" # todo: link with share/FreeBSD-git_branches.conf + srcup
3232
# todo: link with tools/repo getbases for CURRENT
3333
fi
34-
[ -z "${maxjobs}" ] && maxjobs=$( /sbin/sysctl -n hw.ncpu )
34+
[ -z "${maxjobs}" ] && maxjobs=$( ${SYSCTL_CMD} -n hw.ncpu )
3535
[ -z "${clean}" ] && clean=0

carp.subr

+9-9
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ get_ip4_by_vhid()
2020
local _res
2121

2222
if [ -z "${ip}" ]; then
23-
_res=$( /sbin/ifconfig ${interface}| ${GREP_CMD} "inet *.*.*.* netmask [[:alnum:]]* *.*.*.* vhid ${1} "|/usr/bin/awk {'printf $2" "'} )
23+
_res=$( ${IFCONFIG_CMD} ${interface}| ${GREP_CMD} "inet *.*.*.* netmask [[:alnum:]]* *.*.*.* vhid ${1} "|${AWK_CMD} {'printf $2" "'} )
2424
else
2525
ipwmask "${ip}"
2626
[ -n "${IWM}" ] && ip="${IWM}"
27-
_res=$( /sbin/ifconfig ${interface}| ${GREP_CMD} "inet ${ip} netmask [[:alnum:]]* *.*.*.* vhid ${1} "|/usr/bin/awk {'printf $2" "'} )
27+
_res=$( ${IFCONFIG_CMD} ${interface}| ${GREP_CMD} "inet ${ip} netmask [[:alnum:]]* *.*.*.* vhid ${1} "|${AWK_CMD} {'printf $2" "'} )
2828
fi
2929

3030
[ -z "${_res}" ] && return 0
@@ -42,7 +42,7 @@ carp_unset()
4242
[ $? -eq 0 ] && err 1 "${N1_COLOR}vhid not initializated: ${N2_COLOR}${vhid}${N0_COLOR}"
4343
# iptype ?
4444
for _resip in ${_res}; do
45-
/sbin/ifconfig ${interface} inet ${_resip} -alias
45+
${IFCONFIG_CMD} ${interface} inet ${_resip} -alias
4646
done
4747
}
4848

@@ -83,7 +83,7 @@ get_jname_by_vhid()
8383
local pattern="vhid_${vhid}#"
8484
local jname
8585

86-
jname=$( cbsdsqlro local SELECT jname FROM jails WHERE ip4_addr LIKE \"%${pattern}%\" AND emulator != \"bhyve\" | /usr/bin/xargs )
86+
jname=$( cbsdsqlro local SELECT jname FROM jails WHERE ip4_addr LIKE \"%${pattern}%\" AND emulator != \"bhyve\" | ${XARGS_CMD} )
8787

8888
[ -n "${jname}" ] && echo "${jname}"
8989
}
@@ -100,7 +100,7 @@ check_interface()
100100
done )
101101
[ -z "${_res}" ] && err 1 "${N1_COLOR}No such interface: ${N2_COLOR}${interface}${N0_COLOR}"
102102
else
103-
auto_iface=$( /sbin/route -n get 0.0.0.0 |/usr/bin/awk '/interface/{print $2}' )
103+
auto_iface=$( /sbin/route -n get 0.0.0.0 |${AWK_CMD} '/interface/{print $2}' )
104104
[ -z "${auto_iface}" ] && err 1 "${N1_COLOR}Can't determine uplink interface${N0_COLOR}"
105105
interface="${auto_iface}"
106106
fi
@@ -135,10 +135,10 @@ carp_set()
135135
echo "${interface}|${ip} vhid ${vhid} advskew ${advskew} pass ${pass} ${_state}"
136136
return 0
137137
else
138-
echo "[DEBUG] /sbin/ifconfig ${interface} vhid ${vhid} advskew ${advskew} pass ${pass} ${ip} ${_state} alias"
138+
echo "[DEBUG] ${IFCONFIG_CMD} ${interface} vhid ${vhid} advskew ${advskew} pass ${pass} ${ip} ${_state} alias"
139139
fi
140140

141-
/sbin/ifconfig ${interface} vhid ${vhid} advskew ${advskew} pass ${pass} ${ip} ${_state} alias
141+
${IFCONFIG_CMD} ${interface} vhid ${vhid} advskew ${advskew} pass ${pass} ${ip} ${_state} alias
142142

143143
}
144144

@@ -156,8 +156,8 @@ carp_update()
156156

157157
[ -z "${_cmd}" ] && return 1
158158

159-
echo "/sbin/ifconfig ${interface} vhid ${vhid} ${_cmd}"
160-
/sbin/ifconfig ${interface} vhid ${vhid} ${_cmd}
159+
echo "${IFCONFIG_CMD} ${interface} vhid ${vhid} ${_cmd}"
160+
${IFCONFIG_CMD} ${interface} vhid ${vhid} ${_cmd}
161161
}
162162

163163

0 commit comments

Comments
 (0)