@@ -71,7 +71,7 @@ init_bhyve()
71
71
72
72
tmuxcmd=$( which tmux )
73
73
[ -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}"
75
75
return 0
76
76
}
77
77
@@ -119,7 +119,7 @@ add_bhyve_pci_id_busy()
119
119
120
120
# use $_buf_file as an intermediate buffer for share
121
121
# 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
123
123
124
124
return 0
125
125
}
@@ -168,7 +168,7 @@ store_bhyve_pci_slot()
168
168
169
169
_search_condition="pcislot_name=\"${_pcislot_name}\""
170
170
[ -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}' )
172
172
173
173
if [ -n "${_tmp_bhyve_pci_index}" ]; then
174
174
# update modified flags
@@ -233,7 +233,7 @@ next_pci_id()
233
233
_search_condition="pcislot_name=\"${_pcislot_name}\""
234
234
[ -n "${_pcislot_desc}" ] && _search_condition="${_search_condition} AND pcislot_desc=\"${_pcislot_desc}\""
235
235
#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}' )
237
237
if [ -n "${_tmp_bhyve_pci_index}" ]; then
238
238
#echo "found!!: ${_tmp_bhyve_pci_index}" >> /tmp/query.txt
239
239
@@ -275,7 +275,7 @@ next_nmdm_id()
275
275
nmdm_index=0
276
276
277
277
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
279
279
if [ $? -ne 0 ]; then
280
280
nmdm_index=${_i}
281
281
return 0
@@ -684,7 +684,7 @@ compile_dsk_controller_args()
684
684
685
685
dsk_controller_args="-s ${_pcislot_args},${_dsk_controller_type}"
686
686
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} )
688
688
689
689
for dsk_path in ${_dsk_path}; do
690
690
# test for full path. If path not started from '/' - append $data dir
@@ -715,7 +715,7 @@ compile_nvme_args()
715
715
716
716
nvme_args=
717
717
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}' )
719
719
720
720
[ "${cur_nvme_count}" = "0" ] && return 1
721
721
@@ -770,7 +770,7 @@ normalize_nic_hwaddr()
770
770
local _hwaddr
771
771
[ -z "${1}" ] && return 0
772
772
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/' )
774
774
printf ${_hwaddr}
775
775
}
776
776
@@ -793,7 +793,7 @@ compile_nic_args()
793
793
local _parent_mtu
794
794
local _ret=
795
795
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 )
797
797
local _pcislot_args= _pref
798
798
local IFS OIFS
799
799
@@ -821,7 +821,7 @@ compile_nic_args()
821
821
if [ ${nic_persistent} -eq 1 ]; then
822
822
_pref3=$( substr --pos=0 --len=3 --str=${nic_parent} )
823
823
[ "${_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
825
825
[ $? -ne 0 ] && err 1 "errmsg=\"interface ${nic_parent} marked as persistent but not exist\""
826
826
nic_hwaddr="0"
827
827
mytap="${nic_parent}"
@@ -842,7 +842,7 @@ compile_nic_args()
842
842
cbsdlogger NOTICE ${CBSD_APP}: compile_nic_args for ${jname}: nic_parent is auto, detected by default gateway: ${nic_parent}
843
843
fi
844
844
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 )
846
846
if [ "${_is_bridge}" != "bridge" ]; then
847
847
# this is not bridge, detect uplink iface
848
848
cbsdlogger NOTICE ${CBSD_APP}: compile_nic_args for ${jname}: ${nic_parent} is not bridge
@@ -851,7 +851,7 @@ compile_nic_args()
851
851
852
852
if [ "${interface}" != "disable" ]; then
853
853
# always up parent device
854
- /sbin/ifconfig ${interface} up
854
+ ${IFCONFIG_CMD} ${interface} up
855
855
if ! mybridge=$( get_my_device bridge ${interface} ); then
856
856
err 1 "errmsg=\"Error:get_my_device_bridge_for_${interface}: ${mybridge}\""
857
857
fi
@@ -860,7 +860,7 @@ compile_nic_args()
860
860
mybridge="disable"
861
861
fi
862
862
else
863
- /sbin/ifconfig ${nic_parent} > /dev/null 2>&1
863
+ ${IFCONFIG_CMD} ${nic_parent} > /dev/null 2>&1
864
864
_ret=$?
865
865
[ ${_ret} -ne 0 ] && err 1 "errmsg=\"Error:no_such_bridge: ${nic_parent}. Please create it\""
866
866
mybridge="${nic_parent}"
@@ -883,7 +883,7 @@ compile_nic_args()
883
883
cbsdlogger NOTICE ${CBSD_APP}: compile_nic_args for ${jname}: mtu set to auto, parent ${mybridge} MTU: ${_parent_mtu}
884
884
885
885
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} )
887
887
fi
888
888
else
889
889
# Get parent MTU size
@@ -894,17 +894,17 @@ compile_nic_args()
894
894
# [ ${nic_mtu} -gt ${_parent_mtu} ]
895
895
#fi
896
896
[ "${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} )
898
898
cbsdlogger NOTICE ${CBSD_APP}: compile_nic_args for ${jname}: MTU fixed: ${nic_mtu}
899
899
fi
900
900
901
- /sbin/ifconfig ${mytap} description "${jname}-nic${_id}" group vm-port up
901
+ ${IFCONFIG_CMD} ${mytap} description "${jname}-nic${_id}" group vm-port up
902
902
903
903
if [ "${mybridge}" != "disable" ]; then
904
904
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
906
906
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
908
908
fi
909
909
fi
910
910
@@ -933,7 +933,7 @@ compile_nic_args()
933
933
;;
934
934
esac
935
935
# ipv type + mask
936
- /sbin/ifconfig ${mytap} ${proto} ${ip} alias
936
+ ${IFCONFIG_CMD} ${mytap} ${proto} ${ip} alias
937
937
IFS=","
938
938
done
939
939
IFS="${OIFS}"
@@ -950,7 +950,7 @@ compile_nic_args()
950
950
fi
951
951
952
952
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
954
954
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
955
955
/usr/sbin/arp -n -d ${_ip} > /dev/null 2>&1 || true
956
956
done
@@ -1412,7 +1412,7 @@ compile_live_migration_args()
1412
1412
fi
1413
1413
1414
1414
# store info into ascii files
1415
- /bin/cat > ${jailsysdir}/${jname}/live_migration.conf << EOF
1415
+ ${CAT_CMD} > ${jailsysdir}/${jname}/live_migration.conf << EOF
1416
1416
live_migration_src_nodename="${_src_nodename}" # nodename of the CBSD source node
1417
1417
live_migration_dst_nodename="${_dst_nodename}" # nodename of the CBSD destination node
1418
1418
live_migration_dst_port="${_dst_port}" # port for migration data exchange on destination node
@@ -1628,11 +1628,11 @@ check_for_bhyve_process()
1628
1628
esac
1629
1629
1630
1630
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}' )
1632
1632
if [ -z "${b_jname}" ]; then
1633
1633
# second change: find for: /usr/sbin/bhyve -c ... <jname>
1634
1634
# 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}' )
1636
1636
fi
1637
1637
[ -z "${b_jname}" ] && continue
1638
1638
[ "${b_jname}" != "${jname}" ] && continue
0 commit comments