Commit c868aa10 authored by Vitaly Lipatov's avatar Vitaly Lipatov

commit packed 3.19.1

parent 27d13bd7
...@@ -82,8 +82,8 @@ check_tty() ...@@ -82,8 +82,8 @@ check_tty()
check_core_commands check_core_commands
# egrep from busybox may not --color # grep -E from busybox may not --color
# egrep from MacOS print help to stderr # grep -E from MacOS print help to stderr
if grep -E --help 2>&1 | grep -q -- "--color" ; then if grep -E --help 2>&1 | grep -q -- "--color" ; then
export EGREPCOLOR="--color" export EGREPCOLOR="--color"
fi fi
...@@ -774,7 +774,7 @@ __epm_addrepo_deb() ...@@ -774,7 +774,7 @@ __epm_addrepo_deb()
esac esac
# if started from url, use heroistic # if started from url, use heroistic
if echo "$repo" | egrep -q "^https?://" ; then if echo "$repo" | grep -E -q "^https?://" ; then
repo="deb [arch=$ad] $repo" repo="deb [arch=$ad] $repo"
fi fi
...@@ -1868,6 +1868,87 @@ esac ...@@ -1868,6 +1868,87 @@ esac
} }
# File bin/epm-commentrepo:
__epm_commentrepo_alt_grepremove()
{
local rl
__replace_text_in_alt_repo "/^ *#/! s! *(.*$1)!# \1!g"
exit
# TODO
# ^rpm means full string
if rhas "$1" "^rpm" ; then
rl="$1"
else
rl="$( (epm --quiet repo list) 2>/dev/null | grep -E "$1")"
[ -z "$rl" ] && warning "Can't find '$1' in the repos (see '# epm repolist' output)" && return 1
fi
echo "$rl" | while read rp ; do
if [ -n "$dryrun" ] ; then
echo "$rp" | grep -E --color -- "$1"
continue
fi
#if [ -n "$verbose" ] ; then
# sudocmd apt-repo $dryrun rm "$rp"
#else
__replace_text_in_alt_repo "s! *$rp!# $rp!g"
#fi
done
}
__epm_commentrepo_alt()
{
local repo="$*"
[ -n "$repo" ] || fatal "No such repo or task. Use epm repo comment <regexp|archive|tasks|TASKNUMBER>"
assure_exists apt-repo
if tasknumber "$repo" >/dev/null ; then
local tn
for tn in $(tasknumber "$repo") ; do
__epm_commentrepo_alt_grepremove " repo/$tn/"
done
return
fi
case "$1" in
archive)
info "remove archive repos"
__epm_commentrepo_alt_grepremove "archive/"
;;
tasks)
info "remove task repos"
__epm_commentrepo_alt_grepremove " repo/[0-9]+/"
;;
task)
shift
__epm_commentrepo_alt_grepremove " repo/$1/"
;;
-*)
fatal "epm commentrepo: no options are supported"
;;
*)
__epm_commentrepo_alt_grepremove "$*"
;;
esac
}
epm_commentrepo()
{
case $DISTRNAME in
ALTLinux|ALTServer)
__epm_commentrepo_alt "$@"
return
;;
esac;
fatal "Have no suitable command for $PMTYPE"
}
# File bin/epm-conflicts: # File bin/epm-conflicts:
...@@ -4454,7 +4535,8 @@ __epm_get_hilevel_nameform() ...@@ -4454,7 +4535,8 @@ __epm_get_hilevel_nameform()
apt-rpm) apt-rpm)
# use # as delimeter for apt # use # as delimeter for apt
local pkg local pkg
pkg=$(rpm -q --queryformat "%{NAME}#%{SERIAL}:%{VERSION}-%{RELEASE}\n" -- $1) pkg=$(rpm -q --queryformat "%{NAME}=%{SERIAL}:%{VERSION}-%{RELEASE}\n" -- $1)
# for case if serial is missed
echo $pkg | grep -q "(none)" && pkg=$(rpm -q --queryformat "%{NAME}#%{VERSION}-%{RELEASE}\n" -- $1) echo $pkg | grep -q "(none)" && pkg=$(rpm -q --queryformat "%{NAME}#%{VERSION}-%{RELEASE}\n" -- $1)
# HACK: can use only for multiple install packages like kernel # HACK: can use only for multiple install packages like kernel
echo $pkg | grep -q kernel || return 1 echo $pkg | grep -q kernel || return 1
...@@ -5119,7 +5201,7 @@ __detect_alt_release_by_repo() ...@@ -5119,7 +5201,7 @@ __detect_alt_release_by_repo()
{ {
local BRD=$(cat /etc/apt/sources.list /etc/apt/sources.list.d/*.list \ local BRD=$(cat /etc/apt/sources.list /etc/apt/sources.list.d/*.list \
| grep -v "^#" \ | grep -v "^#" \
| egrep "[tpc][5-9]\.?[0-9]?/branch/" \ | grep -E "[tpc][5-9]\.?[0-9]?/branch/" \
| sed -e "s|.*\([tpc][5-9]\.\?[0-9]\?\)/branch.*|\1|g" \ | sed -e "s|.*\([tpc][5-9]\.\?[0-9]\?\)/branch.*|\1|g" \
| sort -u ) | sort -u )
if [ "$(__wcount $BRD)" = "1" ] ; then if [ "$(__wcount $BRD)" = "1" ] ; then
...@@ -5161,11 +5243,8 @@ get_fix_release_pkg() ...@@ -5161,11 +5243,8 @@ get_fix_release_pkg()
if [ "$TO" = "Sisyphus" ] ; then if [ "$TO" = "Sisyphus" ] ; then
TO="sisyphus" TO="sisyphus"
echo "apt-conf-$TO" echo "apt-conf-$TO"
elif [ "$TO" = "p10" ] ; then
true
#echo "apt-conf-$TO"
else else
epmqp apt-conf-branch >/dev/null 2>/dev/null || echo "apt-conf-branch" epm installed apt-conf-branch && echo "apt-conf-branch"
fi fi
if [ "$FORCE" == "--force" ] ; then if [ "$FORCE" == "--force" ] ; then
...@@ -5187,11 +5266,15 @@ get_fix_release_pkg() ...@@ -5187,11 +5266,15 @@ get_fix_release_pkg()
# workaround against obsoleted altlinux-release-sisyphus package from 2008 year # workaround against obsoleted altlinux-release-sisyphus package from 2008 year
[ "$TOINSTALL" = "altlinux-release-sisyphus" ] && TOINSTALL="branding-alt-sisyphus-release" [ "$TOINSTALL" = "altlinux-release-sisyphus" ] && TOINSTALL="branding-alt-sisyphus-release"
# update if installed (just print package name here to include in the install list) if epm installed etersoft-gpgkeys ; then
epm --quiet --short installed alt-gpgkeys 2>/dev/null # TODO: we don't support LINUX@Etersoft for now
if epm --quiet --short -q etersoft-gpgkeys 2>/dev/null >/dev/null ; then
# leave etersoft-gpgkeys only if we have LINUX@Etersoft repo # leave etersoft-gpgkeys only if we have LINUX@Etersoft repo
epm rl | grep -q "LINUX@Etersoft" && echo etersoft-gpgkeys || echo alt-gpgkeys #epm repo list | grep -q "LINUX@Etersoft" && echo "etersoft-gpgkeys" || echo "alt-gpgkeys"
epm --quiet repo comment "LINUX@Etersoft"
echo "alt-gpgkeys"
else
# update if installed (just print package name here to include in the install list)
epm query --short alt-gpgkeys 2>/dev/null
fi fi
if [ -n "$TOINSTALL" ] ; then if [ -n "$TOINSTALL" ] ; then
...@@ -6026,7 +6109,7 @@ __epm_removerepo_alt_grepremove() ...@@ -6026,7 +6109,7 @@ __epm_removerepo_alt_grepremove()
__epm_removerepo_alt() __epm_removerepo_alt()
{ {
local repo="$*" local repo="$*"
[ -n "$repo" ] || fatal "No such repo or task. Use epm repo remove <autoimports|archive|tasks|TASKNUMBER>" [ -n "$repo" ] || fatal "No such repo or task. Use epm repo remove <regexp|autoimports|archive|tasks|TASKNUMBER>"
assure_exists apt-repo assure_exists apt-repo
...@@ -6547,9 +6630,12 @@ EOF ...@@ -6547,9 +6630,12 @@ EOF
epm_addrepo "$@" epm_addrepo "$@"
epm update epm update
;; ;;
rm|remove) # HELPCMD: remove repository from sources list (epm repo remove all for all) rm|remove) # HELPCMD: remove repository from the sources lists (epm repo remove all for all)
epm_removerepo "$@" epm_removerepo "$@"
;; ;;
comment) # HELPCMD: comment out repository line from the sources lists
epm_commentrepo "$@"
;;
*) *)
fatal "Unknown command $ epm repo '$CMD'" fatal "Unknown command $ epm repo '$CMD'"
;; ;;
...@@ -6566,6 +6652,8 @@ __replace_text_in_alt_repo() ...@@ -6566,6 +6652,8 @@ __replace_text_in_alt_repo()
local i local i
for i in /etc/apt/sources.list /etc/apt/sources.list.d/*.list ; do for i in /etc/apt/sources.list /etc/apt/sources.list.d/*.list ; do
[ -s "$i" ] || continue [ -s "$i" ] || continue
# TODO: don't change file if untouched
#grep -q -- "$1" "$i" || continue
regexp_subst "$1" "$i" regexp_subst "$1" "$i"
done done
} }
...@@ -6601,7 +6689,7 @@ __replace_alt_version_in_repo() ...@@ -6601,7 +6689,7 @@ __replace_alt_version_in_repo()
local i local i
assure_exists apt-repo assure_exists apt-repo
#echo "Upgrading $DISTRNAME from $1 to $2 ..." #echo "Upgrading $DISTRNAME from $1 to $2 ..."
a='' apt-repo list | sed -e "s|\($1\)|{\1}->{$2}|g" | grep -E --color -- "$1" a='' apt-repo list | sed -E -e "s|($1)|{\1}->{$2}|g" | grep -E --color -- "$1"
# ask and replace only we will have changes # ask and replace only we will have changes
if a='' apt-repo list | grep -E -q -- "$1" ; then if a='' apt-repo list | grep -E -q -- "$1" ; then
__replace_text_in_alt_repo "/^ *#/! s!$1!$2!g" __replace_text_in_alt_repo "/^ *#/! s!$1!$2!g"
...@@ -6624,7 +6712,6 @@ __alt_repofix() ...@@ -6624,7 +6712,6 @@ __alt_repofix()
{ {
local TO="$1" local TO="$1"
epm --quiet repo fix >/dev/null epm --quiet repo fix >/dev/null
if [ -n "$TO" ] ; then if [ -n "$TO" ] ; then
# TODO: switch it in repo code # TODO: switch it in repo code
TO="$(__repofix_filter_vendor "$TO")" TO="$(__repofix_filter_vendor "$TO")"
...@@ -6638,8 +6725,12 @@ epm_reposwitch() ...@@ -6638,8 +6725,12 @@ epm_reposwitch()
[ -n "$TO" ] || fatal "run repo switch with arg (p9, p10, Sisyphus)" [ -n "$TO" ] || fatal "run repo switch with arg (p9, p10, Sisyphus)"
__replace_alt_version_in_repo "Sisyphus/" "$TO/branch/" __replace_alt_version_in_repo "Sisyphus/" "$TO/branch/"
__replace_alt_version_in_repo "[tpc][5-9]\.?[0-9]?/branch/" "$TO/branch/" __replace_alt_version_in_repo "[tpc][5-9]\.?[0-9]?/branch/" "$TO/branch/"
if [ "$TO" != "p10" ] ; then
__replace_alt_version_in_repo "p10\.?[0-9]?/branch/" "$TO/branch/" __replace_alt_version_in_repo "p10\.?[0-9]?/branch/" "$TO/branch/"
__alt_repofix $TO fi
__alt_repofix "$TO"
if [ "$TO" = "p10" ] ; then if [ "$TO" = "p10" ] ; then
echo '%_priority_distbranch p10' >/etc/rpm/macros.d/p10 echo '%_priority_distbranch p10' >/etc/rpm/macros.d/p10
else else
...@@ -7256,7 +7347,7 @@ __epm_restore_pip() ...@@ -7256,7 +7347,7 @@ __epm_restore_pip()
if [ -n "$dryrun" ] ; then if [ -n "$dryrun" ] ; then
reqmacro="%py3_use" reqmacro="%py3_use"
basename "$req_file" | egrep -q "(dev|test|coverage)" && reqmacro="%py3_buildrequires" basename "$req_file" | grep -E -q "(dev|test|coverage)" && reqmacro="%py3_buildrequires"
echo echo
__epm_restore_print_comment "$req_file" __epm_restore_print_comment "$req_file"
cat $req_file | __epm_restore_convert_to_rpm_notation | sed -e "s|^|$reqmacro |" cat $req_file | __epm_restore_convert_to_rpm_notation | sed -e "s|^|$reqmacro |"
...@@ -7758,7 +7849,7 @@ __epm_search_make_grep() ...@@ -7758,7 +7849,7 @@ __epm_search_make_grep()
echon " | sed -e \"s| .*||g\"" echon " | sed -e \"s| .*||g\""
fi fi
[ -n "$listN" ] && echon " | egrep -i -v -- \"$listN\"" [ -n "$listN" ] && echon " | grep -E -i -v -- \"$listN\""
# FIXME: The World has not idea how to do grep both string # FIXME: The World has not idea how to do grep both string
# http://stackoverflow.com/questions/10110051/grep-with-two-strings-logical-and-in-regex?rq=1 # http://stackoverflow.com/questions/10110051/grep-with-two-strings-logical-and-in-regex?rq=1
...@@ -7767,7 +7858,7 @@ __epm_search_make_grep() ...@@ -7767,7 +7858,7 @@ __epm_search_make_grep()
if [ "$(echo "$list" | wc -w)" -gt 1 ] ; then if [ "$(echo "$list" | wc -w)" -gt 1 ] ; then
for i in $list ; do for i in $list ; do
# FIXME -n on MacOS? # FIXME -n on MacOS?
echon " | egrep -i -- \"$i\"" echon " | grep -E -i -- \"$i\""
done done
fi fi
...@@ -7785,7 +7876,7 @@ __epm_search_make_grep() ...@@ -7785,7 +7876,7 @@ __epm_search_make_grep()
# TODO: use some colorifer instead grep (check grep adove too) # TODO: use some colorifer instead grep (check grep adove too)
if [ -n "$list" ] ; then if [ -n "$list" ] ; then
echon " | egrep -i $EGREPCOLOR -- \"($COLO)\"" echon " | grep -E -i $EGREPCOLOR -- \"($COLO)\""
fi fi
} }
...@@ -8313,8 +8404,8 @@ EOF ...@@ -8313,8 +8404,8 @@ EOF
# FIXME: we need strict search here (not find gst-plugins-base if search for gst-plugins # FIXME: we need strict search here (not find gst-plugins-base if search for gst-plugins
# TODO: use short? # TODO: use short?
# use verbose for get package status # use verbose for get package status
#pkg_filenames="$pkg-[0-9]" verbose=--verbose __epm_search_internal | egrep "(installed|upgrade)" && continue #pkg_filenames="$pkg-[0-9]" verbose=--verbose __epm_search_internal | grep -E "(installed|upgrade)" && continue
#pkg_filenames="$pkg" verbose=--verbose __epm_search_internal | egrep "(installed|upgrade)" && continue #pkg_filenames="$pkg" verbose=--verbose __epm_search_internal | grep -E "(installed|upgrade)" && continue
(pkg_filenames="$pkg" __epm_search_internal) | grep -q "^$pkg-[0-9]" && continue (pkg_filenames="$pkg" __epm_search_internal) | grep -q "^$pkg-[0-9]" && continue
res=1 res=1
info "Package '$pkg' does not found in repository." info "Package '$pkg' does not found in repository."
...@@ -8614,8 +8705,6 @@ epm_upgrade() ...@@ -8614,8 +8705,6 @@ epm_upgrade()
if [ "$DISTRNAME" = "ALTLinux" ] || [ "$DISTRNAME" = "ALTServer" ] ; then if [ "$DISTRNAME" = "ALTLinux" ] || [ "$DISTRNAME" = "ALTServer" ] ; then
if tasknumber "$@" >/dev/null ; then if tasknumber "$@" >/dev/null ; then
try_change_alt_repo
epm_addrepo "$@"
local installlist="$(get_task_packages $*)" local installlist="$(get_task_packages $*)"
# hack: drop -devel packages to avoid package provided by multiple packages # hack: drop -devel packages to avoid package provided by multiple packages
installlist="$(estrlist reg_exclude ".*-devel .*-devel-static" "$installlist")" installlist="$(estrlist reg_exclude ".*-devel .*-devel-static" "$installlist")"
...@@ -8623,6 +8712,13 @@ epm_upgrade() ...@@ -8623,6 +8712,13 @@ epm_upgrade()
# install only installed packages (simulate upgrade packages) # install only installed packages (simulate upgrade packages)
installlist="$(get_only_installed_packages "$installlist")" installlist="$(get_only_installed_packages "$installlist")"
[ -n "$verbose" ] && info "Packages to upgrade: $installlist" [ -n "$verbose" ] && info "Packages to upgrade: $installlist"
if [ -z "$installlist" ] ; then
warning "There is no installed packages for upgrade from task $*"
exit 22
fi
try_change_alt_repo
epm_addrepo "$@"
(pkg_names="$installlist" epm_Install) || fatal "Can't update repo" (pkg_names="$installlist" epm_Install) || fatal "Can't update repo"
epm_removerepo "$@" epm_removerepo "$@"
end_change_alt_repo end_change_alt_repo
...@@ -9573,6 +9669,10 @@ get_virt() ...@@ -9573,6 +9669,10 @@ get_virt()
echo "xen" && return echo "xen" && return
fi fi
if lscpu | grep "Hypervisor vendor:" | grep -q "KVM" ; then
echo "kvm" && return
fi
echo "(unknown)" echo "(unknown)"
# TODO: check for openvz # TODO: check for openvz
} }
...@@ -10157,19 +10257,25 @@ has_space() ...@@ -10157,19 +10257,25 @@ has_space()
list() list()
{ {
local i local i
set -f
for i in $@ ; do for i in $@ ; do
echo "$i" echo "$i"
done done
set +f
} }
count() count()
{ {
set -f
list $@ | wc -l list $@ | wc -l
set +f
} }
union() union()
{ {
set -f
strip_spaces $(list $@ | sort -u) strip_spaces $(list $@ | sort -u)
set +f
} }
intersection() intersection()
...@@ -10201,7 +10307,7 @@ match() ...@@ -10201,7 +10307,7 @@ match()
{ {
local wd="$1" local wd="$1"
shift shift
echo "$*" | egrep -q -- "$wd" echo "$*" | grep -E -q -- "$wd"
} }
...@@ -10210,9 +10316,11 @@ reg_remove() ...@@ -10210,9 +10316,11 @@ reg_remove()
{ {
local i local i
local RES= local RES=
set -f
for i in $2 ; do for i in $2 ; do
echo "$i" | grep -q "^$1$" || RES="$RES $i" echo "$i" | grep -q "^$1$" || RES="$RES $i"
done done
set +f
strip_spaces "$RES" strip_spaces "$RES"
} }
...@@ -10221,9 +10329,11 @@ reg_wordremove() ...@@ -10221,9 +10329,11 @@ reg_wordremove()
{ {
local i local i
local RES="" local RES=""
set -f
for i in $2 ; do for i in $2 ; do
echo "$i" | grep -q -w "$1" || RES="$RES $i" echo "$i" | grep -q -w "$1" || RES="$RES $i"
done done
set +f
strip_spaces "$RES" strip_spaces "$RES"
} }
...@@ -10244,9 +10354,11 @@ exclude() ...@@ -10244,9 +10354,11 @@ exclude()
{ {
local i local i
local RES="$2" local RES="$2"
set -f
for i in $1 ; do for i in $1 ; do
RES="$(reg_rqremove "$i" "$RES")" RES="$(reg_rqremove "$i" "$RES")"
done done
set +f
strip_spaces "$RES" strip_spaces "$RES"
} }
...@@ -10255,9 +10367,11 @@ reg_exclude() ...@@ -10255,9 +10367,11 @@ reg_exclude()
{ {
local i local i
local RES="$2" local RES="$2"
set -f
for i in $1 ; do for i in $1 ; do
RES="$(reg_remove "$i" "$RES")" RES="$(reg_remove "$i" "$RES")"
done done
set +f
strip_spaces "$RES" strip_spaces "$RES"
} }
...@@ -10266,18 +10380,22 @@ reg_wordexclude() ...@@ -10266,18 +10380,22 @@ reg_wordexclude()
{ {
local i local i
local RES="$2" local RES="$2"
set -f
for i in $1 ; do for i in $1 ; do
RES=$(reg_wordremove "$i" "$RES") RES=$(reg_wordremove "$i" "$RES")
done done
set +f
strip_spaces "$RES" strip_spaces "$RES"
} }
if_contain() if_contain()
{ {
local i local i
set -f
for i in $2 ; do for i in $2 ; do
[ "$i" = "$1" ] && return [ "$i" = "$1" ] && return
done done
set +f
return 1 return 1
} }
...@@ -10285,12 +10403,14 @@ difference() ...@@ -10285,12 +10403,14 @@ difference()
{ {
local RES="" local RES=""
local i local i
set -f
for i in $1 ; do for i in $1 ; do
if_contain $i "$2" || RES="$RES $i" if_contain $i "$2" || RES="$RES $i"
done done
for i in $2 ; do for i in $2 ; do
if_contain $i "$1" || RES="$RES $i" if_contain $i "$1" || RES="$RES $i"
done done
set +f
strip_spaces "$RES" strip_spaces "$RES"
} }
...@@ -10301,9 +10421,11 @@ reg_include() ...@@ -10301,9 +10421,11 @@ reg_include()
{ {
local i local i
local RES="" local RES=""
set -f
for i in $2 ; do for i in $2 ; do
echo "$i" | grep -q -w "$1" && RES="$RES $i" echo "$i" | grep -q -w "$1" && RES="$RES $i"
done done
set +f
strip_spaces "$RES" strip_spaces "$RES"
} }
...@@ -10646,7 +10768,7 @@ Examples: ...@@ -10646,7 +10768,7 @@ Examples:
print_version() print_version()
{ {
echo "EPM package manager version 3.18.6 https://wiki.etersoft.ru/Epm" echo "EPM package manager version 3.19.1 https://wiki.etersoft.ru/Epm"
echo "Running on $($DISTRVENDOR -e) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)" echo "Running on $($DISTRVENDOR -e) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)"
echo "Copyright (c) Etersoft 2012-2021" echo "Copyright (c) Etersoft 2012-2021"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3." echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
...@@ -10656,7 +10778,7 @@ print_version() ...@@ -10656,7 +10778,7 @@ print_version()
Usage="Usage: epm [options] <command> [package name(s), package files]..." Usage="Usage: epm [options] <command> [package name(s), package files]..."
Descr="epm - EPM package manager" Descr="epm - EPM package manager"
EPMVERSION=3.18.6 EPMVERSION=3.19.1
verbose=$EPM_VERBOSE verbose=$EPM_VERBOSE
quiet= quiet=
nodeps= nodeps=
......
...@@ -73,8 +73,8 @@ check_tty() ...@@ -73,8 +73,8 @@ check_tty()
check_core_commands check_core_commands
# egrep from busybox may not --color # grep -E from busybox may not --color
# egrep from MacOS print help to stderr # grep -E from MacOS print help to stderr
if grep -E --help 2>&1 | grep -q -- "--color" ; then if grep -E --help 2>&1 | grep -q -- "--color" ; then
export EGREPCOLOR="--color" export EGREPCOLOR="--color"
fi fi
...@@ -1996,6 +1996,10 @@ get_virt() ...@@ -1996,6 +1996,10 @@ get_virt()
echo "xen" && return echo "xen" && return
fi fi
if lscpu | grep "Hypervisor vendor:" | grep -q "KVM" ; then
echo "kvm" && return
fi
echo "(unknown)" echo "(unknown)"
# TODO: check for openvz # TODO: check for openvz
} }
...@@ -2580,19 +2584,25 @@ has_space() ...@@ -2580,19 +2584,25 @@ has_space()
list() list()
{ {
local i local i
set -f
for i in $@ ; do for i in $@ ; do
echo "$i" echo "$i"
done done
set +f
} }
count() count()
{ {
set -f
list $@ | wc -l list $@ | wc -l
set +f
} }
union() union()
{ {
set -f
strip_spaces $(list $@ | sort -u) strip_spaces $(list $@ | sort -u)
set +f
} }
intersection() intersection()
...@@ -2624,7 +2634,7 @@ match() ...@@ -2624,7 +2634,7 @@ match()
{ {
local wd="$1" local wd="$1"
shift shift
echo "$*" | egrep -q -- "$wd" echo "$*" | grep -E -q -- "$wd"
} }
...@@ -2633,9 +2643,11 @@ reg_remove() ...@@ -2633,9 +2643,11 @@ reg_remove()
{ {
local i local i
local RES= local RES=
set -f
for i in $2 ; do for i in $2 ; do
echo "$i" | grep -q "^$1$" || RES="$RES $i" echo "$i" | grep -q "^$1$" || RES="$RES $i"
done done
set +f
strip_spaces "$RES" strip_spaces "$RES"
} }
...@@ -2644,9 +2656,11 @@ reg_wordremove() ...@@ -2644,9 +2656,11 @@ reg_wordremove()
{ {
local i local i
local RES="" local RES=""
set -f
for i in $2 ; do for i in $2 ; do
echo "$i" | grep -q -w "$1" || RES="$RES $i" echo "$i" | grep -q -w "$1" || RES="$RES $i"
done done
set +f
strip_spaces "$RES" strip_spaces "$RES"
} }
...@@ -2667,9 +2681,11 @@ exclude() ...@@ -2667,9 +2681,11 @@ exclude()
{ {
local i local i
local RES="$2" local RES="$2"
set -f
for i in $1 ; do for i in $1 ; do
RES="$(reg_rqremove "$i" "$RES")" RES="$(reg_rqremove "$i" "$RES")"
done done
set +f
strip_spaces "$RES" strip_spaces "$RES"
} }
...@@ -2678,9 +2694,11 @@ reg_exclude() ...@@ -2678,9 +2694,11 @@ reg_exclude()
{ {
local i local i
local RES="$2" local RES="$2"
set -f
for i in $1 ; do for i in $1 ; do
RES="$(reg_remove "$i" "$RES")" RES="$(reg_remove "$i" "$RES")"
done done
set +f
strip_spaces "$RES" strip_spaces "$RES"
} }
...@@ -2689,18 +2707,22 @@ reg_wordexclude() ...@@ -2689,18 +2707,22 @@ reg_wordexclude()
{ {
local i local i
local RES="$2" local RES="$2"
set -f
for i in $1 ; do for i in $1 ; do
RES=$(reg_wordremove "$i" "$RES") RES=$(reg_wordremove "$i" "$RES")
done done
set +f
strip_spaces "$RES" strip_spaces "$RES"
} }
if_contain() if_contain()
{ {
local i local i
set -f
for i in $2 ; do for i in $2 ; do
[ "$i" = "$1" ] && return [ "$i" = "$1" ] && return
done done
set +f
return 1 return 1
} }
...@@ -2708,12 +2730,14 @@ difference() ...@@ -2708,12 +2730,14 @@ difference()
{ {
local RES="" local RES=""
local i local i
set -f
for i in $1 ; do for i in $1 ; do
if_contain $i "$2" || RES="$RES $i" if_contain $i "$2" || RES="$RES $i"
done done
for i in $2 ; do for i in $2 ; do
if_contain $i "$1" || RES="$RES $i" if_contain $i "$1" || RES="$RES $i"
done done
set +f
strip_spaces "$RES" strip_spaces "$RES"
} }
...@@ -2724,9 +2748,11 @@ reg_include() ...@@ -2724,9 +2748,11 @@ reg_include()
{ {
local i local i
local RES="" local RES=""
set -f
for i in $2 ; do for i in $2 ; do
echo "$i" | grep -q -w "$1" && RES="$RES $i" echo "$i" | grep -q -w "$1" && RES="$RES $i"
done done
set +f
strip_spaces "$RES" strip_spaces "$RES"
} }
...@@ -3137,7 +3163,7 @@ print_version() ...@@ -3137,7 +3163,7 @@ print_version()
local on_text="(host system)" local on_text="(host system)"
local virt="$($DISTRVENDOR -i)" local virt="$($DISTRVENDOR -i)"
[ "$virt" = "(unknown)" ] || [ "$virt" = "(host system)" ] || on_text="(under $virt)" [ "$virt" = "(unknown)" ] || [ "$virt" = "(host system)" ] || on_text="(under $virt)"
echo "Service manager version 3.18.6 https://wiki.etersoft.ru/Epm" echo "Service manager version 3.19.1 https://wiki.etersoft.ru/Epm"
echo "Running on $($DISTRVENDOR -e) $on_text with $SERVICETYPE" echo "Running on $($DISTRVENDOR -e) $on_text with $SERVICETYPE"
echo "Copyright (c) Etersoft 2012-2021" echo "Copyright (c) Etersoft 2012-2021"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3." echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
......
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