Skip to content

Commit

Permalink
Replace deprecated 'which' in scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
doegox committed Sep 4, 2021
1 parent 9c9728e commit 78eef00
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ print-%: ; @echo $* = $($*)

style:
# Make sure astyle is installed
@which astyle >/dev/null || ( echo "Please install 'astyle' package first" ; exit 1 )
@command -v astyle >/dev/null || ( echo "Please install 'astyle' package first" ; exit 1 )
# Remove spaces & tabs at EOL, add LF at EOF if needed on *.c, *.h, *.cpp. *.lua, *.py, *.pl, Makefile, *.v, pm3
find . \( -not -path "./cov-int/*" -and -not -path "./fpga*/xst/*" -and \( -name "*.[ch]" -or \( -name "*.cpp" -and -not -name "*.moc.cpp" \) -or -name "*.lua" -or -name "*.py" -or -name "*.pl" -or -name "Makefile" -or -name "*.v" -or -name "pm3" \) \) \
-exec perl -pi -e 's/[ \t]+$$//' {} \; \
Expand All @@ -267,7 +267,7 @@ style:
# Update commands.md
[ -x client/proxmark3 ] && client/proxmark3 -m > doc/commands.md
# Make sure python3 is installed
@which python3 >/dev/null || ( echo "Please install 'python3' package first" ; exit 1 )
@command -v python3 >/dev/null || ( echo "Please install 'python3' package first" ; exit 1 )
# Update commands.json
[ -x client/proxmark3 ] && client/proxmark3 --fulltext | python3 client/pyscripts/pm3_help2json.py - doc/commands.json

Expand All @@ -282,7 +282,7 @@ miscchecks: TABSCMD+= && vi {} -c ':set tabstop=4' -c ':set et|retab' -c ':wq'
endif
miscchecks:
# Make sure recode is installed
@which recode >/dev/null || ( echo "Please install 'recode' package first" ; exit 1 )
@command -v recode >/dev/null || ( echo "Please install 'recode' package first" ; exit 1 )
@echo "Files with suspicious chars:"
@find . \( -not -path "./cov-int/*" -and -not -path "./client/deps/*" -and \( -name "*.[ch]" -or -name "*.cpp" -or -name "*.lua" -or -name "*.py" -or -name "*.pl" -or -name "Makefile" -or -name "*.v" -or -name "pm3" \) \) \
-exec sh -c "cat {} |recode utf8.. >/dev/null || echo {}" \;
Expand Down
6 changes: 3 additions & 3 deletions pm3
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function get_pm3_list_Linux {
exit 1
fi
for DEV in $(find /dev/ttyACM* 2>/dev/null); do
if which udevadm >/dev/null; then
if command -v udevadm >/dev/null; then
if udevadm info -q property -n "$DEV" | grep -q "ID_VENDOR=proxmark.org"; then
PM3LIST+=("$DEV")
if [ ${#PM3LIST[*]} -ge "$N" ]; then
Expand All @@ -77,7 +77,7 @@ function get_pm3_list_Linux {
if $FINDBTDONGLE; then
# check if the HC-06-USB white dongle is present (still, that doesn't tell us if it's paired with a Proxmark3...)
for DEV in $(find /dev/ttyUSB* 2>/dev/null); do
if which udevadm >/dev/null; then
if command -v udevadm >/dev/null; then
if udevadm info -q property -n "$DEV" | grep -q "ID_MODEL=CP2104_USB_to_UART_Bridge_Controller"; then
PM3LIST+=("$DEV")
if [ ${#PM3LIST[*]} -ge "$N" ]; then
Expand Down Expand Up @@ -440,7 +440,7 @@ HOSTOS=$(uname | awk '{print toupper($0)}')
if [ "$HOSTOS" = "LINUX" ]; then
if uname -a|grep -q Microsoft; then
# First try finding it using the PATH environment variable
PSHEXE=$(which powershell.exe 2>/dev/null)
PSHEXE=$(command -v powershell.exe 2>/dev/null)

# If it fails (such as if WSLENV is not set), try using the default installation path
if [ -z "$PSHEXE" ]; then
Expand Down

0 comments on commit 78eef00

Please sign in to comment.