Commit ed89eebb authored by Vitaly Lipatov's avatar Vitaly Lipatov

commit packed 3.41.0

parent 08eafa41
...@@ -34,16 +34,6 @@ load_helper() ...@@ -34,16 +34,6 @@ load_helper()
# File bin/epm-sh-functions: # File bin/epm-sh-functions:
check_core_commands()
{
#which --help >/dev/null || fatal "Can't find which command (which package is missed?)"
# broken which on Debian systems
# TODO: use is_command and print_command_path instead of
which which >/dev/null || fatal "Can't find which command (which or debianutils package is missed?)"
which grep >/dev/null || fatal "Can't find grep command (coreutils package is missed?)"
which sed >/dev/null || fatal "Can't find sed command (sed package is missed?)"
}
inputisatty() inputisatty()
{ {
...@@ -80,7 +70,7 @@ check_tty() ...@@ -80,7 +70,7 @@ check_tty()
export EGREPCOLOR="--color" export EGREPCOLOR="--color"
fi fi
which tput >/dev/null 2>/dev/null || return is_command tput || return
# FreeBSD does not support tput -S # FreeBSD does not support tput -S
echo | tput -S >/dev/null 2>/dev/null || return echo | tput -S >/dev/null 2>/dev/null || return
[ -z "$USETTY" ] || return [ -z "$USETTY" ] || return
...@@ -204,13 +194,6 @@ sudocmd_foreach() ...@@ -204,13 +194,6 @@ sudocmd_foreach()
done done
} }
if ! which realpath 2>/dev/null >/dev/null ; then
realpath()
{
readlink -f "$@"
}
fi
make_filepath() make_filepath()
{ {
local i local i
...@@ -374,7 +357,7 @@ set_sudo() ...@@ -374,7 +357,7 @@ set_sudo()
# start error section # start error section
SUDO_TESTED="1" SUDO_TESTED="1"
if ! which $SUDO_CMD >/dev/null 2>/dev/null ; then if ! is_command $SUDO_CMD ; then
[ "$nofail" = "nofail" ] || SUDO="fatal 'Can't find sudo. Please install and tune sudo ('# epm install sudo') or run epm under root.'" [ "$nofail" = "nofail" ] || SUDO="fatal 'Can't find sudo. Please install and tune sudo ('# epm install sudo') or run epm under root.'"
return "$SUDO_TESTED" return "$SUDO_TESTED"
fi fi
...@@ -409,7 +392,7 @@ sudo_allowed() ...@@ -409,7 +392,7 @@ sudo_allowed()
withtimeout() withtimeout()
{ {
local TO=$(which timeout 2>/dev/null || which gtimeout 2>/dev/null) local TO=$(print_command_path timeout || print_command_path gtimeout)
if [ -x "$TO" ] ; then if [ -x "$TO" ] ; then
$TO "$@" $TO "$@"
return return
...@@ -427,7 +410,7 @@ set_eatmydata() ...@@ -427,7 +410,7 @@ set_eatmydata()
# skip if disabled # skip if disabled
[ -n "$EPMNOEATMYDATA" ] && return [ -n "$EPMNOEATMYDATA" ] && return
# use if possible # use if possible
which eatmydata >/dev/null 2>/dev/null || return is_command eatmydata || return
set_sudo set_sudo
# FIXME: check if SUDO already has eatmydata # FIXME: check if SUDO already has eatmydata
[ -n "$SUDO" ] && SUDO="$SUDO eatmydata" || SUDO="eatmydata" [ -n "$SUDO" ] && SUDO="$SUDO eatmydata" || SUDO="eatmydata"
...@@ -518,7 +501,7 @@ disabled_eget() ...@@ -518,7 +501,7 @@ disabled_eget()
# FIXME: we need disable output here, eget can be used for get output # FIXME: we need disable output here, eget can be used for get output
assure_exists eget eget 3.3 >/dev/null assure_exists eget eget 3.3 >/dev/null
# run external command, not the function # run external command, not the function
EGET=$(which eget) || fatal "Missed command eget from installed package eget" EGET=$(print_command_path eget) || fatal "Missed command eget from installed package eget"
$EGET "$@" $EGET "$@"
} }
...@@ -535,7 +518,7 @@ disabled_erc() ...@@ -535,7 +518,7 @@ disabled_erc()
# FIXME: we need disable output here, ercat can be used for get output # FIXME: we need disable output here, ercat can be used for get output
assure_exists_erc >/dev/null assure_exists_erc >/dev/null
# run external command, not the function # run external command, not the function
ERC=$(which erc) || fatal "Missed command erc from installed package erc" ERC=$(print_command_path erc) || fatal "Missed command erc from installed package erc"
$ERC "$@" $ERC "$@"
} }
...@@ -552,7 +535,7 @@ disabled_ercat() ...@@ -552,7 +535,7 @@ disabled_ercat()
# FIXME: we need disable output here, ercat can be used for get output # FIXME: we need disable output here, ercat can be used for get output
assure_exists_erc >/dev/null assure_exists_erc >/dev/null
# run external command, not the function # run external command, not the function
ERCAT=$(which ercat) || fatal "Missed command ercat from installed package erc" ERCAT=$(print_command_path ercat) || fatal "Missed command ercat from installed package erc"
$ERCAT "$@" $ERCAT "$@"
} }
...@@ -573,8 +556,9 @@ estrlist() ...@@ -573,8 +556,9 @@ estrlist()
eget() eget()
{ {
# check for both # check for both
which curl 2>/dev/null >/dev/null || assure_exists wget # we really need that cross here,
which wget 2>/dev/null >/dev/null || assure_exists curl is_command curl || assure_exists wget
is_command wget || assure_exists curl
internal_tools_eget "$@" internal_tools_eget "$@"
} }
...@@ -759,7 +743,7 @@ is_command() ...@@ -759,7 +743,7 @@ is_command()
} }
if ! which realpath 2>/dev/null >/dev/null ; then if ! is_command realpath ; then
realpath() realpath()
{ {
[ -n "$*" ] || return [ -n "$*" ] || return
...@@ -768,13 +752,26 @@ realpath() ...@@ -768,13 +752,26 @@ realpath()
fi fi
if ! which subst 2>/dev/null >/dev/null ; then
if ! is_command subst ; then
subst() subst()
{ {
sed -i -e "$@" sed -i -e "$@"
} }
fi fi
check_core_commands()
{
#which --help >/dev/null || fatal "Can't find which command (which package is missed?)"
# broken which on Debian systems
# TODO: use is_command and print_command_path instead of
which which >/dev/null || fatal "Can't find which command (which or debianutils package is missed?)"
is_command grep || fatal "Can't find grep command (coreutils package is missed?)"
is_command sed || fatal "Can't find sed command (sed package is missed?)"
}
# File bin/serv-cat: # File bin/serv-cat:
serv_cat() serv_cat()
...@@ -1582,9 +1579,17 @@ case $DISTRIB_ID in ...@@ -1582,9 +1579,17 @@ case $DISTRIB_ID in
CMD="urpm-rpm" CMD="urpm-rpm"
;; ;;
ROSA) ROSA)
CMD="dnf-rpm" CMD="urpm-rpm"
hascommand dnf || CMD="yum-rpm" hascommand yum && CMD="yum-rpm"
[ "$DISTRIB_ID/$DISTRIB_RELEASE" = "ROSA/2020" ] && CMD="urpm-rpm" hascommand dnf && CMD="dnf-rpm"
#[ "$DISTRIB_ID/$DISTRIB_RELEASE" = "ROSA/2020" ] && CMD="urpm-rpm"
;;
ROSAFresh)
CMD="urpm-rpm"
hascommand yum && CMD="yum-rpm"
hascommand dnf && CMD="dnf-rpm"
# use dnf since 2020
#[ "$DISTRIB_ID/$DISTRIB_RELEASE" = "ROSA/2020" ] && CMD="urpm-rpm"
;; ;;
FreeBSD|NetBSD|OpenBSD|Solaris) FreeBSD|NetBSD|OpenBSD|Solaris)
CMD="pkgsrc" CMD="pkgsrc"
...@@ -1645,12 +1650,12 @@ case $DISTRIB_ID in ...@@ -1645,12 +1650,12 @@ case $DISTRIB_ID in
echo "apt-dpkg" && return echo "apt-dpkg" && return
fi fi
if hascommand "rpm" && [ -s /var/lib/rpm/Name ] ; then if hascommand "rpm" && [ -s /var/lib/rpm/Name ] || [ -s /var/lib/rpm/rpmdb.sqlite ] ; then
hascommand "zypper" && echo "zypper-rpm" && return hascommand "zypper" && echo "zypper-rpm" && return
hascommand "dnf" && echo "dnf-rpm" && return hascommand "dnf" && echo "dnf-rpm" && return
hascommand "apt-get" && echo "apt-rpm" && return hascommand "apt-get" && echo "apt-rpm" && return
hascommand "yum" && echo "yum-rpm" && return hascommand "yum" && echo "yum-rpm" && return
hascommand "urpmi" && echo "urpmi-rpm" && return hascommand "urpmi" && echo "urpm-rpm" && return
fi fi
if hascommand "dpkg" && [ -s /var/lib/dpkg/status ] ; then if hascommand "dpkg" && [ -s /var/lib/dpkg/status ] ; then
...@@ -1734,6 +1739,9 @@ normalize_name() ...@@ -1734,6 +1739,9 @@ normalize_name()
"Red Hat Enterprise Linux Server") "Red Hat Enterprise Linux Server")
echo "RHEL" echo "RHEL"
;; ;;
"ROSA Fresh"*|"ROSA Desktop Fresh"*)
echo "ROSAFresh"
;;
"ROSA Chrome Desktop") "ROSA Chrome Desktop")
echo "ROSA" echo "ROSA"
;; ;;
...@@ -1840,9 +1848,9 @@ esac ...@@ -1840,9 +1848,9 @@ esac
case "$DISTRIB_ID" in case "$DISTRIB_ID" in
"ALTLinux") "ALTLinux")
echo "$VERSION" | grep -q "c9.* branch" && DISTRIB_RELEASE="c9" echo "$VERSION" | grep -q "c9.* branch" && DISTRIB_RELEASE="c9"
echo "$VERSION" | grep -q "c9f1 branch" && DISTRIB_RELEASE="c9f1"
echo "$VERSION" | grep -q "c9f2 branch" && DISTRIB_RELEASE="c9f2"
DISTRIB_CODENAME="$DISTRIB_RELEASE" DISTRIB_CODENAME="$DISTRIB_RELEASE"
echo "$VERSION" | grep -q "c9f1 branch" && DISTRIB_CODENAME="c9f1"
echo "$VERSION" | grep -q "c9f2 branch" && DISTRIB_CODENAME="c9f2"
# FIXME: fast hack for fallback: 10.1 -> p10 for /etc/os-release # FIXME: fast hack for fallback: 10.1 -> p10 for /etc/os-release
if echo "$DISTRIB_RELEASE" | grep -q "^[0-9]" && echo "$DISTRIB_RELEASE" | grep -q -v "[0-9][0-9][0-9]" ; then if echo "$DISTRIB_RELEASE" | grep -q "^[0-9]" && echo "$DISTRIB_RELEASE" | grep -q -v "[0-9][0-9][0-9]" ; then
DISTRIB_RELEASE="$(echo p$DISTRIB_RELEASE | sed -e 's|\..*||')" DISTRIB_RELEASE="$(echo p$DISTRIB_RELEASE | sed -e 's|\..*||')"
...@@ -1875,6 +1883,9 @@ case "$DISTRIB_ID" in ...@@ -1875,6 +1883,9 @@ case "$DISTRIB_ID" in
DISTRIB_RELEASE="Sisyphus" DISTRIB_RELEASE="Sisyphus"
DISTRIB_CODENAME="$DISTRIB_RELEASE" DISTRIB_CODENAME="$DISTRIB_RELEASE"
;; ;;
"ROSAFresh")
DISTRIB_CODENAME="$DISTRIB_RELEASE"
;;
esac esac
...@@ -2296,9 +2307,9 @@ cat <<EOF ...@@ -2296,9 +2307,9 @@ cat <<EOF
distro_info v$PROGVERSION : Copyright © 2007-2023 Etersoft distro_info v$PROGVERSION : Copyright © 2007-2023 Etersoft
Pretty distro name (--pretty): $(print_pretty_name) Pretty distro name (--pretty): $(print_pretty_name)
Distro name / version: $DISTRO_NAME / $DISTRIB_FULL_RELEASE$orig Distro name / version (--distro-name/version): $DISTRO_NAME / $DISTRIB_FULL_RELEASE$orig
Base distro name (-d) / version (-v): $(print_name_version) Base distro name (-d) / version (-v): $(print_name_version)
Base distro name (-s) / Repo name (-r): $(pkgvendor) / $(print_repo_name) Vendor distro name (-s) / Repo name (-r): $(pkgvendor) / $(print_repo_name)
Package manager/type (-g/-p): $(pkgmanager) / $(pkgtype) Package manager/type (-g/-p): $(pkgmanager) / $(pkgtype)
Base OS name (-o) / CPU arch (-a): $(get_base_os_name) $(get_arch) Base OS name (-o) / CPU arch (-a): $(get_base_os_name) $(get_arch)
Bug report URL (--bug-report-url): $(print_bug_report_url) Bug report URL (--bug-report-url): $(print_bug_report_url)
...@@ -2339,14 +2350,14 @@ case "$1" in ...@@ -2339,14 +2350,14 @@ case "$1" in
echo " -o | --os-name - print base OS name" echo " -o | --os-name - print base OS name"
echo " -p | package-type - print type of the packaging system" echo " -p | package-type - print type of the packaging system"
echo " -g - print name of the packaging system" echo " -g - print name of the packaging system"
echo " -s|-n|--vendor-name - print base name of the distro (vendor name) (ubuntu for all Ubuntu family, alt for all ALT family) (see _vendor macros in rpm)" echo " -s|-n|--vendor-name - print name of the distro family (vendor name) (ubuntu for all Ubuntu family, alt for all ALT family) (see _vendor macros in rpm)"
echo " --pretty|--pretty-name - print pretty distro name" echo " --pretty|--pretty-name - print pretty distro name"
echo " -v | --base-version - print version of the distro" echo " -v | --base-version - print version of the distro"
echo " --distro-name - print distro name" echo " --distro-name - print distro name"
echo " --distro-version - print full version of the distro" echo " --distro-version - print full version of the distro"
echo " --full-version - print full version of the distro" echo " --full-version - print full version of the distro"
echo " --codename (obsoleted) - print distro codename (focal for Ubuntu 20.04)" echo " --codename (obsoleted) - print distro codename (focal for Ubuntu 20.04)"
echo " --repo-name - print repository name (focal for Ubuntu 20.04)" echo " -r|--repo-name - print repository name (focal for Ubuntu 20.04)"
echo " --build-id - print a string uniquely identifying the system image originally used as the installation base" echo " --build-id - print a string uniquely identifying the system image originally used as the installation base"
echo " -V - print the utility version" echo " -V - print the utility version"
echo "Run without args to print all information." echo "Run without args to print all information."
...@@ -2565,7 +2576,7 @@ print_version() ...@@ -2565,7 +2576,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.40.1 https://wiki.etersoft.ru/Epm" echo "Service manager version 3.41.0 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