Commit 15b249b6 authored by Vitaly Lipatov's avatar Vitaly Lipatov

commit packed 3.15.0

parent 28c07554
...@@ -1628,7 +1628,7 @@ epm_checkpkg() ...@@ -1628,7 +1628,7 @@ epm_checkpkg()
{ {
if [ -n "$pkg_names" ] ; then if [ -n "$pkg_names" ] ; then
# TODO: если есть / или расширение, это отсутствующий файл # TODO: если есть / или расширение, это отсутствующий файл
info "Suggest $pkg_names are name(s) of installed packages" info "Suggest $pkg_names are name(s) of installed package(s)"
__epm_check_installed_pkg $pkg_names __epm_check_installed_pkg $pkg_names
return return
fi fi
...@@ -1638,7 +1638,7 @@ epm_checkpkg() ...@@ -1638,7 +1638,7 @@ epm_checkpkg()
__handle_pkg_urls_to_checking __handle_pkg_urls_to_checking
fi fi
[ -n "$pkg_files" ] || fatal "Checkpkg: filename is missed" [ -n "$pkg_files" ] || fatal "Checkpkg: filename(s) is missed"
local RETVAL=0 local RETVAL=0
...@@ -4545,16 +4545,17 @@ __do_query_real_file() ...@@ -4545,16 +4545,17 @@ __do_query_real_file()
fi fi
if [ -n "$short" ] ; then if [ -n "$short" ] ; then
__do_short_query "$TOFILE" __do_short_query "$TOFILE" || return
else else
__do_query "$TOFILE" __do_query "$TOFILE" || return
fi fi
# get value of symbolic link # get value of symbolic link
if [ -L "$TOFILE" ] ; then if [ -n "$TOFILE" ] && [ -L "$TOFILE" ] ; then
local LINKTO local LINKTO
LINKTO=$(readlink -- "$TOFILE") LINKTO=$(readlink -- "$TOFILE")
info " > $TOFILE is link to $LINKTO" info " > $TOFILE is link to $LINKTO"
LINKTO=$(readlink -f -- "$TOFILE")
__do_query_real_file "$LINKTO" __do_query_real_file "$LINKTO"
return return
fi fi
...@@ -4564,7 +4565,8 @@ dpkg_print_name_version() ...@@ -4564,7 +4565,8 @@ dpkg_print_name_version()
{ {
local ver i local ver i
for i in "$@" ; do for i in "$@" ; do
ver=$(dpkg -s $i 2>/dev/null | grep "Version:" | sed -e "s|Version: ||g") [ -n "$i" ] || continue
ver=$(dpkg -s "$i" 2>/dev/null | grep "Version:" | sed -e "s|Version: ||g")
if [ -z "$ver" ] ; then if [ -z "$ver" ] ; then
echo "$i" echo "$i"
else else
...@@ -4580,7 +4582,7 @@ __do_query() ...@@ -4580,7 +4582,7 @@ __do_query()
case $PMTYPE in case $PMTYPE in
*-dpkg) *-dpkg)
showcmd dpkg -S "$1" showcmd dpkg -S "$1"
dpkg_print_name_version "$(dpkg -S $1 | grep -v "^diversion by" | sed -e "s|:.*||")" dpkg_print_name_version "$(dpkg -S "$1" | grep -v "^diversion by" | sed -e "s|:.*||")"
return ;; return ;;
*-rpm) *-rpm)
CMD="rpm -qf" CMD="rpm -qf"
...@@ -4961,7 +4963,9 @@ assure_safe_run() ...@@ -4961,7 +4963,9 @@ assure_safe_run()
if [ -n "$force" ] ; then if [ -n "$force" ] ; then
warning "You force runnning even if systemd-logind kills screen on disconnect" warning "You force runnning even if systemd-logind kills screen on disconnect"
else else
docmd epm install systemd-settings-disable-kill-user-processes || fatal "Can't install the package above. Fix it or run with --force." if ! epm installed systemd-settings-disable-kill-user-processes ; then
docmd epm install systemd-settings-disable-kill-user-processes || fatal "Can't install the package above. Fix it or run with --force."
fi
# commented, will kick off the user from the system (ALT issue 50580) # commented, will kick off the user from the system (ALT issue 50580)
#docmd serv systemd-logind restart || fatal "Can't restart systemd-logind service. Fix it or run with --force." #docmd serv systemd-logind restart || fatal "Can't restart systemd-logind service. Fix it or run with --force."
fatal "Now you need relogin to the system. In this session your screen still will be killed." fatal "Now you need relogin to the system. In this session your screen still will be killed."
...@@ -5390,10 +5394,46 @@ epm_release_upgrade() ...@@ -5390,10 +5394,46 @@ epm_release_upgrade()
showcmd epm Upgrade showcmd epm Upgrade
;; ;;
dnf-rpm) dnf-rpm)
if [ "$DISTRNAME/$DISTRVERSION" = "CentOS/8" ] ; then
if [ "$1" = "RockyLinux" ] ; then
info "https://github.com/rocky-linux/rocky-tools/tree/main/migrate2rocky/"
confirm_info "Switch to Rocky Linux 8.x"
cd /tmp
showcmd epm install git
sudocmd git clone https://github.com/rocky-linux/rocky-tools.git || fatal
sudocmd bash rocky-tools/migrate2rocky/migrate2rocky.sh -r
exit
fi
if [ "$1" = "OracleLinux" ] ; then
info "Check https://t.me/srv_admin/1630"
confirm_info "Switch to Oracle Linux 8.x"
cd /tmp
showcmd epm install git
sudocmd sed -i -r \
-e 's!^mirrorlist=!#mirrorlist=!' \
-e 's!^#?baseurl=http://(mirror|vault).centos.org/\$contentdir/\$releasever/!baseurl=https://dl.rockylinux.org/vault/centos/8.5.2111/!i' \
/etc/yum.repos.d/CentOS-*.repo
sudocmd git clone https://github.com/oracle/centos2ol.git || fatal
a= bash centos2ol/centos2ol.sh
exit
fi
info "Check https://www.cyberciti.biz/howto/upgrade-migrate-from-centos-8-to-centos-stream-conversion/"
confirm_info "Switch to CentOS Stream?"
sudocmd sed -i -r \
-e 's!^mirrorlist=!#mirrorlist=!' \
-e 's!^#?baseurl=http://(mirror|vault).centos.org/\$contentdir/\$releasever/!baseurl=https://dl.rockylinux.org/vault/centos/8.5.2111/!i' \
/etc/yum.repos.d/CentOS-*.repo
docmd epm install centos-release-stream
sudocmd dnf swap centos-{linux,stream}-repos
sudocmd dnf distro-sync
info "You can run '# epm autoorphans' to remove orphaned packages"
exit
fi
info "Check https://fedoraproject.org/wiki/DNF_system_upgrade for an additional info" info "Check https://fedoraproject.org/wiki/DNF_system_upgrade for an additional info"
docmd epm install dnf
#docmd epm install epel-release yum-utils #docmd epm install epel-release yum-utils
sudocmd dnf --refresh upgrade sudocmd dnf --refresh upgrade || fatal
sudocmd dnf clean all sudocmd dnf clean all
assure_exists dnf-plugin-system-upgrade assure_exists dnf-plugin-system-upgrade
sudocmd dnf upgrade --refresh sudocmd dnf upgrade --refresh
...@@ -5406,7 +5446,7 @@ epm_release_upgrade() ...@@ -5406,7 +5446,7 @@ epm_release_upgrade()
# dnf system-upgrade reboot # dnf system-upgrade reboot
# FIXME: download all packages again # FIXME: download all packages again
sudocmd dnf distro-sync --releasever=$RELEASEVER sudocmd dnf distro-sync --releasever=$RELEASEVER
info "Run epm autoorphans to remove orphaned packages" info "You can run '# epm autoorphans' to remove orphaned packages"
;; ;;
urpm-rpm) urpm-rpm)
sudocmd urpmi.removemedia -av sudocmd urpmi.removemedia -av
...@@ -6147,7 +6187,7 @@ __epm_repack_to_rpm() ...@@ -6147,7 +6187,7 @@ __epm_repack_to_rpm()
VERSION='' VERSION=''
# convert tarballs to tar (for alien) # convert tarballs to tar (for alien)
if ! echo "$pkg" | grep -q "\.rpm" && ! echo "$pkg" | grep -q "\.deb" ; then if ! echo "$pkg" | grep -q "\.rpm" && ! echo "$pkg" | grep -q "\.deb" ; then
VERSION="$(echo "$alpkg" | grep -o -P "[-_.]([0-9])(\.[0-9])*" | head -n1 | sed -e 's|^[-_.]||')" #" VERSION="$(echo "$alpkg" | grep -o -P "[-_.]([0-9])([0-9])*(\.[0-9])*" | head -n1 | sed -e 's|^[-_.]||')" #"
if [ -n "$VERSION" ] ; then if [ -n "$VERSION" ] ; then
PKGNAME="$(echo "$alpkg" | sed -e "s|[-_.]$VERSION.*||")" PKGNAME="$(echo "$alpkg" | sed -e "s|[-_.]$VERSION.*||")"
pkgtype="$(a= erc type $alpkg)" pkgtype="$(a= erc type $alpkg)"
...@@ -6289,7 +6329,7 @@ epm_repack() ...@@ -6289,7 +6329,7 @@ epm_repack()
epm_repo() epm_repo()
{ {
local CMD="$1" local CMD="$1"
shift [ -n "$CMD" ] && shift
case $CMD in case $CMD in
"-h"|"--help"|help) # HELPCMD: help "-h"|"--help"|help) # HELPCMD: help
get_help HELPCMD $SHAREDIR/epm-repo get_help HELPCMD $SHAREDIR/epm-repo
...@@ -6633,7 +6673,7 @@ print_apt_sources_list() ...@@ -6633,7 +6673,7 @@ print_apt_sources_list()
epm_repolist() epm_repolist()
{ {
[ -z "$*" ] || fatal "No arguments are allowed here" [ -z "$*" ] || [ "$PMTYPE" = "apt-rpm" ] || fatal "No arguments are allowed here"
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
...@@ -7009,6 +7049,10 @@ __epm_restore_convert_to_rpm_notation() ...@@ -7009,6 +7049,10 @@ __epm_restore_convert_to_rpm_notation()
[ -n "$verbose" ] && warning " $t is python2 only requirement, skipped" [ -n "$verbose" ] && warning " $t is python2 only requirement, skipped"
continue continue
fi fi
if echo "$l" | grep -q "; *python_version *<= *['\"]2\." ; then
[ -n "$verbose" ] && warning " $t is python2 only requirement, skipped"
continue
fi
# drop various "python_version > '3.5'" # drop various "python_version > '3.5'"
l="$(echo "$l" | sed -e "s| *;.*||")" l="$(echo "$l" | sed -e "s| *;.*||")"
if echo "$l" | grep -qE "^ *#" || [ -z "$l" ] ; then if echo "$l" | grep -qE "^ *#" || [ -z "$l" ] ; then
...@@ -8647,7 +8691,7 @@ has() ...@@ -8647,7 +8691,7 @@ has()
# Has a system the specified command? # Has a system the specified command?
hascommand() hascommand()
{ {
which $1 2>/dev/null >/dev/null which "$1" 2>/dev/null >/dev/null
} }
firstupper() firstupper()
...@@ -8674,6 +8718,7 @@ override_distrib() ...@@ -8674,6 +8718,7 @@ override_distrib()
rpmvendor() rpmvendor()
{ {
[ "$DISTRIB_ID" = "ALTLinux" ] && echo "alt" && return [ "$DISTRIB_ID" = "ALTLinux" ] && echo "alt" && return
[ "$DISTRIB_ID" = "ALTServer" ] && echo "alt" && return
[ "$DISTRIB_ID" = "AstraLinux" ] && echo "astra" && return [ "$DISTRIB_ID" = "AstraLinux" ] && echo "astra" && return
[ "$DISTRIB_ID" = "LinuxXP" ] && echo "lxp" && return [ "$DISTRIB_ID" = "LinuxXP" ] && echo "lxp" && return
[ "$DISTRIB_ID" = "TinyCoreLinux" ] && echo "tcl" && return [ "$DISTRIB_ID" = "TinyCoreLinux" ] && echo "tcl" && return
...@@ -8692,32 +8737,6 @@ pkgvendor() ...@@ -8692,32 +8737,6 @@ pkgvendor()
rpmvendor rpmvendor
} }
# Print pkgtype (need DISTRIB_ID var)
pkgtype()
{
# TODO: try use generic names
case $(pkgvendor) in
freebsd) echo "tbz" ;;
sunos) echo "pkg.gz" ;;
slackware|mopslinux) echo "tgz" ;;
archlinux|manjaro) echo "pkg.tar.xz" ;;
gentoo) echo "tbz2" ;;
windows) echo "exe" ;;
android) echo "apk" ;;
alpine) echo "apk" ;;
tinycorelinux) echo "tcz" ;;
voidlinux) echo "xbps" ;;
openwrt) echo "ipk" ;;
cygwin) echo "tar.xz" ;;
debian|ubuntu|mint|runtu|mcst|astra|kali) echo "deb" ;;
alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles)
echo "rpm" ;;
fedora|redhat|redos|scientific|centos|rhel|goslinux|amzn)
echo "rpm" ;;
*) echo "rpm" ;;
esac
}
# TODO: in more appropriate way # TODO: in more appropriate way
#which pkcon 2>/dev/null >/dev/null && info "You can run $ PMTYPE=packagekit epm to use packagekit backend" #which pkcon 2>/dev/null >/dev/null && info "You can run $ PMTYPE=packagekit epm to use packagekit backend"
...@@ -8728,9 +8747,12 @@ local CMD ...@@ -8728,9 +8747,12 @@ local CMD
# FIXME: some problems with multibased distros (Server Edition on CentOS and Desktop Edition on Ubuntu) # FIXME: some problems with multibased distros (Server Edition on CentOS and Desktop Edition on Ubuntu)
case $DISTRIB_ID in case $DISTRIB_ID in
ALTLinux) ALTLinux)
CMD="apt-rpm"
#which ds-install 2>/dev/null >/dev/null && CMD=deepsolver-rpm #which ds-install 2>/dev/null >/dev/null && CMD=deepsolver-rpm
#which pkcon 2>/dev/null >/dev/null && CMD=packagekit-rpm #which pkcon 2>/dev/null >/dev/null && CMD=packagekit-rpm
CMD="apt-rpm"
;;
ALTServer)
CMD="apt-rpm"
;; ;;
PCLinux) PCLinux)
CMD="apt-rpm" CMD="apt-rpm"
...@@ -8738,7 +8760,7 @@ case $DISTRIB_ID in ...@@ -8738,7 +8760,7 @@ case $DISTRIB_ID in
Ubuntu|Debian|Mint|AstraLinux|Elbrus) Ubuntu|Debian|Mint|AstraLinux|Elbrus)
CMD="apt-dpkg" CMD="apt-dpkg"
#which aptitude 2>/dev/null >/dev/null && CMD=aptitude-dpkg #which aptitude 2>/dev/null >/dev/null && CMD=aptitude-dpkg
which snappy 2>/dev/null >/dev/null && CMD=snappy hascommand snappy && CMD=snappy
;; ;;
Mandriva|ROSA) Mandriva|ROSA)
CMD="urpm-rpm" CMD="urpm-rpm"
...@@ -8753,9 +8775,9 @@ case $DISTRIB_ID in ...@@ -8753,9 +8775,9 @@ case $DISTRIB_ID in
ArchLinux) ArchLinux)
CMD="pacman" CMD="pacman"
;; ;;
Fedora|FedoraLinux|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux|Amzn|RedOS) Fedora|FedoraLinux|LinuxXP|ASPLinux|CentOS|OracleLinux|RockyLinux|AlmaLinux|RHEL|Scientific|GosLinux|Amzn|RedOS)
CMD="dnf-rpm" CMD="dnf-rpm"
which dnf 2>/dev/null >/dev/null || CMD=yum-rpm hascommand dnf || CMD=yum-rpm
[ "$DISTRIB_ID/$DISTRIB_RELEASE" = "CentOS/7" ] && CMD=yum-rpm [ "$DISTRIB_ID/$DISTRIB_RELEASE" = "CentOS/7" ] && CMD=yum-rpm
;; ;;
Slackware) Slackware)
...@@ -8769,8 +8791,8 @@ case $DISTRIB_ID in ...@@ -8769,8 +8791,8 @@ case $DISTRIB_ID in
;; ;;
Windows) Windows)
CMD="appget" CMD="appget"
which $CMD 2>/dev/null >/dev/null || CMD="chocolatey" hascommand $CMD || CMD="chocolatey"
which $CMD 2>/dev/null >/dev/null || CMD="winget" hascommand $CMD || CMD="winget"
;; ;;
MacOS) MacOS)
CMD="homebrew" CMD="homebrew"
...@@ -8797,12 +8819,53 @@ case $DISTRIB_ID in ...@@ -8797,12 +8819,53 @@ case $DISTRIB_ID in
CMD="xbps" CMD="xbps"
;; ;;
*) *)
# try detect firstly
if hascommand "rpm" ; then
hascommand "urpmi" && echo "urpmi-rpm" && return
hascommand "zypper" && echo "zypper-rpm" && return
hascommand "apt-get" && echo "apt-rpm" && return
hascommand "dnf" && echo "dnf-rpm" && return
fi
if hascommand "dpkg" ; then
hascommand "apt" && echo "apt-dpkg" && return
hascommand "apt-get" && echo "apt-dpkg" && return
fi
echo "We don't support yet DISTRIB_ID $DISTRIB_ID" >&2 echo "We don't support yet DISTRIB_ID $DISTRIB_ID" >&2
;; ;;
esac esac
echo "$CMD" echo "$CMD"
} }
# Print pkgtype (need DISTRIB_ID var)
pkgtype()
{
# TODO: try use generic names
case $(pkgvendor) in
freebsd) echo "tbz" ;;
sunos) echo "pkg.gz" ;;
slackware|mopslinux) echo "tgz" ;;
archlinux|manjaro) echo "pkg.tar.xz" ;;
gentoo) echo "tbz2" ;;
windows) echo "exe" ;;
android) echo "apk" ;;
alpine) echo "apk" ;;
tinycorelinux) echo "tcz" ;;
voidlinux) echo "xbps" ;;
openwrt) echo "ipk" ;;
cygwin) echo "tar.xz" ;;
*)
case $(pkgmanager) in
*-dpkg)
echo "dpkg" ;;
*-rpm)
echo "rpm" ;;
*)
echo "rpm" ;;
esac
esac
}
get_var() get_var()
{ {
# get first variable and print it out, drop quotes if exists # get first variable and print it out, drop quotes if exists
...@@ -8819,6 +8882,9 @@ normalize_name() ...@@ -8819,6 +8882,9 @@ normalize_name()
{ {
[ "$1" = "RED OS" ] && echo "RedOS" && return [ "$1" = "RED OS" ] && echo "RedOS" && return
[ "$1" = "CentOS Linux" ] && echo "CentOS" && return [ "$1" = "CentOS Linux" ] && echo "CentOS" && return
[ "$1" = "Rocky Linux" ] && echo "RockyLinux" && return
[ "$1" = "Oracle Linux" ] && echo "OracleLinux" && return
[ "$1" = "Alma Linux" ] && echo "AlmaLinux" && return
#echo "${1// /}" #echo "${1// /}"
echo "$1" | sed -e "s/ //g" echo "$1" | sed -e "s/ //g"
} }
...@@ -8858,6 +8924,8 @@ if distro altlinux-release ; then ...@@ -8858,6 +8924,8 @@ if distro altlinux-release ; then
DISTRIB_RELEASE="$(echo p$DISTRIB_RELEASE | sed -e 's|\..*||')" DISTRIB_RELEASE="$(echo p$DISTRIB_RELEASE | sed -e 's|\..*||')"
if has Sisyphus ; then DISTRIB_RELEASE="Sisyphus" if has Sisyphus ; then DISTRIB_RELEASE="Sisyphus"
elif has "ALT p10.* p10 " ; then DISTRIB_RELEASE="p10" elif has "ALT p10.* p10 " ; then DISTRIB_RELEASE="p10"
elif has "ALTServer 10." ; then DISTRIB_RELEASE="p10"
elif has "ALTServer 9." ; then DISTRIB_RELEASE="p9"
elif has "ALT c10.* c10 " ; then DISTRIB_RELEASE="c10" elif has "ALT c10.* c10 " ; then DISTRIB_RELEASE="c10"
elif has "ALT p9.* p9 " ; then DISTRIB_RELEASE="p9" elif has "ALT p9.* p9 " ; then DISTRIB_RELEASE="p9"
elif has "ALT 9 SP " ; then DISTRIB_RELEASE="c9" elif has "ALT 9 SP " ; then DISTRIB_RELEASE="c9"
...@@ -10222,7 +10290,7 @@ Examples: ...@@ -10222,7 +10290,7 @@ Examples:
print_version() print_version()
{ {
echo "EPM package manager version 3.14.7 https://wiki.etersoft.ru/Epm" echo "EPM package manager version 3.15.0 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."
...@@ -10232,7 +10300,7 @@ print_version() ...@@ -10232,7 +10300,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.14.7 EPMVERSION=3.15.0
verbose= verbose=
quiet= quiet=
nodeps= nodeps=
......
...@@ -1314,7 +1314,7 @@ has() ...@@ -1314,7 +1314,7 @@ has()
# Has a system the specified command? # Has a system the specified command?
hascommand() hascommand()
{ {
which $1 2>/dev/null >/dev/null which "$1" 2>/dev/null >/dev/null
} }
firstupper() firstupper()
...@@ -1341,6 +1341,7 @@ override_distrib() ...@@ -1341,6 +1341,7 @@ override_distrib()
rpmvendor() rpmvendor()
{ {
[ "$DISTRIB_ID" = "ALTLinux" ] && echo "alt" && return [ "$DISTRIB_ID" = "ALTLinux" ] && echo "alt" && return
[ "$DISTRIB_ID" = "ALTServer" ] && echo "alt" && return
[ "$DISTRIB_ID" = "AstraLinux" ] && echo "astra" && return [ "$DISTRIB_ID" = "AstraLinux" ] && echo "astra" && return
[ "$DISTRIB_ID" = "LinuxXP" ] && echo "lxp" && return [ "$DISTRIB_ID" = "LinuxXP" ] && echo "lxp" && return
[ "$DISTRIB_ID" = "TinyCoreLinux" ] && echo "tcl" && return [ "$DISTRIB_ID" = "TinyCoreLinux" ] && echo "tcl" && return
...@@ -1359,32 +1360,6 @@ pkgvendor() ...@@ -1359,32 +1360,6 @@ pkgvendor()
rpmvendor rpmvendor
} }
# Print pkgtype (need DISTRIB_ID var)
pkgtype()
{
# TODO: try use generic names
case $(pkgvendor) in
freebsd) echo "tbz" ;;
sunos) echo "pkg.gz" ;;
slackware|mopslinux) echo "tgz" ;;
archlinux|manjaro) echo "pkg.tar.xz" ;;
gentoo) echo "tbz2" ;;
windows) echo "exe" ;;
android) echo "apk" ;;
alpine) echo "apk" ;;
tinycorelinux) echo "tcz" ;;
voidlinux) echo "xbps" ;;
openwrt) echo "ipk" ;;
cygwin) echo "tar.xz" ;;
debian|ubuntu|mint|runtu|mcst|astra|kali) echo "deb" ;;
alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles)
echo "rpm" ;;
fedora|redhat|redos|scientific|centos|rhel|goslinux|amzn)
echo "rpm" ;;
*) echo "rpm" ;;
esac
}
# TODO: in more appropriate way # TODO: in more appropriate way
#which pkcon 2>/dev/null >/dev/null && info "You can run $ PMTYPE=packagekit epm to use packagekit backend" #which pkcon 2>/dev/null >/dev/null && info "You can run $ PMTYPE=packagekit epm to use packagekit backend"
...@@ -1395,9 +1370,12 @@ local CMD ...@@ -1395,9 +1370,12 @@ local CMD
# FIXME: some problems with multibased distros (Server Edition on CentOS and Desktop Edition on Ubuntu) # FIXME: some problems with multibased distros (Server Edition on CentOS and Desktop Edition on Ubuntu)
case $DISTRIB_ID in case $DISTRIB_ID in
ALTLinux) ALTLinux)
CMD="apt-rpm"
#which ds-install 2>/dev/null >/dev/null && CMD=deepsolver-rpm #which ds-install 2>/dev/null >/dev/null && CMD=deepsolver-rpm
#which pkcon 2>/dev/null >/dev/null && CMD=packagekit-rpm #which pkcon 2>/dev/null >/dev/null && CMD=packagekit-rpm
CMD="apt-rpm"
;;
ALTServer)
CMD="apt-rpm"
;; ;;
PCLinux) PCLinux)
CMD="apt-rpm" CMD="apt-rpm"
...@@ -1405,7 +1383,7 @@ case $DISTRIB_ID in ...@@ -1405,7 +1383,7 @@ case $DISTRIB_ID in
Ubuntu|Debian|Mint|AstraLinux|Elbrus) Ubuntu|Debian|Mint|AstraLinux|Elbrus)
CMD="apt-dpkg" CMD="apt-dpkg"
#which aptitude 2>/dev/null >/dev/null && CMD=aptitude-dpkg #which aptitude 2>/dev/null >/dev/null && CMD=aptitude-dpkg
which snappy 2>/dev/null >/dev/null && CMD=snappy hascommand snappy && CMD=snappy
;; ;;
Mandriva|ROSA) Mandriva|ROSA)
CMD="urpm-rpm" CMD="urpm-rpm"
...@@ -1420,9 +1398,9 @@ case $DISTRIB_ID in ...@@ -1420,9 +1398,9 @@ case $DISTRIB_ID in
ArchLinux) ArchLinux)
CMD="pacman" CMD="pacman"
;; ;;
Fedora|FedoraLinux|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux|Amzn|RedOS) Fedora|FedoraLinux|LinuxXP|ASPLinux|CentOS|OracleLinux|RockyLinux|AlmaLinux|RHEL|Scientific|GosLinux|Amzn|RedOS)
CMD="dnf-rpm" CMD="dnf-rpm"
which dnf 2>/dev/null >/dev/null || CMD=yum-rpm hascommand dnf || CMD=yum-rpm
[ "$DISTRIB_ID/$DISTRIB_RELEASE" = "CentOS/7" ] && CMD=yum-rpm [ "$DISTRIB_ID/$DISTRIB_RELEASE" = "CentOS/7" ] && CMD=yum-rpm
;; ;;
Slackware) Slackware)
...@@ -1436,8 +1414,8 @@ case $DISTRIB_ID in ...@@ -1436,8 +1414,8 @@ case $DISTRIB_ID in
;; ;;
Windows) Windows)
CMD="appget" CMD="appget"
which $CMD 2>/dev/null >/dev/null || CMD="chocolatey" hascommand $CMD || CMD="chocolatey"
which $CMD 2>/dev/null >/dev/null || CMD="winget" hascommand $CMD || CMD="winget"
;; ;;
MacOS) MacOS)
CMD="homebrew" CMD="homebrew"
...@@ -1464,12 +1442,53 @@ case $DISTRIB_ID in ...@@ -1464,12 +1442,53 @@ case $DISTRIB_ID in
CMD="xbps" CMD="xbps"
;; ;;
*) *)
# try detect firstly
if hascommand "rpm" ; then
hascommand "urpmi" && echo "urpmi-rpm" && return
hascommand "zypper" && echo "zypper-rpm" && return
hascommand "apt-get" && echo "apt-rpm" && return
hascommand "dnf" && echo "dnf-rpm" && return
fi
if hascommand "dpkg" ; then
hascommand "apt" && echo "apt-dpkg" && return
hascommand "apt-get" && echo "apt-dpkg" && return
fi
echo "We don't support yet DISTRIB_ID $DISTRIB_ID" >&2 echo "We don't support yet DISTRIB_ID $DISTRIB_ID" >&2
;; ;;
esac esac
echo "$CMD" echo "$CMD"
} }
# Print pkgtype (need DISTRIB_ID var)
pkgtype()
{
# TODO: try use generic names
case $(pkgvendor) in
freebsd) echo "tbz" ;;
sunos) echo "pkg.gz" ;;
slackware|mopslinux) echo "tgz" ;;
archlinux|manjaro) echo "pkg.tar.xz" ;;
gentoo) echo "tbz2" ;;
windows) echo "exe" ;;
android) echo "apk" ;;
alpine) echo "apk" ;;
tinycorelinux) echo "tcz" ;;
voidlinux) echo "xbps" ;;
openwrt) echo "ipk" ;;
cygwin) echo "tar.xz" ;;
*)
case $(pkgmanager) in
*-dpkg)
echo "dpkg" ;;
*-rpm)
echo "rpm" ;;
*)
echo "rpm" ;;
esac
esac
}
get_var() get_var()
{ {
# get first variable and print it out, drop quotes if exists # get first variable and print it out, drop quotes if exists
...@@ -1486,6 +1505,9 @@ normalize_name() ...@@ -1486,6 +1505,9 @@ normalize_name()
{ {
[ "$1" = "RED OS" ] && echo "RedOS" && return [ "$1" = "RED OS" ] && echo "RedOS" && return
[ "$1" = "CentOS Linux" ] && echo "CentOS" && return [ "$1" = "CentOS Linux" ] && echo "CentOS" && return
[ "$1" = "Rocky Linux" ] && echo "RockyLinux" && return
[ "$1" = "Oracle Linux" ] && echo "OracleLinux" && return
[ "$1" = "Alma Linux" ] && echo "AlmaLinux" && return
#echo "${1// /}" #echo "${1// /}"
echo "$1" | sed -e "s/ //g" echo "$1" | sed -e "s/ //g"
} }
...@@ -1525,6 +1547,8 @@ if distro altlinux-release ; then ...@@ -1525,6 +1547,8 @@ if distro altlinux-release ; then
DISTRIB_RELEASE="$(echo p$DISTRIB_RELEASE | sed -e 's|\..*||')" DISTRIB_RELEASE="$(echo p$DISTRIB_RELEASE | sed -e 's|\..*||')"
if has Sisyphus ; then DISTRIB_RELEASE="Sisyphus" if has Sisyphus ; then DISTRIB_RELEASE="Sisyphus"
elif has "ALT p10.* p10 " ; then DISTRIB_RELEASE="p10" elif has "ALT p10.* p10 " ; then DISTRIB_RELEASE="p10"
elif has "ALTServer 10." ; then DISTRIB_RELEASE="p10"
elif has "ALTServer 9." ; then DISTRIB_RELEASE="p9"
elif has "ALT c10.* c10 " ; then DISTRIB_RELEASE="c10" elif has "ALT c10.* c10 " ; then DISTRIB_RELEASE="c10"
elif has "ALT p9.* p9 " ; then DISTRIB_RELEASE="p9" elif has "ALT p9.* p9 " ; then DISTRIB_RELEASE="p9"
elif has "ALT 9 SP " ; then DISTRIB_RELEASE="c9" elif has "ALT 9 SP " ; then DISTRIB_RELEASE="c9"
...@@ -2957,7 +2981,7 @@ print_version() ...@@ -2957,7 +2981,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.14.7 https://wiki.etersoft.ru/Epm" echo "Service manager version 3.15.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