Commit 035a95f5 authored by Vitaly Lipatov's avatar Vitaly Lipatov

commit packed 3.59.0

parent 5bd6a164
#!/usr/bin/env bash #!/usr/bin/env bash
# #
# Copyright (C) 2012-2021 Etersoft # Copyright (C) 2012-2023 Etersoft
# Copyright (C) 2012-2021 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012-2023 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -33,7 +33,7 @@ SHAREDIR=$PROGDIR ...@@ -33,7 +33,7 @@ SHAREDIR=$PROGDIR
# will replaced with /etc/eepm during install # will replaced with /etc/eepm during install
CONFIGDIR=$PROGDIR/../etc CONFIGDIR=$PROGDIR/../etc
EPMVERSION="3.58.4" EPMVERSION="3.59.0"
# package, single (file), pipe, git # package, single (file), pipe, git
EPMMODE="package" EPMMODE="package"
...@@ -49,7 +49,7 @@ load_helper() ...@@ -49,7 +49,7 @@ load_helper()
{ {
local shieldname="loaded$(echo "$1" | sed -e 's|-||g')" local shieldname="loaded$(echo "$1" | sed -e 's|-||g')"
# already loaded # already loaded
eval "test -n \"\$$shieldname\"" && debug "Already loaded $1" && return eval "[ -n \"\$$shieldname\" ]" && debug "Already loaded $1" && return
local CMD="$SHAREDIR/$1" local CMD="$SHAREDIR/$1"
# do not use fatal() here, it can be initial state # do not use fatal() here, it can be initial state
...@@ -245,12 +245,26 @@ rhas() ...@@ -245,12 +245,26 @@ rhas()
echo "$1" | grep -E -q -- "$2" echo "$1" | grep -E -q -- "$2"
} }
startwith()
{
# rhas "$1" "^$2"
[[ "$1" = ${2}* ]]
}
is_abs_path()
{
#echo "$1" | grep -q "^/"
startwith "$1" "/"
}
is_dirpath() is_dirpath()
{ {
[ "$1" = "." ] && return $? [ "$1" = "." ] && return $?
rhas "$1" "/" # rhas "$1" "/"
startwith "$1" "/"
} }
filter_strip_spaces() filter_strip_spaces()
{ {
# possible use just # possible use just
...@@ -937,17 +951,17 @@ is_url() ...@@ -937,17 +951,17 @@ is_url()
echo "$1" | grep -q "^[filehtps]*:/" echo "$1" | grep -q "^[filehtps]*:/"
} }
if a= which which 2>/dev/null >/dev/null ; then if a= type -a type 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() print_command_path()
{ {
a= which -- "$1" 2>/dev/null a= type -fpP -- "$1" 2>/dev/null
} }
elif a= type -a type 2>/dev/null >/dev/null ; then elif 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 a binary, not builtin shell command
print_command_path() print_command_path()
{ {
a= type -fpP -- "$1" 2>/dev/null a= which -- "$1" 2>/dev/null
} }
else else
print_command_path() print_command_path()
...@@ -984,11 +998,6 @@ subst() ...@@ -984,11 +998,6 @@ subst()
} }
fi fi
is_abs_path()
{
echo "$1" | grep -q "^/"
}
check_core_commands() check_core_commands()
{ {
#which which >/dev/null || fatal "Can't find which command (which or debianutils package is missed?)" #which which >/dev/null || fatal "Can't find which command (which or debianutils package is missed?)"
...@@ -6032,12 +6041,14 @@ __get_app_package() ...@@ -6032,12 +6041,14 @@ __get_app_package()
__list_all_app() __list_all_app()
{ {
for i in $psdir/*.sh ; do cd $psdir || fatal
local name=$(basename $i .sh) for i in *.sh ; do
[ -n "$IGNOREi586" ] && rhas "$name" "^i586-" && continue local name=${i/.sh/}
rhas "$name" "^common" && continue [ -n "$IGNOREi586" ] && startwith "$name" "i586-" && continue
startwith "$name" "common" && continue
echo "$name" echo "$name"
done done
cd - >/dev/null
} }
__list_all_packages() __list_all_packages()
...@@ -16803,6 +16814,22 @@ fi ...@@ -16803,6 +16814,22 @@ fi
epm_main() epm_main()
{ {
# fast call for tool
if [ "$1" = "tool" ] ; then
shift
epm_cmd=tool
eval epm_$epm_cmd "$@"
exit
fi
if [ "$1" = "--inscript" ] && [ "$2" = "tool" ] ; then
shift 2
epm_cmd=tool
eval epm_$epm_cmd "$@"
exit
fi
set_pm_type set_pm_type
check_tty check_tty
......
...@@ -33,7 +33,7 @@ SHAREDIR=$PROGDIR ...@@ -33,7 +33,7 @@ SHAREDIR=$PROGDIR
# will replaced with /etc/eepm during install # will replaced with /etc/eepm during install
CONFIGDIR=$PROGDIR/../etc CONFIGDIR=$PROGDIR/../etc
EPMVERSION="3.58.4" EPMVERSION="3.59.0"
# package, single (file), pipe, git # package, single (file), pipe, git
EPMMODE="package" EPMMODE="package"
...@@ -246,12 +246,26 @@ rhas() ...@@ -246,12 +246,26 @@ rhas()
echo "$1" | grep -E -q -- "$2" echo "$1" | grep -E -q -- "$2"
} }
startwith()
{
# rhas "$1" "^$2"
[[ "$1" = ${2}* ]]
}
is_abs_path()
{
#echo "$1" | grep -q "^/"
startwith "$1" "/"
}
is_dirpath() is_dirpath()
{ {
[ "$1" = "." ] && return $? [ "$1" = "." ] && return $?
rhas "$1" "/" # rhas "$1" "/"
startwith "$1" "/"
} }
filter_strip_spaces() filter_strip_spaces()
{ {
# possible use just # possible use just
...@@ -938,17 +952,17 @@ is_url() ...@@ -938,17 +952,17 @@ is_url()
echo "$1" | grep -q "^[filehtps]*:/" echo "$1" | grep -q "^[filehtps]*:/"
} }
if a= which which 2>/dev/null >/dev/null ; then if a= type -a type 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() print_command_path()
{ {
a= which -- "$1" 2>/dev/null a= type -fpP -- "$1" 2>/dev/null
} }
elif a= type -a type 2>/dev/null >/dev/null ; then elif 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 a binary, not builtin shell command
print_command_path() print_command_path()
{ {
a= type -fpP -- "$1" 2>/dev/null a= which -- "$1" 2>/dev/null
} }
else else
print_command_path() print_command_path()
...@@ -985,11 +999,6 @@ subst() ...@@ -985,11 +999,6 @@ subst()
} }
fi fi
is_abs_path()
{
echo "$1" | grep -q "^/"
}
check_core_commands() check_core_commands()
{ {
#which which >/dev/null || fatal "Can't find which command (which or debianutils package is missed?)" #which which >/dev/null || fatal "Can't find which command (which or debianutils package is missed?)"
......
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