Commit 68bd51bc authored by Vitaly Lipatov's avatar Vitaly Lipatov

play/repack/pack common.sh: use epm tool which for is_command

parent 4d34020d
...@@ -9,30 +9,11 @@ fatal() ...@@ -9,30 +9,11 @@ fatal()
# compatibility layer # compatibility layer
# print a path to the command if exists in $PATH
if which which 2>/dev/null >/dev/null ; then
# the best case if we have which command (other ways needs checking)
# TODO: don't use which at all, it is binary, not builtin shell command
print_command_path()
{
which -- "$1" 2>/dev/null
}
elif type -a type 2>/dev/null >/dev/null ; then
print_command_path()
{
type -fpP -- "$1" 2>/dev/null
}
else
print_command_path()
{
type "$1" 2>/dev/null | sed -e 's|.* /|/|'
}
fi
# check if <arg> is a real command # check if <arg> is a real command
is_command() is_command()
{ {
print_command_path "$1" >/dev/null epm tool which "$1" >/dev/null
} }
# compatibility layer # compatibility layer
......
...@@ -6,33 +6,12 @@ fatal() ...@@ -6,33 +6,12 @@ fatal()
exit 1 exit 1
} }
# print a path to the command if exists in $PATH
if a= which which 2>/dev/null >/dev/null ; then
# the best case if we have which command (other ways needs checking)
# TODO: don't use which at all, it is binary, not builtin shell command
print_command_path()
{
a= which -- "$1" 2>/dev/null
}
elif a= type -a type 2>/dev/null >/dev/null ; then
print_command_path()
{
a= type -fpP -- "$1" 2>/dev/null
}
else
print_command_path()
{
a= type "$1" 2>/dev/null | sed -e 's|.* /|/|'
}
fi
# check if <arg> is a real command # check if <arg> is a real command
is_command() is_command()
{ {
print_command_path "$1" >/dev/null epm tool which "$1" >/dev/null
} }
eget() eget()
{ {
epm tool eget "$@" epm tool eget "$@"
......
...@@ -7,35 +7,13 @@ fatal() ...@@ -7,35 +7,13 @@ fatal()
} }
# compatibility layer # compatibility layer
# print a path to the command if exists in $PATH
if a= which which 2>/dev/null >/dev/null ; then
# the best case if we have which command (other ways needs checking)
# TODO: don't use which at all, it is binary, not builtin shell command
print_command_path()
{
a= which -- "$1" 2>/dev/null
}
elif a= type -a type 2>/dev/null >/dev/null ; then
print_command_path()
{
a= type -fpP -- "$1" 2>/dev/null
}
else
print_command_path()
{
a= type "$1" 2>/dev/null | sed -e 's|.* /|/|'
}
fi
# check if <arg> is a real command # check if <arg> is a real command
is_command() is_command()
{ {
print_command_path "$1" >/dev/null epm tool which "$1" >/dev/null
} }
# compatibility layer
# add realpath if missed # add realpath if missed
if ! is_command realpath ; then if ! is_command realpath ; then
realpath() realpath()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment