Commit 8278dc03 authored by Vitaly Lipatov's avatar Vitaly Lipatov

backported to p8 as 3.1.2-alt0.M80P.1 (with rpmbph script)

parents 6dafd74d 73e1eca1
#!/bin/sh #!/bin/sh
# Author: Vitaly Lipatov <lav@etersoft.ru> # 2007-2019 (c) Vitaly Lipatov <lav@etersoft.ru>
# 2007, 2009, 2010, 2012, 2016, 2017, 2018 (c) Etersoft # 2007-2019 (c) Etersoft
# 2007-2018 Public domain # 2007-2019 Public domain
# Detect the distro and version
# Welcome to send updates!
# You can set ROOTDIR to root system dir # You can set ROOTDIR to root system dir
#ROOTDIR= #ROOTDIR=
...@@ -124,7 +121,7 @@ if distro altlinux-release ; then ...@@ -124,7 +121,7 @@ if distro altlinux-release ; then
elif has "ALT Linux 8." ; then DISTRIB_RELEASE="p8" elif has "ALT Linux 8." ; then DISTRIB_RELEASE="p8"
elif has "ALT .*8.[0-9]" ; then DISTRIB_RELEASE="p8" elif has "ALT .*8.[0-9]" ; then DISTRIB_RELEASE="p8"
elif has "ALT .*9.[0-9]" ; then DISTRIB_RELEASE="p9" elif has "ALT .*9.[0-9]" ; then DISTRIB_RELEASE="p9"
elif has "ALT p9 p9" ; then DISTRIB_RELEASE="p9" elif has "ALT p9 " ; then DISTRIB_RELEASE="p9"
elif has "Simply Linux 6." ; then DISTRIB_RELEASE="p6" elif has "Simply Linux 6." ; then DISTRIB_RELEASE="p6"
elif has "Simply Linux 7." ; then DISTRIB_RELEASE="p7" elif has "Simply Linux 7." ; then DISTRIB_RELEASE="p7"
elif has "Simply Linux 8." ; then DISTRIB_RELEASE="p8" elif has "Simply Linux 8." ; then DISTRIB_RELEASE="p8"
...@@ -138,12 +135,7 @@ if distro altlinux-release ; then ...@@ -138,12 +135,7 @@ if distro altlinux-release ; then
elif has "ALT Linux 5.0" ; then DISTRIB_RELEASE="5.0" elif has "ALT Linux 5.0" ; then DISTRIB_RELEASE="5.0"
elif has "ALT Linux 4.1" ; then DISTRIB_RELEASE="4.1" elif has "ALT Linux 4.1" ; then DISTRIB_RELEASE="4.1"
elif has "ALT Linux 4.0" ; then DISTRIB_RELEASE="4.0" elif has "ALT Linux 4.0" ; then DISTRIB_RELEASE="4.0"
elif has Walnut ; then DISTRIB_RELEASE="4.0"
elif has Hypericum ; then DISTRIB_RELEASE="p8"
elif has "starter kit" ; then DISTRIB_RELEASE="p8" elif has "starter kit" ; then DISTRIB_RELEASE="p8"
elif has 20070810 ; then DISTRIB_RELEASE="4.0"
elif has Ajuga ; then DISTRIB_RELEASE="4.0"
elif has 20050723 ; then DISTRIB_RELEASE="3.0"
elif has Citron ; then DISTRIB_RELEASE="2.4" elif has Citron ; then DISTRIB_RELEASE="2.4"
fi fi
...@@ -413,6 +405,9 @@ case "$DIST_BIT" in ...@@ -413,6 +405,9 @@ case "$DIST_BIT" in
'aarch64') 'aarch64')
DIST_BIT="64" DIST_BIT="64"
;; ;;
'e2k')
DIST_BIT="64"
;;
# 'pa_risc' | 'pa-risc') # Are some of these 64bit? Least not all... # 'pa_risc' | 'pa-risc') # Are some of these 64bit? Least not all...
# BIT="64" # BIT="64"
# ;; # ;;
...@@ -449,31 +444,85 @@ get_memory_size() { ...@@ -449,31 +444,85 @@ get_memory_size() {
echo $detected echo $detected
} }
print_name_version()
{
[ -n "$DISTRIB_RELEASE" ] && echo $DISTRIB_ID/$DISTRIB_RELEASE || echo $DISTRIB_ID
}
get_virt()
{
local VIRT
local SDCMD
SDCMD=$(which systemd-detect-virt 2>/dev/null)
if [ -n "$SDCMD" ] ; then
VIRT="$($SDCMD)"
[ "$VIRT" = "none" ] && echo "(host system)" && return
[ -z "$VIRT" ] && echo "(unknown)" && return
echo "$VIRT" && return
fi
if [ -r /proc/user_beancounters ] ; then
echo "openvz" && return
fi
echo "(unknown)"
# TODO: check for openvz
}
# https://unix.stackexchange.com/questions/196166/how-to-find-out-if-a-system-uses-sysv-upstart-or-systemd-initsystem
get_service_manager()
{
[ -d /run/systemd/system ] && echo "systemd" && return
[ -d /usr/share/upstart ] && echo "upstart" && return
[ -d /etc/init.d ] && echo "sysvinit" && return
echo "(unknown)"
}
print_total_info()
{
cat <<EOF
distro_info total information (run with -h to get help):
Distro name and version (-e): $(print_name_version)
Packaging system (-p): $(pkgtype)
Running service manager (-y): $(get_service_manager)
Virtualization (-i): $(get_virt)
CPU Architecture (-a): $(get_arch)
CPU norm register size (-b): $(get_bit_size)
System memory size (MB) (-m): $(get_memory_size)
Base OS name (-o): $(get_base_os_name)
Build system distro name (-s): $(pkgvendor)
Build system vendor name (-n): $(rpmvendor)
EOF
}
case $1 in case $1 in
-h)
echo "distro_info - distro name and version detection"
echo "Usage: distro_info [options] [args]"
echo "Options:"
echo " -a - print hardware architecture"
echo " -b - print size of arch bit (32/64)"
echo " -d - print distro name"
echo " -e - print full name of distro with version"
echo " -i - print virtualization type"
echo " -h - this help"
echo " -m - print system memory size (in MB)"
echo " -n [SystemName] - print vendor name (as _vendor macros in rpm)"
echo " -o - print base OS name"
echo " -p [SystemName] - print type of the packaging system"
echo " -s [SystemName] - print name of distro for build system (like in the package release name)"
ecgi " -y - print running service manager"
echo " -v - print version of distro"
echo " -V - print the utility version"
echo "Run without args to print all information."
exit 0
;;
-p) -p)
# override DISTRIB_ID # override DISTRIB_ID
test -n "$2" && DISTRIB_ID="$2" test -n "$2" && DISTRIB_ID="$2"
pkgtype pkgtype
exit 0 exit 0
;; ;;
-h)
echo "distr_vendor - system name and version detection"
echo "Usage: distr_vendor [options] [args]"
echo "-p [SystemName] - print type of packaging system"
echo "-d - print distro name"
echo "-a - print hardware architecture"
echo "-b - print size of arch bit (32/64)"
echo "-m - print system memory size (in MB)"
echo "-o - print base os name"
echo "-v - print version of distro"
echo "-e - print full name of distro with version (by default)"
echo "-s [SystemName] - print name of distro for build system (like in the package release name)"
echo "-n [SystemName] - print vendor name (as _vendor macros in rpm)"
echo "-V - print the version of $0"
echo "-h - this help"
exit 0
;;
-d) -d)
echo $DISTRIB_ID echo $DISTRIB_ID
;; ;;
...@@ -483,6 +532,9 @@ case $1 in ...@@ -483,6 +532,9 @@ case $1 in
-b) -b)
get_bit_size get_bit_size
;; ;;
-i)
get_virt
;;
-m) -m)
get_memory_size get_memory_size
;; ;;
...@@ -504,13 +556,18 @@ case $1 in ...@@ -504,13 +556,18 @@ case $1 in
rpmvendor rpmvendor
exit 0 exit 0
;; ;;
-y)
get_service_manager
;;
-V) -V)
echo "20171010" echo "20191121"
exit 0 exit 0
;; ;;
-e)
print_name_version
;;
*) *)
# if run without args, just printout Name/Version of the current system print_total_info
[ -n "$DISTRIB_RELEASE" ] && echo $DISTRIB_ID/$DISTRIB_RELEASE || echo $DISTRIB_ID
;; ;;
esac esac
...@@ -66,7 +66,7 @@ $(get_help HELPOPT) ...@@ -66,7 +66,7 @@ $(get_help HELPOPT)
print_version() print_version()
{ {
echo "EPM package manager version @VERSION@" echo "EPM package manager version @VERSION@"
echo "Running on $($DISTRVENDOR) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)" echo "Running on $($DISTRVENDOR -e) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)"
echo "Copyright (c) Etersoft 2012-2019" echo "Copyright (c) Etersoft 2012-2019"
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."
} }
...@@ -83,6 +83,7 @@ noremove= ...@@ -83,6 +83,7 @@ noremove=
dryrun= dryrun=
force= force=
repack= repack=
inscript=
scripts= scripts=
short= short=
direct= direct=
...@@ -352,6 +353,9 @@ check_option() ...@@ -352,6 +353,9 @@ check_option()
--noremove|--no-remove) # HELPOPT: exit if any packages are to be removed during upgrade --noremove|--no-remove) # HELPOPT: exit if any packages are to be removed during upgrade
noremove="--no-remove" noremove="--no-remove"
;; ;;
--no-stdin|--inscript) # HELPOPT: don't read from stdin for epm args
inscript=1
;;
--dry-run|--simulate|--just-print|-recon--no-act) # HELPOPT: print only (autoremove/autoorphans/remove only) --dry-run|--simulate|--just-print|-recon--no-act) # HELPOPT: print only (autoremove/autoorphans/remove only)
dryrun="--dry-run" dryrun="--dry-run"
;; ;;
...@@ -411,7 +415,7 @@ for opt in "$@" ; do ...@@ -411,7 +415,7 @@ for opt in "$@" ; do
done done
# if input is not console and run script from file, get pkgs from stdin too # if input is not console and run script from file, get pkgs from stdin too
if ! inputisatty && [ -n "$PROGDIR" ] ; then if [ ! -n "$inscript" ] && ! inputisatty && [ -n "$PROGDIR" ] ; then
for opt in $(withtimeout 2 cat) ; do for opt in $(withtimeout 2 cat) ; do
# FIXME: do not work # FIXME: do not work
# workaround against # yes | epme # workaround against # yes | epme
......
...@@ -94,7 +94,7 @@ __epm_addrepo_altlinux() ...@@ -94,7 +94,7 @@ __epm_addrepo_altlinux()
assure_exists apt-repo assure_exists apt-repo
if tasknumber "$repo" >/dev/null ; then if tasknumber "$repo" >/dev/null ; then
sudocmd apt-repo add $(tasknumber "$repo") sudocmd_foreach 'apt-repo add' $(tasknumber "$repo")
return return
fi fi
...@@ -118,7 +118,7 @@ local repo="$(eval echo "$quoted_args")" ...@@ -118,7 +118,7 @@ local repo="$(eval echo "$quoted_args")"
case $DISTRNAME in case $DISTRNAME in
ALTLinux) ALTLinux)
__epm_addrepo_altlinux $repo __epm_addrepo_altlinux $pkg_names
return return
;; ;;
esac esac
......
...@@ -40,6 +40,13 @@ epm_checksystem() ...@@ -40,6 +40,13 @@ epm_checksystem()
[ $EFFUID = "0" ] && fatal "Do not use checksystem under root" [ $EFFUID = "0" ] && fatal "Do not use checksystem under root"
case $PMTYPE in
homebrew)
sudocmd brew doctor
return
;;
esac
case $DISTRNAME in case $DISTRNAME in
ALTLinux) ALTLinux)
epm_checksystem_$DISTRNAME epm_checksystem_$DISTRNAME
......
...@@ -63,6 +63,9 @@ case $PMTYPE in ...@@ -63,6 +63,9 @@ case $PMTYPE in
urpm-rpm) urpm-rpm)
sudocmd urpmi --clean sudocmd urpmi --clean
;; ;;
homebrew)
sudocmd brew cleanup -s
;;
pacman) pacman)
sudocmd pacman -Sc --noconfirm sudocmd pacman -Sc --noconfirm
;; ;;
......
...@@ -53,7 +53,7 @@ case "$DISTRNAME" in ...@@ -53,7 +53,7 @@ case "$DISTRNAME" in
"ALTLinux") "ALTLinux")
assure_exists /usr/share/apt/scripts apt-scripts assure_exists /usr/share/apt/scripts apt-scripts
if [ -f /usr/share/apt/scripts/dedup.lua ] ; then if [ -f /usr/share/apt/scripts/dedup.lua ] ; then
"Check for duplicates via apt-get dedup from apt-scripts" info "Check for duplicates via apt-get dedup from apt-scripts"
sudocmd apt-get dedup sudocmd apt-get dedup
else else
try_fix_apt_rpm_dupls try_fix_apt_rpm_dupls
......
...@@ -219,6 +219,9 @@ epm_download() ...@@ -219,6 +219,9 @@ epm_download()
opkg) opkg)
docmd opkg $pkg_filenames docmd opkg $pkg_filenames
;; ;;
homebrew)
docmd brew fetch $pkg_filenames
;;
*) *)
fatal "Have no suitable command for $PMTYPE" fatal "Have no suitable command for $PMTYPE"
;; ;;
......
...@@ -538,14 +538,12 @@ epm_print_install_names_command() ...@@ -538,14 +538,12 @@ epm_print_install_names_command()
epm_install() epm_install()
{ {
if tasknumber "$pkg_names" >/dev/null ; then if [ "$DISTRNAME" = "ALTLinux" ] ; then
assure_distr ALTLinux "install with task number" if tasknumber "$pkg_names" >/dev/null ; then
assure_exists apt-repo assure_exists apt-repo
local task sudocmd_foreach "apt-repo test" "$(tasknumber $pkg_names)"
for task in $(tasknumber "$pkg_names") ; do return
sudocmd apt-repo test $task fi
done
return
fi fi
if [ -n "$show_command_only" ] ; then if [ -n "$show_command_only" ] ; then
......
...@@ -231,10 +231,14 @@ __epm_query_name() ...@@ -231,10 +231,14 @@ __epm_query_name()
conary) conary)
CMD="conary query" CMD="conary query"
;; ;;
homebrew) #homebrew)
docmd brew info "$1" >/dev/null 2>/dev/null && echo "$1" && return # showcmd "brew info $1"
return 1 # local HBRESULT
;; # HBRESULT="$(brew info "$1" 2>/dev/null)" || return
# echo "$HBRESULT" | grep -q "Not installed" && return 1
# echo "$1"
# return 0
# ;;
pacman) pacman)
docmd pacman -Q $@ docmd pacman -Q $@
return return
......
...@@ -41,7 +41,7 @@ __do_query_real_file() ...@@ -41,7 +41,7 @@ __do_query_real_file()
if [ -e "$1" ] ; then if [ -e "$1" ] ; then
TOFILE="$(__abs_filename "$1")" TOFILE="$(__abs_filename "$1")"
else else
TOFILE=$(which "$1" 2>/dev/null || echo "$1") TOFILE=$(which -- "$1" 2>/dev/null || echo "$1")
if [ "$TOFILE" != "$1" ] ; then if [ "$TOFILE" != "$1" ] ; then
info "Note: $1 is placed as $TOFILE" info "Note: $1 is placed as $TOFILE"
fi fi
...@@ -51,7 +51,7 @@ __do_query_real_file() ...@@ -51,7 +51,7 @@ __do_query_real_file()
if [ -L "$TOFILE" ] ; then if [ -L "$TOFILE" ] ; then
local LINKTO local LINKTO
__do_query "$TOFILE" __do_query "$TOFILE"
LINKTO=$(readlink -f "$TOFILE") LINKTO=$(readlink -f -- "$TOFILE")
info "Note: $TOFILE is link to $LINKTO" info "Note: $TOFILE is link to $LINKTO"
__do_query_real_file "$LINKTO" __do_query_real_file "$LINKTO"
return return
......
...@@ -43,6 +43,9 @@ epm_reinstall_names() ...@@ -43,6 +43,9 @@ epm_reinstall_names()
dnf-rpm) dnf-rpm)
sudocmd dnf reinstall $@ sudocmd dnf reinstall $@
return ;; return ;;
homebrew)
sudocmd brew reinstall $@
return ;;
pkgng) pkgng)
sudocmd pkg install -f $@ sudocmd pkg install -f $@
return ;; return ;;
......
...@@ -133,6 +133,7 @@ get_fix_release_pkg() ...@@ -133,6 +133,7 @@ get_fix_release_pkg()
[ "$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) # update if installed (just print package name here to include in the install list)
epm --quiet --short -q alt-gpgkeys 2>/dev/null
epm --quiet --short -q etersoft-gpgkeys 2>/dev/null epm --quiet --short -q etersoft-gpgkeys 2>/dev/null
if [ -n "$TOINSTALL" ] ; then if [ -n "$TOINSTALL" ] ; then
......
...@@ -251,13 +251,12 @@ epm_remove() ...@@ -251,13 +251,12 @@ epm_remove()
return return
fi fi
local tn=$(tasknumber "$pkg_names") if [ "$DISTRNAME" = "ALTLinux" ] ; then
if [ -n "$tn" ] ; then load_helper epm-sh-altlinux
assure_distr ALTLinux "remove with task number" if tasknumber "$pkg_names" >/dev/null ; then
assure_exists apt-repo assure_exists apt-repo
pkg_names=$(showcmd apt-repo list $tn) pkg_names="$(get_task_packages $pkg_names)"
#docmd epm remove $dryrun fi
return
fi fi
# TODO: fix pkg_names override # TODO: fix pkg_names override
......
...@@ -25,6 +25,7 @@ local repo="$(eval echo $quoted_args)" ...@@ -25,6 +25,7 @@ local repo="$(eval echo $quoted_args)"
case $DISTRNAME in case $DISTRNAME in
ALTLinux) ALTLinux)
assure_exists apt-repo
case "$repo" in case "$repo" in
autoimports) autoimports)
info "remove autoimports repo" info "remove autoimports repo"
...@@ -49,14 +50,24 @@ case $DISTRNAME in ...@@ -49,14 +50,24 @@ case $DISTRNAME in
;; ;;
*) *)
if tasknumber "$repo" >/dev/null ; then if tasknumber "$repo" >/dev/null ; then
repo="$(epm repolist | grep "repo/$(tasknumber "$repo")" | line)" #sudocmd apt-repo rm all tasks
# " #return
local tn
for tn in $(tasknumber "$repo") ; do
repoline="$(epm repolist | grep " repo/$tn/" | line)" #"
[ -n "$repoline" ] || { info "Can't find $tn task in the repository list" ; continue ; }
sudocmd apt-repo rm "$repoline"
# try again to remove possible x86_64-i586
repoline="$(epm repolist | grep " repo/$tn/" | line)" #"
[ -n "$repoline" ] || continue
sudocmd apt-repo rm "$repoline"
done
return 0
fi fi
;; ;;
esac esac
[ -n "$repo" ] || fatal "No such repo or task. Use epm remove repo [autoimports|archive|tasks/TASKNUMBER]" [ -n "$repo" ] || fatal "No such repo or task. Use epm remove repo [autoimports|archive|tasks/TASKNUMBER]"
assure_exists apt-repo
sudocmd apt-repo rm "$repo" sudocmd apt-repo rm "$repo"
return return
;; ;;
......
...@@ -103,6 +103,11 @@ case $PMTYPE in ...@@ -103,6 +103,11 @@ case $PMTYPE in
assure_exists equery assure_exists equery
CMD="equery depgraph" CMD="equery depgraph"
;; ;;
homebrew)
#docmd brew info $pkg_names | grep "^Required: " | sed -s "|s|^Requires: ||"
docmd brew deps $pkg_names
return
;;
pkgng) pkgng)
#CMD="pkg rquery '%dn-%dv'" #CMD="pkg rquery '%dn-%dv'"
CMD="pkg info -d" CMD="pkg info -d"
......
...@@ -110,7 +110,7 @@ get_local_alt_contents_index() ...@@ -110,7 +110,7 @@ get_local_alt_contents_index()
epm_repolist | grep -E "rpm.*(ftp://|http://|https://|file:/)" | sed -e "s@^rpm.*\(ftp://\|http://\|https://\|file:\)@\1@g" | while read -r URL ARCH other ; do epm_repolist | grep -E "rpm.*(ftp://|http://|https://|file:/)" | sed -e "s@^rpm.*\(ftp://\|http://\|https://\|file:\)@\1@g" | while read -r URL ARCH other ; do
LOCALPATH=$(get_local_alt_mirror_path "$URL/$ARCH") LOCALPATH=$(get_local_alt_mirror_path "$URL/$ARCH")
download_alt_contents_index $URL/$ARCH/base/contents_index $LOCALPATH >&2 || continue download_alt_contents_index $URL/$ARCH/base/contents_index $LOCALPATH >&2 </dev/null || continue
echo "$LOCALPATH/contents_index*" echo "$LOCALPATH/contents_index*"
done done
...@@ -122,3 +122,11 @@ tasknumber() ...@@ -122,3 +122,11 @@ tasknumber()
isnumber "$num" && echo "$*" isnumber "$num" && echo "$*"
} }
# use assure apt-repo before
get_task_packages()
{
local tn
for tn in $(tasknumber "$@") ; do
docmd apt-repo list task "$tn"
done
}
...@@ -229,7 +229,7 @@ clean_store_output() ...@@ -229,7 +229,7 @@ clean_store_output()
epm() epm()
{ {
[ -n "$PROGNAME" ] || fatal "Can't use epm call from the piped script" [ -n "$PROGNAME" ] || fatal "Can't use epm call from the piped script"
$PROGDIR/$PROGNAME $@ $PROGDIR/$PROGNAME --inscript $@
} }
# Print error message and stop the program # Print error message and stop the program
...@@ -371,6 +371,7 @@ assure_exists() ...@@ -371,6 +371,7 @@ assure_exists()
# will replaced within disabled_eget in packaged version # will replaced within disabled_eget in packaged version
eget() eget()
{ {
local EGET
# use internal eget only if exists # use internal eget only if exists
if [ -s $SHAREDIR/tools_eget ] ; then if [ -s $SHAREDIR/tools_eget ] ; then
$SHAREDIR/tools_eget "$@" $SHAREDIR/tools_eget "$@"
...@@ -463,8 +464,11 @@ set_pm_type() ...@@ -463,8 +464,11 @@ set_pm_type()
{ {
local CMD local CMD
# Fill for use: PMTYPE, DISTRNAME, DISTRVERSION, PKGFORMAT, PKGVENDOR, RPMVENDOR # use external distro_info if internal one is missed
DISTRVENDOR=$PROGDIR/distr_info DISTRVENDOR=$PROGDIR/distr_info
[ -x $DISTRVENDOR ] || DISTRVENDOR=distro_info
# Fill for use: PMTYPE, DISTRNAME, DISTRVERSION, PKGFORMAT, PKGVENDOR, RPMVENDOR
[ -n "$DISTRNAME" ] || DISTRNAME=$($DISTRVENDOR -d) || fatal "Can't get distro name." [ -n "$DISTRNAME" ] || DISTRNAME=$($DISTRVENDOR -d) || fatal "Can't get distro name."
[ -n "$DISTRVERSION" ] || DISTRVERSION=$($DISTRVENDOR -v) [ -n "$DISTRVERSION" ] || DISTRVERSION=$($DISTRVENDOR -v)
set_target_pkg_env set_target_pkg_env
...@@ -554,16 +558,9 @@ esac ...@@ -554,16 +558,9 @@ esac
PMTYPE=$CMD PMTYPE=$CMD
} }
# https://unix.stackexchange.com/questions/196166/how-to-find-out-if-a-system-uses-sysv-upstart-or-systemd-initsystem
is_active_systemd() is_active_systemd()
{ {
local a [ "$($DISTRVENDOR -y)" = "systemd" ]
SYSTEMCTL=/bin/systemctl
#[ -x "$SYSTEMCTL" ] || return
[ -d /run/systemd/system ] || return
#SYSTEMD_CGROUP_DIR=/sys/fs/cgroup/systemd
#[ -d "$SYSTEMD_CGROUP_DIR" ] || return
#cat /proc/1/comm | grep -q 'systemd' && return
} }
assure_distr() assure_distr()
......
...@@ -80,6 +80,10 @@ query_package_url() ...@@ -80,6 +80,10 @@ query_package_url()
#LANG=C epm info "$1" #LANG=C epm info "$1"
return return
;; ;;
homebrew)
docmd brew "$1" | grep "^From: " | sed -e "s|^From: ||"
return
;;
esac esac
fatal "rpm based distro supported only. TODO: Realize via web service?" fatal "rpm based distro supported only. TODO: Realize via web service?"
} }
......
...@@ -30,6 +30,25 @@ epm_upgrade() ...@@ -30,6 +30,25 @@ epm_upgrade()
update_repo_if_needed update_repo_if_needed
warmup_bases warmup_bases
if [ "$DISTRNAME" = "ALTLinux" ] ; then
load_helper epm-sh-altlinux
if tasknumber "$pkg_names" >/dev/null ; then
load_helper epm-addrepo
load_helper epm-removerepo
load_helper epm-Install
epm_addrepo
local installlist="$(get_task_packages $pkg_names)"
[ -n "$verbose" ] && info "Packages from task(s): $installlist"
# install only installed packages (simulate upgrade packages)
installlist="$(estrlist exclude "$(echo "$installlist" | (skip_installed='yes' filter_out_installed_packages))" "$installlist")"
[ -n "$verbose" ] && info "Packages to upgrade: $installlist"
(pkg_names="$installlist" epm_Install)
epm_removerepo
return
fi
fi
info "Running command for upgrade packages" info "Running command for upgrade packages"
case $PMTYPE in case $PMTYPE in
...@@ -113,4 +132,5 @@ epm_upgrade() ...@@ -113,4 +132,5 @@ epm_upgrade()
esac esac
sudocmd $CMD $pkg_filenames sudocmd $CMD $pkg_filenames
} }
...@@ -61,6 +61,9 @@ case $PMTYPE in ...@@ -61,6 +61,9 @@ case $PMTYPE in
assure_exists equery assure_exists equery
CMD="equery depends -a" CMD="equery depends -a"
;; ;;
homebrew)
CMD="brew uses"
;;
pkgng) pkgng)
CMD="pkg info -r" CMD="pkg info -r"
;; ;;
......
...@@ -48,9 +48,12 @@ set_service_type() ...@@ -48,9 +48,12 @@ set_service_type()
{ {
local CMD local CMD
# Fill for use: PMTYPE, DISTRNAME, DISTRVERSION, PKGFORMAT, PKGVENDOR, RPMVENDOR # use external distro_info if internal one is missed
DISTRVENDOR=$PROGDIR/distr_info DISTRVENDOR=$PROGDIR/distr_info
[ -n "$DISTRNAME" ] || DISTRNAME=$($DISTRVENDOR -d) || fatal "Can't get distro name." [ -x $DISTRVENDOR ] || DISTRVENDOR=distro_info
# Fill for use: PMTYPE, DISTRNAME, DISTRVERSION, PKGFORMAT, PKGVENDOR, RPMVENDOR
[ -n "$DISTRNAME" ] || DISTRNAME=$($DISTRVENDOR -d) || fatal "Can't get distro name from $DISTRVENDOR."
[ -n "$DISTRVERSION" ] || DISTRVERSION=$($DISTRVENDOR -v) [ -n "$DISTRVERSION" ] || DISTRVERSION=$($DISTRVENDOR -v)
set_target_pkg_env set_target_pkg_env
...@@ -127,19 +130,13 @@ $(get_help HELPOPT) ...@@ -127,19 +130,13 @@ $(get_help HELPOPT)
" "
} }
detect_virt()
{
which systemd-detect-virt >/dev/null 2>/dev/null || return
a= systemd-detect-virt
}
print_version() print_version()
{ {
local on_text="(host system)" local on_text="(host system)"
local virt="$(detect_virt)" local virt="$($DISTRVENDOR -i)"
[ "$virt" = "none" ] || [ "$virt" = "" ] || on_text="(under $virt)" [ "$virt" = "(unknown)" ] || [ "$virt" = "(host system)" ] || on_text="(under $virt)"
echo "Service manager version @VERSION@" echo "Service manager version @VERSION@"
echo "Running on $($DISTRVENDOR) $on_text with $SERVICETYPE" echo "Running on $($DISTRVENDOR -e) $on_text with $SERVICETYPE"
echo "Copyright (c) Etersoft 2012-2019" echo "Copyright (c) Etersoft 2012-2019"
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."
} }
...@@ -213,6 +210,9 @@ check_command() ...@@ -213,6 +210,9 @@ check_command()
log|journal) # HELPCMD: print log for the service log|journal) # HELPCMD: print log for the service
serv_cmd=log serv_cmd=log
;; ;;
edit)
serv_cmd=edit # HELPCMD: edit service file overload (use --full to edit full file)
;;
*) *)
return 1 return 1
;; ;;
......
#!/bin/sh
#
# Copyright (C) 2019 Etersoft
# Copyright (C) 2019 Vitaly Lipatov <lav@etersoft.ru>
#
# 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
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
serv_edit()
{
local SERVICE="$1"
shift
case $SERVICETYPE in
systemd)
sudocmd systemctl edit "$@" "$SERVICE"
;;
*)
fatal "Have no suitable for $DISTRNAME command for $SERVICETYPE"
;;
esac
}
# This spec is backported to ALTLinux p8 automatically by rpmbph script from etersoft-build-utils. # This spec is backported to ALTLinux p8 automatically by rpmbph script from etersoft-build-utils.
# #
Name: eepm Name: eepm
Version: 3.1.0 Version: 3.1.2
Release: alt0.M80P.1 Release: alt0.M80P.1
Summary: Etersoft EPM package manager Summary: Etersoft EPM package manager
...@@ -25,6 +25,7 @@ Provides: upm ...@@ -25,6 +25,7 @@ Provides: upm
%if %_vendor == "alt" %if %_vendor == "alt"
# FIXHERE: Replace with target platform package manager # FIXHERE: Replace with target platform package manager
Requires: apt rpm Requires: apt rpm
Requires: distro_info >= 1.1
%endif %endif
%description %description
...@@ -70,6 +71,8 @@ chmod a+x %buildroot%_datadir/%name/tools_* ...@@ -70,6 +71,8 @@ chmod a+x %buildroot%_datadir/%name/tools_*
%if %_vendor == "alt" %if %_vendor == "alt"
# use external eget # use external eget
rm -f %buildroot%_datadir/%name/tools_eget rm -f %buildroot%_datadir/%name/tools_eget
# use external distro_info
rm -f %buildroot%_bindir/distr_info
%endif %endif
%files %files
...@@ -83,16 +86,34 @@ rm -f %buildroot%_datadir/%name/tools_eget ...@@ -83,16 +86,34 @@ rm -f %buildroot%_datadir/%name/tools_eget
%_bindir/upm %_bindir/upm
%_bindir/serv %_bindir/serv
%_bindir/cerv %_bindir/cerv
%if %_vendor != "alt"
%_bindir/distr_info %_bindir/distr_info
%endif
%_man1dir/* %_man1dir/*
%_datadir/%name/ %_datadir/%name/
%_sysconfdir/bash_completion.d/serv %_sysconfdir/bash_completion.d/serv
%_sysconfdir/bash_completion.d/cerv %_sysconfdir/bash_completion.d/cerv
%changelog %changelog
* Fri Nov 08 2019 Vitaly Lipatov <lav@altlinux.ru> 3.1.0-alt0.M80P.1 * Tue Nov 26 2019 Vitaly Lipatov <lav@altlinux.ru> 3.1.2-alt0.M80P.1
- backport to ALTLinux p8 (by rpmbph script) - backport to ALTLinux p8 (by rpmbph script)
* Tue Nov 26 2019 Vitaly Lipatov <lav@altlinux.ru> 3.1.2-alt1
- improve homebrew support
- serv: add edit support for systemd
- fixes for ALT p9 detection
- epm query_file: use -- after options
- use external distro_info on non ALT systems
- epm: add support for a few tasks in addrepo/removerepo/install
- upgrade: add support for epm upgrade TASK (upgrade only already installed packages)
- remove TASK: remove all packages from the TASK
- release_upgrade: install alt-gpgkeys firstly
* Tue Nov 12 2019 Vitaly Lipatov <lav@altlinux.ru> 3.1.1-alt1
- epm-dedup: fix info message (ALT bug 37473)
- epm: add --no-stdin support (do not read commands from stdin)
- run internal eepm with --inscript (no read from stdin) (ALT bug 37209)
* Fri Nov 08 2019 Vitaly Lipatov <lav@altlinux.ru> 3.1.0-alt1 * Fri Nov 08 2019 Vitaly Lipatov <lav@altlinux.ru> 3.1.0-alt1
- add epm full-upgrade - add epm full-upgrade
- kernel update/remove: add --auto support (non interactive) - kernel update/remove: add --auto support (non interactive)
......
...@@ -467,10 +467,12 @@ if [ -n "$FORCEPM" ] ; then ...@@ -467,10 +467,12 @@ if [ -n "$FORCEPM" ] ; then
return return
fi fi
case $DISTRNAME in case $DISTRNAME in
ALTLinux) ALTLinux)
CMD="apt-rpm" 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
;; ;;
PCLinux) PCLinux)
CMD="apt-rpm" CMD="apt-rpm"
...@@ -540,19 +542,15 @@ esac ...@@ -540,19 +542,15 @@ esac
PMTYPE=$CMD PMTYPE=$CMD
} }
is_active_systemd() is_active_systemd()
{ {
local a local a
SYSTEMCTL=/bin/systemctl SYSTEMCTL=/bin/systemctl
SYSTEMD_CGROUP_DIR=/sys/fs/cgroup/systemd #[ -x "$SYSTEMCTL" ] || return
[ -x "$SYSTEMCTL" ] || return [ -d /run/systemd/system ] || return
[ -d "$SYSTEMD_CGROUP_DIR" ] || return #SYSTEMD_CGROUP_DIR=/sys/fs/cgroup/systemd
a='' mountpoint -q "$SYSTEMD_CGROUP_DIR" || return #[ -d "$SYSTEMD_CGROUP_DIR" ] || return
readlink /sbin/init | grep -q 'systemd' || return #cat /proc/1/comm | grep -q 'systemd' && return
# some hack
# shellcheck disable=SC2009
ps ax | grep '[s]ystemd' | grep -q -v 'systemd-udev'
} }
assure_distr() assure_distr()
...@@ -565,6 +563,27 @@ assure_distr() ...@@ -565,6 +563,27 @@ assure_distr()
# File bin/epm-addrepo: # File bin/epm-addrepo:
ETERSOFTPUBURL=http://download.etersoft.ru/pub
ALTLINUXPUBURL=http://ftp.altlinux.org/pub/distributions
__epm_addrepo_rhel()
{
local repo="$@"
if [ -z "$repo" ] ; then
echo "Add repo."
echo "1. Use with repository URL, f.i. http://www.example.com/example.repo"
echo "2. Use with epel to add EPEL repository"
return 1
fi
case "$1" in
epel)
epm install epel-release
return 1
;;
esac
return 0
}
__epm_addrepo_altlinux() __epm_addrepo_altlinux()
{ {
local repo="$@" local repo="$@"
...@@ -583,11 +602,11 @@ __epm_addrepo_altlinux() ...@@ -583,11 +602,11 @@ __epm_addrepo_altlinux()
# TODO: use apt-repo add ? # TODO: use apt-repo add ?
echo "" | sudocmd tee -a /etc/apt/sources.list echo "" | sudocmd tee -a /etc/apt/sources.list
echo "# added with eepm addrepo etersoft" | sudocmd tee -a /etc/apt/sources.list echo "# added with eepm addrepo etersoft" | sudocmd tee -a /etc/apt/sources.list
echo "rpm [etersoft] http://download.etersoft.ru/pub/Etersoft LINUX@Etersoft/$branch/$arch addon" | sudocmd tee -a /etc/apt/sources.list echo "rpm [etersoft] $ETERSOFTPUBURL/Etersoft LINUX@Etersoft/$branch/$arch addon" | sudocmd tee -a /etc/apt/sources.list
if [ "$arch" = "x86_64" ] ; then if [ "$arch" = "x86_64" ] ; then
echo "rpm [etersoft] http://download.etersoft.ru/pub/Etersoft LINUX@Etersoft/$branch/$arch-i586 addon" | sudocmd tee -a /etc/apt/sources.list echo "rpm [etersoft] $ETERSOFTPUBURL/Etersoft LINUX@Etersoft/$branch/$arch-i586 addon" | sudocmd tee -a /etc/apt/sources.list
fi fi
echo "rpm [etersoft] http://download.etersoft.ru/pub/Etersoft LINUX@Etersoft/$branch/noarch addon" | sudocmd tee -a /etc/apt/sources.list echo "rpm [etersoft] $ETERSOFTPUBURL/Etersoft LINUX@Etersoft/$branch/noarch addon" | sudocmd tee -a /etc/apt/sources.list
repo="$DISTRVERSION" repo="$DISTRVERSION"
return 0 return 0
;; ;;
...@@ -596,6 +615,7 @@ __epm_addrepo_altlinux() ...@@ -596,6 +615,7 @@ __epm_addrepo_altlinux()
repo="$repo.$(echo "$DISTRVERSION" | tr "[:upper:]" "[:lower:]")" repo="$repo.$(echo "$DISTRVERSION" | tr "[:upper:]" "[:lower:]")"
;; ;;
archive) archive)
[ -n "$DISTRVERSION" ] || fatal "Empty DISTRVERSION"
datestr="$2" datestr="$2"
echo "$datestr" | grep -Eq "^20[0-2][0-9]/[01][0-9]/[0-3][0-9]$" || fatal "use follow date format: 2017/12/31" echo "$datestr" | grep -Eq "^20[0-2][0-9]/[01][0-9]/[0-3][0-9]$" || fatal "use follow date format: 2017/12/31"
# TODO: func? # TODO: func?
...@@ -605,11 +625,11 @@ __epm_addrepo_altlinux() ...@@ -605,11 +625,11 @@ __epm_addrepo_altlinux()
local distrversion="$(echo "$DISTRVERSION" | tr "[:upper:]" "[:lower:]")" local distrversion="$(echo "$DISTRVERSION" | tr "[:upper:]" "[:lower:]")"
local rpmsign='[alt]' local rpmsign='[alt]'
[ "$distrversion" != "sisyphus" ] && rpmsign="[$distrversion]" [ "$distrversion" != "sisyphus" ] && rpmsign="[$distrversion]"
echo "rpm $rpmsign http://ftp.altlinux.org/pub/distributions archive/$distrversion/date/$datestr/$arch classic" | sudocmd tee -a /etc/apt/sources.list echo "rpm $rpmsign $ALTLINUXPUBURL archive/$distrversion/date/$datestr/$arch classic" | sudocmd tee -a /etc/apt/sources.list
if [ "$arch" = "x86_64" ] ; then if [ "$arch" = "x86_64" ] ; then
echo "rpm $rpmsign http://ftp.altlinux.org/pub/distributions archive/$distrversion/date/$datestr/$arch-i586 classic" | sudocmd tee -a /etc/apt/sources.list echo "rpm $rpmsign $ALTLINUXPUBURL archive/$distrversion/date/$datestr/$arch-i586 classic" | sudocmd tee -a /etc/apt/sources.list
fi fi
echo "rpm $rpmsign http://ftp.altlinux.org/pub/distributions archive/$distrversion/date/$datestr/noarch classic" | sudocmd tee -a /etc/apt/sources.list echo "rpm $rpmsign $ALTLINUXPUBURL archive/$distrversion/date/$datestr/noarch classic" | sudocmd tee -a /etc/apt/sources.list
return 0 return 0
;; ;;
esac esac
...@@ -624,11 +644,13 @@ __epm_addrepo_altlinux() ...@@ -624,11 +644,13 @@ __epm_addrepo_altlinux()
if [ -z "$repo" ] ; then if [ -z "$repo" ] ; then
info "Add branch repo. Use follow params:" info "Add branch repo. Use follow params:"
sudocmd apt-repo add branch sudocmd apt-repo add branch
echo "etersoft (for LINUX@Etersoft repo)" echo "etersoft - for LINUX@Etersoft repo"
echo "archive 2018/02/09 (for archive from that date)" echo "archive 2018/02/09 - for archive from that date"
return return
fi fi
# TODO: add other mirror (mirror.yandex.ru)
# TODO: apt-repo supports archive
sudocmd apt-repo add "$repo" sudocmd apt-repo add "$repo"
} }
...@@ -658,8 +680,13 @@ case $PMTYPE in ...@@ -658,8 +680,13 @@ case $PMTYPE in
;; ;;
yum-rpm) yum-rpm)
assure_exists yum-utils assure_exists yum-utils
__epm_addrepo_rhel "$repo" || return
sudocmd yum-config-manager --add-repo "$repo" sudocmd yum-config-manager --add-repo "$repo"
;; ;;
dnf-rpm)
__epm_addrepo_rhel "$repo" || return
sudocmd dnf config-manager --add-repo "$repo"
;;
urpm-rpm) urpm-rpm)
sudocmd urpmi.addmedia "$repo" sudocmd urpmi.addmedia "$repo"
;; ;;
...@@ -822,7 +849,7 @@ epm_autoorphans() ...@@ -822,7 +849,7 @@ epm_autoorphans()
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
# ALT Linux only # ALT Linux only
assure_exists /etc/buildreqs/files/ignore.d/apt-scripts apt-scripts assure_exists /usr/share/apt/scripts/list-extras.lua apt-scripts
if [ -z "$dryrun" ] ; then if [ -z "$dryrun" ] ; then
echo "We will try remove all installed packages which are missed in repositories" echo "We will try remove all installed packages which are missed in repositories"
warning "Use with caution!" warning "Use with caution!"
...@@ -1030,7 +1057,7 @@ __epm_autoremove_altrpm_lib() ...@@ -1030,7 +1057,7 @@ __epm_autoremove_altrpm_lib()
__epm_autoremove_altrpm() __epm_autoremove_altrpm()
{ {
local i local i
assure_exists /etc/buildreqs/files/ignore.d/apt-scripts apt-scripts assure_exists /usr/share/apt/scripts/list-nodeps.lua apt-scripts
if [ -z "$pkg_names" ] ; then if [ -z "$pkg_names" ] ; then
__epm_autoremove_altrpm_pp '^(python-module-|python3-module-|python-modules-|python3-modules|perl-)' __epm_autoremove_altrpm_pp '^(python-module-|python3-module-|python-modules-|python3-modules|perl-)'
...@@ -1094,6 +1121,9 @@ case $PMTYPE in ...@@ -1094,6 +1121,9 @@ case $PMTYPE in
fi fi
sudocmd aura -Oj sudocmd aura -Oj
;; ;;
packagekit-*)
docmd pkcon repair --autoremove
;;
yum-rpm) yum-rpm)
# cleanup orphanes? # cleanup orphanes?
while true ; do while true ; do
...@@ -1267,33 +1297,6 @@ epm_changelog() ...@@ -1267,33 +1297,6 @@ epm_changelog()
# File bin/epm-check: # File bin/epm-check:
try_fix_apt_rpm_dupls()
{
info "Check for duplicates ..."
local TESTPKG="ignoreflock"
local has_testpkg=""
if epm --quiet installed $TESTPKG ; then
has_testpkg=1
sudocmd epm remove --auto $TESTPKG || return
fi
local PKGLIST
PKGLIST=$(LANG=C $SUDO apt-get install $TESTPKG 2>&1 | grep "W: There are multiple versions of" | \
sed -e 's|W: There are multiple versions of "\(.*\)" in your system.|\1|')
local TODEL
for i in $PKGLIST ; do
local pkg=${i/.32bit/}
local todel="$(rpm -q $pkg | head -n1)"
local todel2="$(rpm -q $pkg | head -n2 | tail -n1)"
if [ "$todel" = "$todel2" ] ; then
echo "Fix the same name duplicates for $pkg..."
sudocmd rpm -e "$todel" --allmatches --nodeps && epm install $pkg && continue
fi
sudocmd rpm -e "$todel" || TODEL="$TODEL $todel"
done
[ -n "$TODEL" ] && sudocmd rpm -e "$TODEL"
[ -n "$has_testpkg" ] && epm install $TESTPKG
}
epm_check() epm_check()
{ {
case $PMTYPE in case $PMTYPE in
...@@ -1301,7 +1304,7 @@ case $PMTYPE in ...@@ -1301,7 +1304,7 @@ case $PMTYPE in
#sudocmd apt-get check || exit #sudocmd apt-get check || exit
#sudocmd apt-get update || exit #sudocmd apt-get update || exit
sudocmd apt-get -f install || return sudocmd apt-get -f install || return
try_fix_apt_rpm_dupls info "You can use epm dedup also"
;; ;;
apt-dpkg) apt-dpkg)
#sudocmd apt-get check || exit #sudocmd apt-get check || exit
...@@ -1314,6 +1317,9 @@ case $PMTYPE in ...@@ -1314,6 +1317,9 @@ case $PMTYPE in
sudocmd apt-get -f install || return sudocmd apt-get -f install || return
#sudocmd apt-get autoremove #sudocmd apt-get autoremove
;; ;;
packagekit-*)
docmd pkcon repair
;;
aptitude-dpkg) aptitude-dpkg)
sudocmd aptitude -f install || return sudocmd aptitude -f install || return
#sudocmd apt-get autoremove #sudocmd apt-get autoremove
...@@ -1538,7 +1544,8 @@ update_repo_if_needed() ...@@ -1538,7 +1544,8 @@ update_repo_if_needed()
cd / || fatal cd / || fatal
if ! __is_repo_info_downloaded || ! __is_repo_info_uptodate ; then if ! __is_repo_info_downloaded || ! __is_repo_info_uptodate ; then
pkg_filenames='' epm_update # FIXME: cleans!!!
(pkg_filenames='' epm_update)
fi fi
cd - >/dev/null || fatal cd - >/dev/null || fatal
...@@ -1725,6 +1732,56 @@ epm_conflicts() ...@@ -1725,6 +1732,56 @@ epm_conflicts()
epm_conflicts_names epm_conflicts_names
} }
# File bin/epm-dedup:
try_fix_apt_rpm_dupls()
{
info "Check for duplicates (internal implementation) ..."
local TESTPKG="ignoreflock"
local has_testpkg=""
if epm --quiet installed $TESTPKG ; then
has_testpkg=1
sudocmd epm remove --auto $TESTPKG || return
fi
local PKGLIST
PKGLIST=$(LANG=C $SUDO apt-get install $TESTPKG 2>&1 | grep "W: There are multiple versions of" | \
sed -e 's|W: There are multiple versions of "\(.*\)" in your system.|\1|')
local TODEL
for i in $PKGLIST ; do
local pkg=${i/.32bit/}
local todel="$(rpm -q $pkg | head -n1)"
local todel2="$(rpm -q $pkg | head -n2 | tail -n1)"
if [ "$todel" = "$todel2" ] ; then
echo "Fix the same name duplicates for $pkg..."
sudocmd rpm -e "$todel" --allmatches --nodeps --justdb && epm install $pkg && continue
fi
# first use older package
[ "$(rpmevrcmp "$todel" "$todel2")" = "1" ] && todel="$todel2"
sudocmd rpm -e "$todel" || TODEL="$TODEL $todel"
done
[ -n "$TODEL" ] && sudocmd rpm -e "$TODEL"
[ -n "$has_testpkg" ] && epm install $TESTPKG
}
epm_dedup()
{
case "$DISTRNAME" in
"ALTLinux")
assure_exists /usr/share/apt/scripts apt-scripts
if [ -f /usr/share/apt/scripts/dedup.lua ] ; then
"Check for duplicates via apt-get dedup from apt-scripts"
sudocmd apt-get dedup
else
try_fix_apt_rpm_dupls
fi
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
# File bin/epm-downgrade: # File bin/epm-downgrade:
...@@ -1981,8 +2038,8 @@ epm_download() ...@@ -1981,8 +2038,8 @@ epm_download()
{ {
local CMD local CMD
case $DISTRNAME in case $DISTRNAME-$PMTYPE in
ALTLinux) ALTLinux-apt-rpm)
__epm_download_alt $pkg_filenames __epm_download_alt $pkg_filenames
return return
;; ;;
...@@ -1995,6 +2052,10 @@ epm_download() ...@@ -1995,6 +2052,10 @@ epm_download()
aptcyg) aptcyg)
sudocmd apt-cyg download $pkg_filenames sudocmd apt-cyg download $pkg_filenames
;; ;;
packagekit-*)
# TODO: force
docmd pkcon download $pkg_filenames
;;
yum-rpm) yum-rpm)
# TODO: check yum install --downloadonly --downloaddir=/tmp <package-name> # TODO: check yum install --downloadonly --downloaddir=/tmp <package-name>
assure_exists yumdownloader yum-utils assure_exists yumdownloader yum-utils
...@@ -2111,6 +2172,9 @@ __epm_filelist_remote() ...@@ -2111,6 +2172,9 @@ __epm_filelist_remote()
fi fi
docmd_foreach __deb_local_content_filelist "$@" docmd_foreach __deb_local_content_filelist "$@"
;; ;;
packagekit-*)
docmd pkcon get-files "$@"
;;
yum-rpm) yum-rpm)
assure_exists yum-utils || return assure_exists yum-utils || return
docmd repoquery -q -l "$@" docmd repoquery -q -l "$@"
...@@ -2164,6 +2228,9 @@ __epm_filelist_name() ...@@ -2164,6 +2228,9 @@ __epm_filelist_name()
*-dpkg) *-dpkg)
CMD="dpkg -L" CMD="dpkg -L"
;; ;;
packagekit-*)
CMD="pkcon get-files"
;;
android) android)
CMD="pm list packages -f" CMD="pm list packages -f"
;; ;;
...@@ -2222,6 +2289,18 @@ epm_filelist() ...@@ -2222,6 +2289,18 @@ epm_filelist()
} }
# File bin/epm-full_upgrade:
epm_full_upgrade()
{
(pkg_filenames='' epm_update) || return
epm_upgrade || return
epm_kernel_update || return
}
# File bin/epm-info: # File bin/epm-info:
...@@ -2254,10 +2333,6 @@ __epm_info_by_pkgtype() ...@@ -2254,10 +2333,6 @@ __epm_info_by_pkgtype()
__epm_info_by_pmtype() __epm_info_by_pmtype()
{ {
case $PMTYPE in case $PMTYPE in
apt-rpm)
__epm_info_rpm_low && return
docmd apt-cache show $pkg_names
;;
apt-dpkg) apt-dpkg)
if [ -n "$pkg_files" ] ; then if [ -n "$pkg_files" ] ; then
docmd dpkg -I $pkg_files docmd dpkg -I $pkg_files
...@@ -2273,21 +2348,35 @@ case $PMTYPE in ...@@ -2273,21 +2348,35 @@ case $PMTYPE in
[ -z "$pkg_names" ] && return [ -z "$pkg_names" ] && return
docmd aptitude show $pkg_names docmd aptitude show $pkg_names
;; ;;
yum-rpm) *-rpm)
__epm_info_rpm_low && return
docmd yum info $pkg_names
;;
urpmi-rpm)
__epm_info_rpm_low && return
docmd urpmq -i $pkg_names
;;
dnf-rpm)
__epm_info_rpm_low && return __epm_info_rpm_low && return
docmd dnf info $pkg_names case $PMTYPE in
apt-rpm)
docmd apt-cache show $pkg_names
;;
packagekit-rpm)
docmd pkcon get-details $pkg_names
;;
yum-rpm)
docmd yum info $pkg_names
;;
urpmi-rpm)
docmd urpmq -i $pkg_names
;;
dnf-rpm)
docmd dnf info $pkg_names
;;
zypper-rpm)
docmd zypper info $pkg_names
;;
*)
warning "Unknown command for $PMTYPE"
;;
esac
;; ;;
zypper-rpm) packagekit-*)
__epm_info_rpm_low && return # TODO: get-details-local
docmd zypper info $pkg_names docmd pkcon get-details $pkg_names
;; ;;
pacman) pacman)
is_installed $pkg_names && docmd pacman -Qi $pkg_names && return is_installed $pkg_names && docmd pacman -Qi $pkg_names && return
...@@ -2459,6 +2548,9 @@ epm_install_names() ...@@ -2459,6 +2548,9 @@ epm_install_names()
urpm-rpm) urpm-rpm)
sudocmd urpmi $URPMOPTIONS $@ sudocmd urpmi $URPMOPTIONS $@
return ;; return ;;
packagekit-*)
docmd pkcon install $@
return ;;
pkgsrc) pkgsrc)
sudocmd pkg_add -r $@ sudocmd pkg_add -r $@
return ;; return ;;
...@@ -2559,6 +2651,9 @@ epm_ni_install_names() ...@@ -2559,6 +2651,9 @@ epm_ni_install_names()
# FIXME: returns true ever no package found, need check for "no found", "Nothing to do." # FIXME: returns true ever no package found, need check for "no found", "Nothing to do."
yes | sudocmd zypper --non-interactive $ZYPPEROPTIONS install $@ yes | sudocmd zypper --non-interactive $ZYPPEROPTIONS install $@
return ;; return ;;
packagekit-*)
docmd pkcon install --noninteractive $@
return ;;
pkgsrc) pkgsrc)
sudocmd pkg_add -r $@ sudocmd pkg_add -r $@
return ;; return ;;
...@@ -2643,9 +2738,9 @@ epm_install_files() ...@@ -2643,9 +2738,9 @@ epm_install_files()
# TODO: check read permissions # TODO: check read permissions
# sudo test -r FILE # sudo test -r FILE
# do not fallback to install_names if we have no permissions # do not fallback to install_names if we have no permissions
case "$DISTRNAME" in
"ALTLinux")
case $PMTYPE in
apt-rpm)
# TODO: replace with name changed function # TODO: replace with name changed function
__epm_check_if_try_install_deb $@ && return __epm_check_if_try_install_deb $@ && return
...@@ -2662,7 +2757,9 @@ epm_install_files() ...@@ -2662,7 +2757,9 @@ epm_install_files()
# use install_names # use install_names
;; ;;
esac
case $PMTYPE in
apt-dpkg|aptitude-dpkg) apt-dpkg|aptitude-dpkg)
# the new version of the conf. file is installed with a .dpkg-dist suffix # the new version of the conf. file is installed with a .dpkg-dist suffix
if [ -n "$non_interactive" ] ; then if [ -n "$non_interactive" ] ; then
...@@ -2686,34 +2783,7 @@ epm_install_files() ...@@ -2686,34 +2783,7 @@ epm_install_files()
return return
;; ;;
yum-rpm|dnf-rpm) *-rpm)
__epm_check_if_try_install_deb $@ && return
sudocmd rpm -Uvh $force $nodeps $@ && return
# if run with --nodeps, do not fallback on hi level
__epm_check_if_rpm_already_installed $@ && return
[ -n "$nodeps" ] && return
YUMOPTIONS=--nogpgcheck
# use install_names
;;
zypper-rpm)
__epm_check_if_try_install_deb $@ && return
sudocmd rpm -Uvh $force $nodeps $@ && return
local RES=$?
__epm_check_if_rpm_already_installed $@ && return
# if run with --nodeps, do not fallback on hi level
[ -n "$nodeps" ] && return $RES
ZYPPEROPTIONS=$(__use_zypper_no_gpg_checks)
# use install_names
;;
urpm-rpm)
__epm_check_if_try_install_deb $@ && return __epm_check_if_try_install_deb $@ && return
sudocmd rpm -Uvh $force $nodeps $@ && return sudocmd rpm -Uvh $force $nodeps $@ && return
local RES=$? local RES=$?
...@@ -2723,9 +2793,27 @@ epm_install_files() ...@@ -2723,9 +2793,27 @@ epm_install_files()
# if run with --nodeps, do not fallback on hi level # if run with --nodeps, do not fallback on hi level
[ -n "$nodeps" ] && return $RES [ -n "$nodeps" ] && return $RES
URPMOPTIONS=--no-verify-rpm case $PMTYPE in
# use install_names yum-rpm|dnf-rpm)
YUMOPTIONS=--nogpgcheck
# use install_names
;;
zypper-rpm)
ZYPPEROPTIONS=$(__use_zypper_no_gpg_checks)
# use install_names
;;
urpm-rpm)
URPMOPTIONS=--no-verify-rpm
# use install_names
;;
*)
# use install_names
;;
esac
;; ;;
packagekit-*)
docmd pkcon install-local $@
return ;;
pkgsrc) pkgsrc)
sudocmd pkg_add $@ sudocmd pkg_add $@
return ;; return ;;
...@@ -2770,10 +2858,10 @@ epm_print_install_command() ...@@ -2770,10 +2858,10 @@ epm_print_install_command()
#[ -z "$1" ] && return #[ -z "$1" ] && return
[ -z "$1" ] && [ -n "$pkg_names" ] && return [ -z "$1" ] && [ -n "$pkg_names" ] && return
case $PMTYPE in case $PMTYPE in
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm) *-rpm)
echo "rpm -Uvh --force $nodeps $*" echo "rpm -Uvh --force $nodeps $*"
;; ;;
apt-dpkg|aptitude-dpkg) *-dpkg)
echo "dpkg -i $*" echo "dpkg -i $*"
;; ;;
pkgsrc) pkgsrc)
...@@ -2845,6 +2933,9 @@ epm_print_install_names_command() ...@@ -2845,6 +2933,9 @@ epm_print_install_names_command()
zypper-rpm) zypper-rpm)
echo "zypper --non-interactive $ZYPPEROPTIONS install $*" echo "zypper --non-interactive $ZYPPEROPTIONS install $*"
return ;; return ;;
packagekit-*)
echo "pkcon --noninteractive $*"
return ;;
pacman) pacman)
echo "pacman -S --noconfirm $force $*" echo "pacman -S --noconfirm $force $*"
return ;; return ;;
...@@ -2866,7 +2957,10 @@ epm_install() ...@@ -2866,7 +2957,10 @@ epm_install()
if tasknumber "$pkg_names" >/dev/null ; then if tasknumber "$pkg_names" >/dev/null ; then
assure_distr ALTLinux "install with task number" assure_distr ALTLinux "install with task number"
assure_exists apt-repo assure_exists apt-repo
sudocmd apt-repo test $(tasknumber "$pkg_names") local task
for task in $(tasknumber "$pkg_names") ; do
sudocmd apt-repo test $task
done
return return
fi fi
...@@ -2941,18 +3035,11 @@ epm_Install() ...@@ -2941,18 +3035,11 @@ epm_Install()
[ -z "$files$names" ] && info "Install: Skip empty install list." && return 22 [ -z "$files$names" ] && info "Install: Skip empty install list." && return 22
# do update only if really need install something (pkg_filenames='' epm_update) || return
case $PMTYPE in
yum-rpm)
;;
*)
pkg_filenames='' epm_update || return
;;
esac
epm_install_names $names || return epm_install_names $names || return
epm_install_files $files
epm_install_files $files
} }
# File bin/epm-install-emerge: # File bin/epm-install-emerge:
...@@ -3047,8 +3134,8 @@ epm_kernel_update() ...@@ -3047,8 +3134,8 @@ epm_kernel_update()
fi fi
assure_exists update-kernel update-kernel 0.9.9 assure_exists update-kernel update-kernel 0.9.9
update_repo_if_needed update_repo_if_needed
sudocmd update-kernel $pkg_filenames || return sudocmd update-kernel $(subst_option non_interactive -y) $pkg_filenames || return
docmd epm remove-old-kernels $pkg_filenames || fatal docmd epm remove-old-kernels $(subst_option non_interactive -y) $pkg_filenames || fatal
return ;; return ;;
esac esac
...@@ -3096,12 +3183,12 @@ esac ...@@ -3096,12 +3183,12 @@ esac
__epm_packages_sort() __epm_packages_sort()
{ {
case $PMTYPE in case $PMTYPE in
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm) *-rpm)
# FIXME: space with quotes problems, use point instead # FIXME: space with quotes problems, use point instead
warmup_rpmbase warmup_rpmbase
docmd rpm -qa --queryformat "%{size}@%{name}-%{version}-%{release}\n" $pkg_filenames | sed -e "s|@| |g" | sort -n -k1 docmd rpm -qa --queryformat "%{size}@%{name}-%{version}-%{release}\n" $pkg_filenames | sed -e "s|@| |g" | sort -n -k1
;; ;;
apt-dpkg) *-dpkg)
warmup_dpkgbase warmup_dpkgbase
docmd dpkg-query -W --showformat="\${Installed-Size}@\${Package}-\${Version}:\${Architecture}\n" $pkg_filenames | sed -e "s|@| |g" | sort -n -k1 docmd dpkg-query -W --showformat="\${Installed-Size}@\${Package}-\${Version}:\${Architecture}\n" $pkg_filenames | sed -e "s|@| |g" | sort -n -k1
;; ;;
...@@ -3129,13 +3216,6 @@ epm_packages() ...@@ -3129,13 +3216,6 @@ epm_packages()
[ -n "$sort" ] && __epm_packages_sort && return [ -n "$sort" ] && __epm_packages_sort && return
case $PMTYPE in case $PMTYPE in
apt-rpm)
warmup_rpmbase
# FIXME: strong equal
CMD="rpm -qa $pkg_filenames"
[ -n "$short" ] && CMD="rpm -qa --queryformat %{name}\n $pkg_filenames"
docmd $CMD
return ;;
*-dpkg) *-dpkg)
warmup_dpkgbase warmup_dpkgbase
# FIXME: strong equal # FIXME: strong equal
...@@ -3146,16 +3226,19 @@ case $PMTYPE in ...@@ -3146,16 +3226,19 @@ case $PMTYPE in
showcmd $CMD showcmd $CMD
$CMD | grep "^i" | sed -e "s|.* ||g" | __fo_pfn $CMD | grep "^i" | sed -e "s|.* ||g" | __fo_pfn
return ;; return ;;
snappy) *-rpm)
CMD="snappy info"
;;
yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm)
warmup_rpmbase warmup_rpmbase
# FIXME: strong equal # FIXME: strong equal
CMD="rpm -qa $pkg_filenames" CMD="rpm -qa $pkg_filenames"
[ -n "$short" ] && CMD="rpm -qa --queryformat %{name}\n $pkg_filenames" [ -n "$short" ] && CMD="rpm -qa --queryformat %{name}\n $pkg_filenames"
docmd $CMD docmd $CMD
return ;; return ;;
packagekit-*)
docmd pkcon get-packages --filter installed
;;
snappy)
CMD="snappy info"
;;
emerge) emerge)
CMD="qlist -I -C" CMD="qlist -I -C"
# print with colors for console output # print with colors for console output
...@@ -3271,11 +3354,11 @@ warmup_bases ...@@ -3271,11 +3354,11 @@ warmup_bases
pkg_names=$(__epm_get_hilevel_name $pkg_names) pkg_names=$(__epm_get_hilevel_name $pkg_names)
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-*)
docmd apt-cache policy $pkg_names docmd apt-cache policy $pkg_names
;; ;;
apt-dpkg) packagekit-*)
docmd apt-cache policy $pkg_names docmd pkcon resolve $pkg_names
;; ;;
*) *)
fatal "Have no suitable command for $PMTYPE" fatal "Have no suitable command for $PMTYPE"
...@@ -3683,12 +3766,12 @@ _shortquery_via_packages_list() ...@@ -3683,12 +3766,12 @@ _shortquery_via_packages_list()
# Note: double call due stderr redirect # Note: double call due stderr redirect
# Note: we use short=1 here due grep by ^name$ # Note: we use short=1 here due grep by ^name$
# separate first line for print out command # separate first line for print out command
short=1 pkg_filenames=$firstpkg epm_packages | grep -- "$grepexp" && res=0 || res=1 (short=1 pkg_filenames=$firstpkg epm_packages | grep -- "$grepexp") && res=0 || res=1
local pkg local pkg
for pkg in "$@" ; do for pkg in "$@" ; do
grepexp=$(_get_grep_exp $pkg) grepexp=$(_get_grep_exp $pkg)
short=1 pkg_filenames=$pkg epm_packages 2>/dev/null | grep -- "$grepexp" || res=1 (short=1 pkg_filenames=$pkg epm_packages 2>/dev/null) | grep -- "$grepexp" || res=1
done done
# TODO: print in query (for user): 'warning: package $pkg is not installed' # TODO: print in query (for user): 'warning: package $pkg is not installed'
...@@ -3709,12 +3792,12 @@ _query_via_packages_list() ...@@ -3709,12 +3792,12 @@ _query_via_packages_list()
# Note: double call due stderr redirect # Note: double call due stderr redirect
# Note: we use short=1 here due grep by ^name$ # Note: we use short=1 here due grep by ^name$
# separate first line for print out command # separate first line for print out command
short=1 pkg_filenames=$firstpkg epm_packages | grep -q -- "$grepexp" && quiet=1 pkg_filenames=$firstpkg epm_packages && res=0 || res=1 (short=1 pkg_filenames=$firstpkg epm_packages) | grep -q -- "$grepexp" && (quiet=1 pkg_filenames=$firstpkg epm_packages) && res=0 || res=1
local pkg local pkg
for pkg in "$@" ; do for pkg in "$@" ; do
grepexp=$(_get_grep_exp $pkg) grepexp=$(_get_grep_exp $pkg)
short=1 pkg_filenames=$pkg epm_packages 2>/dev/null | grep -q -- "$grepexp" && quiet=1 pkg_filenames=$pkg epm_packages || res=1 (short=1 pkg_filenames=$pkg epm_packages 2>/dev/null) | grep -q -- "$grepexp" && (quiet=1 pkg_filenames=$pkg epm_packages) || res=1
done done
return $res return $res
...@@ -3983,17 +4066,11 @@ __do_query() ...@@ -3983,17 +4066,11 @@ __do_query()
{ {
local CMD local CMD
case $PMTYPE in case $PMTYPE in
apt-rpm)
CMD="rpm -qf"
;;
*-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 ;;
yum-rpm|dnf-rpm|urpm-rpm) *-rpm)
CMD="rpm -qf"
;;
zypper-rpm)
CMD="rpm -qf" CMD="rpm -qf"
;; ;;
emerge) emerge)
...@@ -4126,6 +4203,10 @@ epm_reinstall_names() ...@@ -4126,6 +4203,10 @@ epm_reinstall_names()
aptitude-dpkg) aptitude-dpkg)
sudocmd aptitude reinstall $@ sudocmd aptitude reinstall $@
return ;; return ;;
packagekit-*)
warning "Please send me the correct command form for it"
docmd pkcon install --allow-reinstall $@
return ;;
yum-rpm) yum-rpm)
sudocmd yum reinstall $@ sudocmd yum reinstall $@
return ;; return ;;
...@@ -4251,14 +4332,21 @@ __replace_alt_version_in_repo() ...@@ -4251,14 +4332,21 @@ __replace_alt_version_in_repo()
__alt_repofix() __alt_repofix()
{ {
local TO="$1"
showcmd epm repofix showcmd epm repofix
quiet=1 pkg_filenames='' epm_repofix >/dev/null (quiet=1 pkg_filenames='' epm_repofix >/dev/null)
__replace_text_in_alt_repo "/^ *#/! s!\[[tpc][6-9]\]![updates]!g" # replace sign name
if [ -n "$TO" ] ; then
__replace_text_in_alt_repo "/^ *#/! s!\[alt\]![$TO]!g"
__replace_text_in_alt_repo "/^ *#/! s!\[sisyphus\]![$TO]!g"
__replace_text_in_alt_repo "/^ *#/! s!\[updates\]![$TO]!g"
__replace_text_in_alt_repo "/^ *#/! s!\[[tpc][6-9]\]![$TO]!g"
fi
} }
__get_conflict_release_pkg() __get_conflict_release_pkg()
{ {
epmqf --quiet --short /etc/fedora-release | head -n1 epm qf --quiet --short /etc/fedora-release | head -n1
} }
get_fix_release_pkg() get_fix_release_pkg()
...@@ -4293,6 +4381,9 @@ get_fix_release_pkg() ...@@ -4293,6 +4381,9 @@ 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)
epm --quiet --short -q etersoft-gpgkeys 2>/dev/null
if [ -n "$TOINSTALL" ] ; then if [ -n "$TOINSTALL" ] ; then
echo "$TOINSTALL" echo "$TOINSTALL"
...@@ -4308,21 +4399,20 @@ get_fix_release_pkg() ...@@ -4308,21 +4399,20 @@ get_fix_release_pkg()
__update_to_the_distro() __update_to_the_distro()
{ {
local TO="$1" local TO="$1"
__alt_repofix
case "$TO" in case "$TO" in
p7) p7)
__alt_repofix
docmd epm update || fatal docmd epm update || fatal
docmd epm install rpm apt "$(get_fix_release_pkg --force "$TO")" || fatal "Check an error and run epm release-upgrade again" docmd epm install rpm apt "$(get_fix_release_pkg --force "$TO")" || fatal "Check an error and run epm release-upgrade again"
__alt_repofix __alt_repofix $TO
__replace_text_in_alt_repo "/^ *#/! s!\[updates\]![$TO]!g"
docmd epm update || fatal docmd epm update || fatal
docmd epm upgrade || fatal "Check an error and run epm release-upgrade again" docmd epm upgrade || fatal "Check an error and run epm release-upgrade again"
;; ;;
p8) p8)
__alt_repofix
docmd epm update || fatal docmd epm update || fatal
docmd epm install rpm apt "$(get_fix_release_pkg --force "$TO")" || fatal "Check an error and run epm release-upgrade again" docmd epm install rpm apt "$(get_fix_release_pkg --force "$TO")" || fatal "Check an error and run epm release-upgrade again"
__alt_repofix __alt_repofix $TO
__replace_text_in_alt_repo "/^ *#/! s!\[updates\]![$TO]!g"
docmd epm update || fatal docmd epm update || fatal
# sure we have systemd if systemd is running # sure we have systemd if systemd is running
if is_installed systemd && is_active_systemd systemd ; then if is_installed systemd && is_active_systemd systemd ; then
...@@ -4330,12 +4420,23 @@ __update_to_the_distro() ...@@ -4330,12 +4420,23 @@ __update_to_the_distro()
fi fi
docmd epm upgrade || fatal "Check an error and run epm release-upgrade again" docmd epm upgrade || fatal "Check an error and run epm release-upgrade again"
;; ;;
p9)
#docmd epm update || fatal
#docmd epm install rpm apt "$(get_fix_release_pkg --force "$TO")" || fatal "Check an error and run epm release-upgrade again"
__alt_repofix $TO
docmd epm update || fatal
# sure we have systemd if systemd is running
#if is_installed systemd && is_active_systemd systemd ; then
# docmd epm install systemd || fatal
#fi
docmd epm upgrade || fatal "Check an error and run epm release-upgrade again"
;;
Sisyphus) Sisyphus)
__alt_repofix
docmd epm update || fatal docmd epm update || fatal
local ADDPKG #local ADDPKG
ADDPKG=$(epm -q --short make-initrd sssd-ad 2>/dev/null) #ADDPKG=$(epm -q --short make-initrd sssd-ad 2>/dev/null)
docmd epm install librpm7 librpm rpm apt $ADDPKG "$(get_fix_release_pkg --force "$TO")" ConsoleKit2- || fatal "Check an error and run again" #docmd epm install librpm7 librpm rpm apt $ADDPKG "$(get_fix_release_pkg --force "$TO")" ConsoleKit2- || fatal "Check an error and run again"
#docmd apt-get upgrade || fatal "Check an error and run epm release-upgrade or just epm upgrade again"
docmd epm upgrade || fatal "Check an error and run epm release-upgrade or just epm upgrade again" docmd epm upgrade || fatal "Check an error and run epm release-upgrade or just epm upgrade again"
;; ;;
*) *)
...@@ -4354,6 +4455,7 @@ __update_alt_to_next_distro() ...@@ -4354,6 +4455,7 @@ __update_alt_to_next_distro()
TO="p7" TO="p7"
confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..." confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install rpm apt "$(get_fix_release_pkg "$FROM")" || fatal docmd epm install rpm apt "$(get_fix_release_pkg "$FROM")" || fatal
__replace_alt_version_in_repo "Sisyphus/" "$TO/branch/"
__replace_alt_version_in_repo "$FROM/branch/" "$TO/branch/" __replace_alt_version_in_repo "$FROM/branch/" "$TO/branch/"
__update_to_the_distro "$TO" __update_to_the_distro "$TO"
docmd epm update-kernel docmd epm update-kernel
...@@ -4364,6 +4466,17 @@ __update_alt_to_next_distro() ...@@ -4364,6 +4466,17 @@ __update_alt_to_next_distro()
TO="p8" TO="p8"
confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..." confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install rpm apt "$(get_fix_release_pkg "$FROM")" || fatal docmd epm install rpm apt "$(get_fix_release_pkg "$FROM")" || fatal
__replace_alt_version_in_repo "Sisyphus/" "$TO/branch/"
__replace_alt_version_in_repo $FROM/branch/ $TO/branch/
__update_to_the_distro $TO
docmd epm update-kernel || fatal
info "Done."
;;
"p8"|"p8 p9"|"t8 p9"|"c8 c9"|"p9 p9")
TO="p9"
confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install rpm apt "$(get_fix_release_pkg "$FROM")" || fatal
__replace_alt_version_in_repo "Sisyphus/" "$TO/branch/"
__replace_alt_version_in_repo $FROM/branch/ $TO/branch/ __replace_alt_version_in_repo $FROM/branch/ $TO/branch/
__update_to_the_distro $TO __update_to_the_distro $TO
docmd epm update-kernel || fatal docmd epm update-kernel || fatal
...@@ -4374,19 +4487,28 @@ __update_alt_to_next_distro() ...@@ -4374,19 +4487,28 @@ __update_alt_to_next_distro()
confirm_info "Downgrade $DISTRNAME from $FROM to $TO ..." confirm_info "Downgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install "$(get_fix_release_pkg "$FROM")" || fatal docmd epm install "$(get_fix_release_pkg "$FROM")" || fatal
__replace_alt_version_in_repo "$FROM/" "$TO/branch/" __replace_alt_version_in_repo "$FROM/" "$TO/branch/"
__replace_text_in_alt_repo "/^ *#/! s!\[alt\]![$TO]!g" #__replace_text_in_alt_repo "/^ *#/! s!\[alt\]![$TO]!g"
__update_to_the_distro $TO
docmd epm downgrade || fatal
info "Done."
;;
"Sisyphus p9")
TO="p9"
confirm_info "Downgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install "$(get_fix_release_pkg "$FROM")" || fatal
__replace_alt_version_in_repo "$FROM/" "$TO/branch/"
#__replace_text_in_alt_repo "/^ *#/! s!\[alt\]![$TO]!g"
__update_to_the_distro $TO __update_to_the_distro $TO
docmd epm downgrade || fatal docmd epm downgrade || fatal
info "Done." info "Done."
;; ;;
"p8 Sisyphus"|"Sisyphus Sisyphus") "p8 Sisyphus"|"p9 Sisyphus"|"Sisyphus Sisyphus")
TO="Sisyphus" TO="Sisyphus"
confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..." confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install rpm apt "$(get_fix_release_pkg "$FROM")" || fatal docmd epm install rpm apt "$(get_fix_release_pkg "$FROM")" || fatal
docmd epm upgrade || fatal docmd epm upgrade || fatal
__replace_alt_version_in_repo "$FROM/branch/" "$TO/" __replace_alt_version_in_repo "$FROM/branch/" "$TO/"
__alt_repofix __alt_repofix "sisyphus"
__replace_text_in_alt_repo "/^ *#/! s!\[updates\]![alt]!g"
__update_to_the_distro $TO __update_to_the_distro $TO
docmd epm update-kernel || fatal docmd epm update-kernel || fatal
info "Done." info "Done."
...@@ -4426,15 +4548,18 @@ epm_release_upgrade() ...@@ -4426,15 +4548,18 @@ epm_release_upgrade()
fi fi
fi fi
__alt_repofix
# check forced target # check forced target
if [ -n "$pkg_filenames" ] ; then if [ -n "$pkg_filenames" ] ; then
[ "$(__wcount $pkg_filenames)" = "1" ] || fatal "Too many args: $pkg_filenames" [ "$(__wcount $pkg_filenames)" = "1" ] || fatal "Too many args: $pkg_filenames"
fi fi
TARGET="$pkg_filenames"
__alt_repofix
# TODO: ask before upgrade # TODO: ask before upgrade
__update_alt_to_next_distro $DISTRVERSION $pkg_filenames __update_alt_to_next_distro $DISTRVERSION $TARGET
return return
;; ;;
*) *)
...@@ -4450,6 +4575,9 @@ epm_release_upgrade() ...@@ -4450,6 +4575,9 @@ epm_release_upgrade()
assure_exists do-release-upgrade update-manager-core assure_exists do-release-upgrade update-manager-core
sudocmd do-release-upgrade sudocmd do-release-upgrade
;; ;;
packagekit-*)
docmd pkcon upgrade-system $pkg_filenames
;;
yum-rpm) yum-rpm)
docmd epm install rpm yum docmd epm install rpm yum
sudocmd yum clean all sudocmd yum clean all
...@@ -4521,10 +4649,10 @@ epm_remove_low() ...@@ -4521,10 +4649,10 @@ epm_remove_low()
warmup_lowbase warmup_lowbase
case $PMTYPE in case $PMTYPE in
apt-rpm|yum-rpm|zypper-rpm|urpm-rpm|dnf-rpm) *-rpm)
sudocmd rpm -ev $nodeps $@ sudocmd rpm -ev $nodeps $@
return ;; return ;;
apt-dpkg|aptitude-dpkg) *-dpkg|-dpkg)
# shellcheck disable=SC2046 # shellcheck disable=SC2046
sudocmd dpkg -P $(subst_option nodeps --force-all) $(print_name "$@") sudocmd dpkg -P $(subst_option nodeps --force-all) $(print_name "$@")
return ;; return ;;
...@@ -4563,6 +4691,9 @@ epm_remove_names() ...@@ -4563,6 +4691,9 @@ epm_remove_names()
apt-rpm) apt-rpm)
sudocmd apt-get remove $APTOPTIONS $@ sudocmd apt-get remove $APTOPTIONS $@
return ;; return ;;
packagekit-*)
docmd pkcon remove $@
return ;;
deepsolver-rpm) deepsolver-rpm)
sudocmd ds-remove $@ sudocmd ds-remove $@
return ;; return ;;
...@@ -4654,6 +4785,9 @@ epm_remove_nonint() ...@@ -4654,6 +4785,9 @@ epm_remove_nonint()
apt-rpm) apt-rpm)
sudocmd apt-get -y --force-yes remove $@ sudocmd apt-get -y --force-yes remove $@
return ;; return ;;
packagekit-*)
docmd pkcon remove --noninteractive $@
return ;;
urpm-rpm) urpm-rpm)
sudocmd urpme --auto $@ sudocmd urpme --auto $@
return ;; return ;;
...@@ -4688,12 +4822,15 @@ epm_remove_nonint() ...@@ -4688,12 +4822,15 @@ epm_remove_nonint()
epm_print_remove_command() epm_print_remove_command()
{ {
case $PMTYPE in case $PMTYPE in
apt-rpm|yum-rpm|zypper-rpm|urpm-rpm|dnf-rpm) *-rpm)
echo "rpm -ev $nodeps $*" echo "rpm -ev $nodeps $*"
;; ;;
apt-dpkg|aptitude-dpkg) *-dpkg)
echo "dpkg -P $*" echo "dpkg -P $*"
;; ;;
packagekit-*)
echo "pkcon remove --noninteractive $*"
;;
pkgsrc) pkgsrc)
echo "pkg_delete -r $*" echo "pkg_delete -r $*"
;; ;;
...@@ -4801,7 +4938,7 @@ epm_remove_old_kernels() ...@@ -4801,7 +4938,7 @@ epm_remove_old_kernels()
return return
fi fi
assure_exists update-kernel update-kernel 0.9.9 assure_exists update-kernel update-kernel 0.9.9
sudocmd remove-old-kernels $pkg_filenames sudocmd remove-old-kernels $(subst_option non_interactive -y) $pkg_filenames
return ;; return ;;
Ubuntu) Ubuntu)
if ! __epm_query_package linux-image >/dev/null ; then if ! __epm_query_package linux-image >/dev/null ; then
...@@ -4876,7 +5013,7 @@ case $DISTRNAME in ...@@ -4876,7 +5013,7 @@ case $DISTRNAME in
;; ;;
esac esac
[ -n "$repo" ] || fatal "No such repo or task. Use epm remove repo [autoimports|archive|TASK]" [ -n "$repo" ] || fatal "No such repo or task. Use epm remove repo [autoimports|archive|tasks/TASKNUMBER]"
assure_exists apt-repo assure_exists apt-repo
sudocmd apt-repo rm "$repo" sudocmd apt-repo rm "$repo"
return return
...@@ -5277,6 +5414,9 @@ case $PMTYPE in ...@@ -5277,6 +5414,9 @@ case $PMTYPE in
zypper-rpm) zypper-rpm)
docmd zypper sl -d docmd zypper sl -d
;; ;;
packagekit-*)
docmd pkcon repo-list
;;
emerge) emerge)
docmd eselect profile list docmd eselect profile list
docmd layman -L docmd layman -L
...@@ -5340,7 +5480,9 @@ case $PMTYPE in ...@@ -5340,7 +5480,9 @@ case $PMTYPE in
#return #return
CMD="apt-cache depends" CMD="apt-cache depends"
fi fi
;;
packagekit-*)
CMD="pkcon required-by"
;; ;;
#zypper-rpm) #zypper-rpm)
# # FIXME: use hi level commands # # FIXME: use hi level commands
...@@ -5431,6 +5573,9 @@ case $PMTYPE in ...@@ -5431,6 +5573,9 @@ case $PMTYPE in
deepsolver-rpm) deepsolver-rpm)
CMD="ds-require --" CMD="ds-require --"
;; ;;
packagekit-*)
CMD="pkcon search name"
;;
urpm-rpm) urpm-rpm)
# urpmq does not support -- # urpmq does not support --
CMD="urpmq -y" CMD="urpmq -y"
...@@ -5457,7 +5602,7 @@ case $PMTYPE in ...@@ -5457,7 +5602,7 @@ case $PMTYPE in
CMD="dnf search --" CMD="dnf search --"
;; ;;
zypper-rpm) zypper-rpm)
CMD="zypper search --" CMD="zypper search -d --"
;; ;;
mpkg) mpkg)
CMD="mpkg search" CMD="mpkg search"
...@@ -5642,6 +5787,9 @@ case $PMTYPE in ...@@ -5642,6 +5787,9 @@ case $PMTYPE in
sudocmd apt-file update sudocmd apt-file update
docmd apt-file search $pkg_filenames docmd apt-file search $pkg_filenames
return ;; return ;;
packagekit-*)
CMD="pkcon search file"
;;
yum-rpm) yum-rpm)
# TODO # TODO
info "Search by full packages list is not implemented yet" info "Search by full packages list is not implemented yet"
...@@ -5656,7 +5804,7 @@ case $PMTYPE in ...@@ -5656,7 +5804,7 @@ case $PMTYPE in
CMD="urpmf" CMD="urpmf"
;; ;;
zypper-rpm) zypper-rpm)
CMD="zypper wp vi" CMD="zypper search --file-list"
;; ;;
pacman) pacman)
CMD="pacman -Qo" CMD="pacman -Qo"
...@@ -5777,8 +5925,8 @@ get_local_alt_contents_index() ...@@ -5777,8 +5925,8 @@ get_local_alt_contents_index()
tasknumber() tasknumber()
{ {
local num="$(echo "$*" | sed -e "s| *#*||g")" local num="$(echo "$1" | sed -e "s| *#*||g")"
isnumber "$num" && echo "$num" isnumber "$num" && echo "$*"
} }
...@@ -5961,7 +6109,7 @@ EOF ...@@ -5961,7 +6109,7 @@ EOF
# 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 | egrep "(installed|upgrade)" && continue
#pkg_filenames="$pkg" verbose=--verbose __epm_search_internal | egrep "(installed|upgrade)" && continue #pkg_filenames="$pkg" verbose=--verbose __epm_search_internal | egrep "(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."
done done
...@@ -6139,6 +6287,9 @@ case $PMTYPE in ...@@ -6139,6 +6287,9 @@ case $PMTYPE in
#sudocmd apt-get -f install || exit #sudocmd apt-get -f install || exit
#sudocmd apt-get autoremove #sudocmd apt-get autoremove
;; ;;
packagekit-*)
docmd pkcon refresh
;;
#snappy) #snappy)
# sudocmd snappy # sudocmd snappy
# ;; # ;;
...@@ -6146,14 +6297,12 @@ case $PMTYPE in ...@@ -6146,14 +6297,12 @@ case $PMTYPE in
sudocmd aptitude update || return sudocmd aptitude update || return
;; ;;
yum-rpm) yum-rpm)
info "update command is stubbed for yum" # just skipped
# yum makecache [ -n "$verbose" ] && info "update command is stubbed for yum"
#sudocmd yum check-update
;; ;;
dnf-rpm) dnf-rpm)
info "update command is stubbed for dnf" # just skipped
# dnf makecache [ -n "$verbose" ] && info "update command is stubbed for dnf"
#sudocmd dnf check-update
;; ;;
urpm-rpm) urpm-rpm)
sudocmd urpmi.update -a sudocmd urpmi.update -a
...@@ -6229,6 +6378,10 @@ epm_upgrade() ...@@ -6229,6 +6378,10 @@ epm_upgrade()
aptitude-dpkg) aptitude-dpkg)
CMD="aptitude dist-upgrade" CMD="aptitude dist-upgrade"
;; ;;
packagekit-*)
docmd pkcon update
return
;;
yum-rpm) yum-rpm)
local OPTIONS="$(subst_option non_interactive -y)" local OPTIONS="$(subst_option non_interactive -y)"
# can do update repobase automagically # can do update repobase automagically
...@@ -6304,13 +6457,7 @@ epm_upgrade() ...@@ -6304,13 +6457,7 @@ epm_upgrade()
epm_Upgrade() epm_Upgrade()
{ {
case $PMTYPE in (pkg_filenames='' epm_update)
yum-rpm)
;;
*)
pkg_filenames='' epm_update || return
;;
esac
epm_upgrade epm_upgrade
} }
...@@ -6341,6 +6488,9 @@ case $PMTYPE in ...@@ -6341,6 +6488,9 @@ case $PMTYPE in
aptitude-dpkg) aptitude-dpkg)
CMD="aptitude why" CMD="aptitude why"
;; ;;
packagekit-*)
CMD="pkcon depends-on"
;;
yum-rpm) yum-rpm)
CMD="repoquery --whatrequires" CMD="repoquery --whatrequires"
;; ;;
...@@ -6538,15 +6688,19 @@ fi ...@@ -6538,15 +6688,19 @@ fi
# ALT Linux based # ALT Linux based
if distro altlinux-release ; then if distro altlinux-release ; then
# TODO: use os-release firsly
DISTRIB_ID="ALTLinux" DISTRIB_ID="ALTLinux"
if has Sisyphus ; then DISTRIB_RELEASE="Sisyphus" if has Sisyphus ; then DISTRIB_RELEASE="Sisyphus"
elif has "ALT Linux 7." ; then DISTRIB_RELEASE="p7" elif has "ALT Linux 7." ; then DISTRIB_RELEASE="p7"
elif has "ALT Linux t7." ; then DISTRIB_RELEASE="t7" elif has "ALT Linux t7." ; then DISTRIB_RELEASE="t7"
elif has "ALT Linux 8." ; then DISTRIB_RELEASE="p8" elif has "ALT Linux 8." ; then DISTRIB_RELEASE="p8"
elif has "ALT .*8.[0-9]" ; then DISTRIB_RELEASE="p8" elif has "ALT .*8.[0-9]" ; then DISTRIB_RELEASE="p8"
elif has "ALT .*9.[0-9]" ; then DISTRIB_RELEASE="p9"
elif has "ALT p9 p9" ; then DISTRIB_RELEASE="p9"
elif has "Simply Linux 6." ; then DISTRIB_RELEASE="p6" elif has "Simply Linux 6." ; then DISTRIB_RELEASE="p6"
elif has "Simply Linux 7." ; then DISTRIB_RELEASE="p7" elif has "Simply Linux 7." ; then DISTRIB_RELEASE="p7"
elif has "Simply Linux 8." ; then DISTRIB_RELEASE="p8" elif has "Simply Linux 8." ; then DISTRIB_RELEASE="p8"
elif has "Simply Linux 9." ; then DISTRIB_RELEASE="p9"
elif has "ALT Linux 6." ; then DISTRIB_RELEASE="p6" elif has "ALT Linux 6." ; then DISTRIB_RELEASE="p6"
elif has "ALT Linux p8" ; then DISTRIB_RELEASE="p8" elif has "ALT Linux p8" ; then DISTRIB_RELEASE="p8"
elif has "ALT Linux p7" ; then DISTRIB_RELEASE="p7" elif has "ALT Linux p7" ; then DISTRIB_RELEASE="p7"
...@@ -7537,9 +7691,9 @@ $(get_help HELPOPT) ...@@ -7537,9 +7691,9 @@ $(get_help HELPOPT)
print_version() print_version()
{ {
echo "EPM package manager version 2.5.8" echo "EPM package manager version 3.1.0"
echo "Running on $($DISTRVENDOR) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)" echo "Running on $($DISTRVENDOR) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)"
echo "Copyright (c) Etersoft 2012-2018" echo "Copyright (c) Etersoft 2012-2019"
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."
} }
...@@ -7547,7 +7701,7 @@ print_version() ...@@ -7547,7 +7701,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=2.5.8 EPMVERSION=3.1.0
verbose= verbose=
quiet= quiet=
nodeps= nodeps=
...@@ -7671,6 +7825,9 @@ check_command() ...@@ -7671,6 +7825,9 @@ check_command()
check|fix|verify) # HELPCMD: check local package base integrity and fix it check|fix|verify) # HELPCMD: check local package base integrity and fix it
epm_cmd=check epm_cmd=check
;; ;;
dedup) # HELPCMD: remove unallowed duplicated pkgs (after upgrade crash)
epm_cmd=dedup
;;
-cl|cl|changelog) # HELPCMD: show changelog for package -cl|cl|changelog) # HELPCMD: show changelog for package
epm_cmd=changelog epm_cmd=changelog
;; ;;
...@@ -7701,7 +7858,7 @@ check_command() ...@@ -7701,7 +7858,7 @@ check_command()
assure) # HELPCMD: <command> [package]: install package if command does not exist assure) # HELPCMD: <command> [package]: install package if command does not exist
epm_cmd=assure epm_cmd=assure
;; ;;
policy) # HELPCMD: print detailed information about the priority selection of package policy|resolve) # HELPCMD: print detailed information about the priority selection of package
epm_cmd=policy epm_cmd=policy
;; ;;
...@@ -7721,7 +7878,10 @@ check_command() ...@@ -7721,7 +7878,10 @@ check_command()
removerepo|rr) # HELPCMD: remove package repo removerepo|rr) # HELPCMD: remove package repo
epm_cmd=removerepo epm_cmd=removerepo
;; ;;
release-upgrade|upgrade-release) # HELPCMD: update whole system to the release in arg (default: next (latest) release) full-upgrade) # HELPCMD: update all system packages and kernel
epm_cmd=full_upgrade
;;
release-upgrade|upgrade-release|upgrade-system) # HELPCMD: update whole system to the release in arg (default: next (latest) release)
epm_cmd=release_upgrade epm_cmd=release_upgrade
;; ;;
kernel-update|kernel-upgrade|update-kernel|upgrade-kernel) # HELPCMD: update system kernel to the last repo version kernel-update|kernel-upgrade|update-kernel|upgrade-kernel) # HELPCMD: update system kernel to the last repo version
......
...@@ -458,10 +458,12 @@ if [ -n "$FORCEPM" ] ; then ...@@ -458,10 +458,12 @@ if [ -n "$FORCEPM" ] ; then
return return
fi fi
case $DISTRNAME in case $DISTRNAME in
ALTLinux) ALTLinux)
CMD="apt-rpm" 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
;; ;;
PCLinux) PCLinux)
CMD="apt-rpm" CMD="apt-rpm"
...@@ -531,19 +533,15 @@ esac ...@@ -531,19 +533,15 @@ esac
PMTYPE=$CMD PMTYPE=$CMD
} }
is_active_systemd() is_active_systemd()
{ {
local a local a
SYSTEMCTL=/bin/systemctl SYSTEMCTL=/bin/systemctl
SYSTEMD_CGROUP_DIR=/sys/fs/cgroup/systemd #[ -x "$SYSTEMCTL" ] || return
[ -x "$SYSTEMCTL" ] || return [ -d /run/systemd/system ] || return
[ -d "$SYSTEMD_CGROUP_DIR" ] || return #SYSTEMD_CGROUP_DIR=/sys/fs/cgroup/systemd
a='' mountpoint -q "$SYSTEMD_CGROUP_DIR" || return #[ -d "$SYSTEMD_CGROUP_DIR" ] || return
readlink /sbin/init | grep -q 'systemd' || return #cat /proc/1/comm | grep -q 'systemd' && return
# some hack
# shellcheck disable=SC2009
ps ax | grep '[s]ystemd' | grep -q -v 'systemd-udev'
} }
assure_distr() assure_distr()
...@@ -742,6 +740,9 @@ __serv_log_altlinux() ...@@ -742,6 +740,9 @@ __serv_log_altlinux()
postfix) postfix)
sudocmd tail -f /var/log/mail/all /var/log/mail/errors sudocmd tail -f /var/log/mail/all /var/log/mail/errors
;; ;;
sshd)
sudocmd tail -f /var/log/auth/all
;;
cups) cups)
sudocmd tail -f /var/log/cups/access_log /var/log/cups/error_log sudocmd tail -f /var/log/cups/access_log /var/log/cups/error_log
;; ;;
...@@ -1168,15 +1169,19 @@ fi ...@@ -1168,15 +1169,19 @@ fi
# ALT Linux based # ALT Linux based
if distro altlinux-release ; then if distro altlinux-release ; then
# TODO: use os-release firsly
DISTRIB_ID="ALTLinux" DISTRIB_ID="ALTLinux"
if has Sisyphus ; then DISTRIB_RELEASE="Sisyphus" if has Sisyphus ; then DISTRIB_RELEASE="Sisyphus"
elif has "ALT Linux 7." ; then DISTRIB_RELEASE="p7" elif has "ALT Linux 7." ; then DISTRIB_RELEASE="p7"
elif has "ALT Linux t7." ; then DISTRIB_RELEASE="t7" elif has "ALT Linux t7." ; then DISTRIB_RELEASE="t7"
elif has "ALT Linux 8." ; then DISTRIB_RELEASE="p8" elif has "ALT Linux 8." ; then DISTRIB_RELEASE="p8"
elif has "ALT .*8.[0-9]" ; then DISTRIB_RELEASE="p8" elif has "ALT .*8.[0-9]" ; then DISTRIB_RELEASE="p8"
elif has "ALT .*9.[0-9]" ; then DISTRIB_RELEASE="p9"
elif has "ALT p9 p9" ; then DISTRIB_RELEASE="p9"
elif has "Simply Linux 6." ; then DISTRIB_RELEASE="p6" elif has "Simply Linux 6." ; then DISTRIB_RELEASE="p6"
elif has "Simply Linux 7." ; then DISTRIB_RELEASE="p7" elif has "Simply Linux 7." ; then DISTRIB_RELEASE="p7"
elif has "Simply Linux 8." ; then DISTRIB_RELEASE="p8" elif has "Simply Linux 8." ; then DISTRIB_RELEASE="p8"
elif has "Simply Linux 9." ; then DISTRIB_RELEASE="p9"
elif has "ALT Linux 6." ; then DISTRIB_RELEASE="p6" elif has "ALT Linux 6." ; then DISTRIB_RELEASE="p6"
elif has "ALT Linux p8" ; then DISTRIB_RELEASE="p8" elif has "ALT Linux p8" ; then DISTRIB_RELEASE="p8"
elif has "ALT Linux p7" ; then DISTRIB_RELEASE="p7" elif has "ALT Linux p7" ; then DISTRIB_RELEASE="p7"
...@@ -2238,11 +2243,20 @@ $(get_help HELPOPT) ...@@ -2238,11 +2243,20 @@ $(get_help HELPOPT)
" "
} }
detect_virt()
{
which systemd-detect-virt >/dev/null 2>/dev/null || return
a= systemd-detect-virt
}
print_version() print_version()
{ {
echo "Service manager version 2.5.8" local on_text="(host system)"
echo "Running on $($DISTRVENDOR) with $SERVICETYPE" local virt="$(detect_virt)"
echo "Copyright (c) Etersoft 2012-2018" [ "$virt" = "none" ] || [ "$virt" = "" ] || on_text="(under $virt)"
echo "Service manager version 3.1.0"
echo "Running on $($DISTRVENDOR) $on_text with $SERVICETYPE"
echo "Copyright (c) Etersoft 2012-2019"
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