Commit 6dafd74d authored by Vitaly Lipatov's avatar Vitaly Lipatov

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

parents 41d45e06 dc885073
......@@ -116,15 +116,19 @@ fi
# ALT Linux based
if distro altlinux-release ; then
# TODO: use os-release firsly
DISTRIB_ID="ALTLinux"
if has Sisyphus ; then DISTRIB_RELEASE="Sisyphus"
elif has "ALT Linux 7." ; then DISTRIB_RELEASE="p7"
elif has "ALT Linux t7." ; then DISTRIB_RELEASE="t7"
elif has "ALT Linux 8." ; 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 7." ; then DISTRIB_RELEASE="p7"
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 p8" ; then DISTRIB_RELEASE="p8"
elif has "ALT Linux p7" ; then DISTRIB_RELEASE="p7"
......
......@@ -232,7 +232,7 @@ check_command()
assure) # HELPCMD: <command> [package]: install package if command does not exist
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
;;
......@@ -252,7 +252,10 @@ check_command()
removerepo|rr) # HELPCMD: remove package repo
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
;;
kernel-update|kernel-upgrade|update-kernel|upgrade-kernel) # HELPCMD: update system kernel to the last repo version
......
#!/bin/sh
#
# Copyright (C) 2013 Etersoft
# Copyright (C) 2013 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2013, 2019 Etersoft
# Copyright (C) 2013, 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
......@@ -28,16 +28,9 @@ epm_Install()
[ -z "$files$names" ] && info "Install: Skip empty install list." && return 22
# do update only if really need install something
case $PMTYPE in
yum-rpm)
;;
*)
pkg_filenames='' epm_update || return
;;
esac
(pkg_filenames='' epm_update) || return
epm_install_names $names || return
epm_install_files $files
epm_install_files $files
}
#!/bin/sh
#
# Copyright (C) 2013 Etersoft
# Copyright (C) 2013 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2013, 2019 Etersoft
# Copyright (C) 2013, 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
......@@ -22,13 +22,7 @@ load_helper epm-upgrade
epm_Upgrade()
{
case $PMTYPE in
yum-rpm)
;;
*)
pkg_filenames='' epm_update || return
;;
esac
(pkg_filenames='' epm_update)
epm_upgrade
}
#!/bin/sh
#
# Copyright (C) 2012, 2017 Etersoft
# Copyright (C) 2012, 2017 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2017, 2019 Etersoft
# Copyright (C) 2012, 2017, 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
......@@ -19,6 +19,27 @@
load_helper epm-sh-altlinux
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()
{
local repo="$@"
......@@ -38,11 +59,11 @@ __epm_addrepo_altlinux()
# TODO: use apt-repo add ?
echo "" | 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
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
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"
return 0
;;
......@@ -51,6 +72,7 @@ __epm_addrepo_altlinux()
repo="$repo.$(echo "$DISTRVERSION" | tr "[:upper:]" "[:lower:]")"
;;
archive)
[ -n "$DISTRVERSION" ] || fatal "Empty DISTRVERSION"
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"
# TODO: func?
......@@ -60,11 +82,11 @@ __epm_addrepo_altlinux()
local distrversion="$(echo "$DISTRVERSION" | tr "[:upper:]" "[:lower:]")"
local rpmsign='[alt]'
[ "$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
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
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
;;
esac
......@@ -79,11 +101,13 @@ __epm_addrepo_altlinux()
if [ -z "$repo" ] ; then
info "Add branch repo. Use follow params:"
sudocmd apt-repo add branch
echo "etersoft (for LINUX@Etersoft repo)"
echo "archive 2018/02/09 (for archive from that date)"
echo "etersoft - for LINUX@Etersoft repo"
echo "archive 2018/02/09 - for archive from that date"
return
fi
# TODO: add other mirror (mirror.yandex.ru)
# TODO: apt-repo supports archive
sudocmd apt-repo add "$repo"
}
......@@ -113,8 +137,13 @@ case $PMTYPE in
;;
yum-rpm)
assure_exists yum-utils
__epm_addrepo_rhel "$repo" || return
sudocmd yum-config-manager --add-repo "$repo"
;;
dnf-rpm)
__epm_addrepo_rhel "$repo" || return
sudocmd dnf config-manager --add-repo "$repo"
;;
urpm-rpm)
sudocmd urpmi.addmedia "$repo"
;;
......
......@@ -197,6 +197,9 @@ case $PMTYPE in
fi
sudocmd aura -Oj
;;
packagekit-*)
docmd pkcon repair --autoremove
;;
yum-rpm)
# cleanup orphanes?
while true ; do
......
......@@ -37,6 +37,9 @@ case $PMTYPE in
sudocmd apt-get -f install || return
#sudocmd apt-get autoremove
;;
packagekit-*)
docmd pkcon repair
;;
aptitude-dpkg)
sudocmd aptitude -f install || return
#sudocmd apt-get autoremove
......
......@@ -62,7 +62,7 @@ update_repo_if_needed()
if ! __is_repo_info_downloaded || ! __is_repo_info_uptodate ; then
load_helper epm-update
# FIXME: cleans!!!
$(pkg_filenames='' epm_update)
(pkg_filenames='' epm_update)
fi
cd - >/dev/null || fatal
......
......@@ -49,9 +49,8 @@ try_fix_apt_rpm_dupls()
epm_dedup()
{
case $PMTYPE in
apt-rpm)
# ALT Linux only
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"
......
......@@ -184,8 +184,8 @@ epm_download()
{
local CMD
case $DISTRNAME in
ALTLinux)
case $DISTRNAME-$PMTYPE in
ALTLinux-apt-rpm)
__epm_download_alt $pkg_filenames
return
;;
......@@ -198,6 +198,10 @@ epm_download()
aptcyg)
sudocmd apt-cyg download $pkg_filenames
;;
packagekit-*)
# TODO: force
docmd pkcon download $pkg_filenames
;;
yum-rpm)
# TODO: check yum install --downloadonly --downloaddir=/tmp <package-name>
assure_exists yumdownloader yum-utils
......
......@@ -67,6 +67,9 @@ __epm_filelist_remote()
fi
docmd_foreach __deb_local_content_filelist "$@"
;;
packagekit-*)
docmd pkcon get-files "$@"
;;
yum-rpm)
assure_exists yum-utils || return
docmd repoquery -q -l "$@"
......@@ -120,6 +123,9 @@ __epm_filelist_name()
*-dpkg)
CMD="dpkg -L"
;;
packagekit-*)
CMD="pkcon get-files"
;;
android)
CMD="pm list packages -f"
;;
......
#!/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/>.
#
load_helper epm-update
load_helper epm-upgrade
load_helper epm-kernel_update
epm_full_upgrade()
{
(pkg_filenames='' epm_update) || return
epm_upgrade || return
epm_kernel_update || return
}
#!/bin/sh
#
# Copyright (C) 2012, 2014, 2016 Etersoft
# Copyright (C) 2012, 2014, 2016 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2014, 2016, 2019 Etersoft
# Copyright (C) 2012, 2014, 2016, 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
......@@ -48,10 +48,6 @@ __epm_info_by_pkgtype()
__epm_info_by_pmtype()
{
case $PMTYPE in
apt-rpm)
__epm_info_rpm_low && return
docmd apt-cache show $pkg_names
;;
apt-dpkg)
if [ -n "$pkg_files" ] ; then
docmd dpkg -I $pkg_files
......@@ -67,21 +63,35 @@ case $PMTYPE in
[ -z "$pkg_names" ] && return
docmd aptitude show $pkg_names
;;
yum-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
docmd dnf info $pkg_names
;;
zypper-rpm)
*-rpm)
__epm_info_rpm_low && return
docmd zypper 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
;;
packagekit-*)
# TODO: get-details-local
docmd pkcon get-details $pkg_names
;;
pacman)
is_installed $pkg_names && docmd pacman -Qi $pkg_names && return
......
#!/bin/sh
#
# Copyright (C) 2012-2018 Etersoft
# Copyright (C) 2012-2018 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2019 Etersoft
# Copyright (C) 2012-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
......@@ -129,6 +129,9 @@ epm_install_names()
urpm-rpm)
sudocmd urpmi $URPMOPTIONS $@
return ;;
packagekit-*)
docmd pkcon install $@
return ;;
pkgsrc)
sudocmd pkg_add -r $@
return ;;
......@@ -230,6 +233,9 @@ epm_ni_install_names()
# FIXME: returns true ever no package found, need check for "no found", "Nothing to do."
yes | sudocmd zypper --non-interactive $ZYPPEROPTIONS install $@
return ;;
packagekit-*)
docmd pkcon install --noninteractive $@
return ;;
pkgsrc)
sudocmd pkg_add -r $@
return ;;
......@@ -315,9 +321,9 @@ epm_install_files()
# TODO: check read permissions
# sudo test -r FILE
# 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
__epm_check_if_try_install_deb $@ && return
......@@ -334,7 +340,9 @@ epm_install_files()
# use install_names
;;
esac
case $PMTYPE in
apt-dpkg|aptitude-dpkg)
# the new version of the conf. file is installed with a .dpkg-dist suffix
if [ -n "$non_interactive" ] ; then
......@@ -358,20 +366,7 @@ epm_install_files()
return
;;
yum-rpm|dnf-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)
*-rpm)
__epm_check_if_try_install_deb $@ && return
sudocmd rpm -Uvh $force $nodeps $@ && return
local RES=$?
......@@ -379,25 +374,29 @@ epm_install_files()
__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
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
URPMOPTIONS=--no-verify-rpm
# use install_names
case $PMTYPE in
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)
sudocmd pkg_add $@
return ;;
......@@ -443,10 +442,10 @@ epm_print_install_command()
#[ -z "$1" ] && return
[ -z "$1" ] && [ -n "$pkg_names" ] && return
case $PMTYPE in
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm)
*-rpm)
echo "rpm -Uvh --force $nodeps $*"
;;
apt-dpkg|aptitude-dpkg)
*-dpkg)
echo "dpkg -i $*"
;;
pkgsrc)
......@@ -518,6 +517,9 @@ epm_print_install_names_command()
zypper-rpm)
echo "zypper --non-interactive $ZYPPEROPTIONS install $*"
return ;;
packagekit-*)
echo "pkcon --noninteractive $*"
return ;;
pacman)
echo "pacman -S --noconfirm $force $*"
return ;;
......@@ -539,7 +541,10 @@ epm_install()
if tasknumber "$pkg_names" >/dev/null ; then
assure_distr ALTLinux "install with task number"
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
fi
......
......@@ -35,8 +35,8 @@ epm_kernel_update()
fi
assure_exists update-kernel update-kernel 0.9.9
update_repo_if_needed
sudocmd update-kernel $pkg_filenames || return
docmd epm remove-old-kernels $pkg_filenames || fatal
sudocmd update-kernel $(subst_option non_interactive -y) $pkg_filenames || return
docmd epm remove-old-kernels $(subst_option non_interactive -y) $pkg_filenames || fatal
return ;;
esac
......
......@@ -23,12 +23,12 @@ __epm_packages_sort()
{
# FIXME: sort depends on --sort value
case $PMTYPE in
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm)
*-rpm)
# FIXME: space with quotes problems, use point instead
warmup_rpmbase
docmd rpm -qa --queryformat "%{size}@%{name}-%{version}-%{release}\n" $pkg_filenames | sed -e "s|@| |g" | sort -n -k1
;;
apt-dpkg)
*-dpkg)
warmup_dpkgbase
docmd dpkg-query -W --showformat="\${Installed-Size}@\${Package}-\${Version}:\${Architecture}\n" $pkg_filenames | sed -e "s|@| |g" | sort -n -k1
;;
......@@ -57,13 +57,6 @@ epm_packages()
[ -n "$sort" ] && __epm_packages_sort && return
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)
warmup_dpkgbase
# FIXME: strong equal
......@@ -74,16 +67,19 @@ case $PMTYPE in
showcmd $CMD
$CMD | grep "^i" | sed -e "s|.* ||g" | __fo_pfn
return ;;
snappy)
CMD="snappy info"
;;
yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm)
*-rpm)
warmup_rpmbase
# FIXME: strong equal
CMD="rpm -qa $pkg_filenames"
[ -n "$short" ] && CMD="rpm -qa --queryformat %{name}\n $pkg_filenames"
docmd $CMD
return ;;
packagekit-*)
docmd pkcon get-packages --filter installed
;;
snappy)
CMD="snappy info"
;;
emerge)
CMD="qlist -I -C"
# print with colors for console output
......
#!/bin/sh
#
# Copyright (C) 2015, 2017 Etersoft
# Copyright (C) 2015, 2017 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2015, 2017, 2019 Etersoft
# Copyright (C) 2015, 2017, 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
......@@ -31,11 +31,11 @@ warmup_bases
pkg_names=$(__epm_get_hilevel_name $pkg_names)
case $PMTYPE in
apt-rpm)
apt-*)
docmd apt-cache policy $pkg_names
;;
apt-dpkg)
docmd apt-cache policy $pkg_names
packagekit-*)
docmd pkcon resolve $pkg_names
;;
*)
fatal "Have no suitable command for $PMTYPE"
......
......@@ -88,12 +88,12 @@ _shortquery_via_packages_list()
# Note: double call due stderr redirect
# Note: we use short=1 here due grep by ^name$
# 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
for pkg in "$@" ; do
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
# TODO: print in query (for user): 'warning: package $pkg is not installed'
......@@ -116,12 +116,12 @@ _query_via_packages_list()
# Note: double call due stderr redirect
# Note: we use short=1 here due grep by ^name$
# 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
for pkg in "$@" ; do
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
return $res
......
......@@ -78,17 +78,11 @@ __do_query()
{
local CMD
case $PMTYPE in
apt-rpm)
CMD="rpm -qf"
;;
*-dpkg)
showcmd dpkg -S "$1"
dpkg_print_name_version "$(dpkg -S $1 | grep -v "^diversion by" | sed -e "s|:.*||")"
return ;;
yum-rpm|dnf-rpm|urpm-rpm)
CMD="rpm -qf"
;;
zypper-rpm)
*-rpm)
CMD="rpm -qf"
;;
emerge)
......
......@@ -33,6 +33,10 @@ epm_reinstall_names()
aptitude-dpkg)
sudocmd aptitude reinstall $@
return ;;
packagekit-*)
warning "Please send me the correct command form for it"
docmd pkcon install --allow-reinstall $@
return ;;
yum-rpm)
sudocmd yum reinstall $@
return ;;
......
......@@ -85,7 +85,7 @@ __alt_repofix()
local TO="$1"
load_helper epm-repofix
showcmd epm repofix
quiet=1 pkg_filenames='' epm_repofix >/dev/null
(quiet=1 pkg_filenames='' epm_repofix >/dev/null)
# replace sign name
if [ -n "$TO" ] ; then
__replace_text_in_alt_repo "/^ *#/! s!\[alt\]![$TO]!g"
......@@ -97,7 +97,7 @@ __alt_repofix()
__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()
......@@ -132,6 +132,9 @@ get_fix_release_pkg()
# workaround against obsoleted altlinux-release-sisyphus package from 2008 year
[ "$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
echo "$TOINSTALL"
......@@ -323,6 +326,9 @@ epm_release_upgrade()
assure_exists do-release-upgrade update-manager-core
sudocmd do-release-upgrade
;;
packagekit-*)
docmd pkcon upgrade-system $pkg_filenames
;;
yum-rpm)
docmd epm install rpm yum
sudocmd yum clean all
......
#!/bin/sh
#
# Copyright (C) 2012-2014, 2016, 2017 Etersoft
# Copyright (C) 2012-2014, 2016, 2017 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2014, 2016, 2017, 2019 Etersoft
# Copyright (C) 2012-2014, 2016, 2017, 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
......@@ -30,10 +30,10 @@ epm_remove_low()
warmup_lowbase
case $PMTYPE in
apt-rpm|yum-rpm|zypper-rpm|urpm-rpm|dnf-rpm)
*-rpm)
sudocmd rpm -ev $nodeps $@
return ;;
apt-dpkg|aptitude-dpkg)
*-dpkg|-dpkg)
# shellcheck disable=SC2046
sudocmd dpkg -P $(subst_option nodeps --force-all) $(print_name "$@")
return ;;
......@@ -72,6 +72,9 @@ epm_remove_names()
apt-rpm)
sudocmd apt-get remove $APTOPTIONS $@
return ;;
packagekit-*)
docmd pkcon remove $@
return ;;
deepsolver-rpm)
sudocmd ds-remove $@
return ;;
......@@ -164,6 +167,9 @@ epm_remove_nonint()
apt-rpm)
sudocmd apt-get -y --force-yes remove $@
return ;;
packagekit-*)
docmd pkcon remove --noninteractive $@
return ;;
urpm-rpm)
sudocmd urpme --auto $@
return ;;
......@@ -198,12 +204,15 @@ epm_remove_nonint()
epm_print_remove_command()
{
case $PMTYPE in
apt-rpm|yum-rpm|zypper-rpm|urpm-rpm|dnf-rpm)
*-rpm)
echo "rpm -ev $nodeps $*"
;;
apt-dpkg|aptitude-dpkg)
*-dpkg)
echo "dpkg -P $*"
;;
packagekit-*)
echo "pkcon remove --noninteractive $*"
;;
pkgsrc)
echo "pkg_delete -r $*"
;;
......
......@@ -32,7 +32,7 @@ epm_remove_old_kernels()
return
fi
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 ;;
Ubuntu)
load_helper epm-query_package
......
......@@ -55,7 +55,7 @@ case $DISTRNAME in
;;
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
sudocmd apt-repo rm "$repo"
return
......
#!/bin/sh
#
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016, 2019 Etersoft
# Copyright (C) 2012, 2016, 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
......@@ -54,6 +54,9 @@ case $PMTYPE in
zypper-rpm)
docmd zypper sl -d
;;
packagekit-*)
docmd pkcon repo-list
;;
emerge)
docmd eselect profile list
docmd layman -L
......
#!/bin/sh
#
# Copyright (C) 2012-2013, 2016, 2018 Etersoft
# Copyright (C) 2012-2013, 2016, 2018 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2013, 2016, 2018, 2019 Etersoft
# Copyright (C) 2012-2013, 2016, 2018, 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
......@@ -61,7 +61,9 @@ case $PMTYPE in
#return
CMD="apt-cache depends"
fi
;;
packagekit-*)
CMD="pkcon required-by"
;;
#zypper-rpm)
# # FIXME: use hi level commands
......
#!/bin/sh
#
# Copyright (C) 2012, 2013, 2016-2018 Etersoft
# Copyright (C) 2012, 2013, 2016-2018 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2013, 2016-2019 Etersoft
# Copyright (C) 2012, 2013, 2016-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
......@@ -34,6 +34,9 @@ case $PMTYPE in
deepsolver-rpm)
CMD="ds-require --"
;;
packagekit-*)
CMD="pkcon search name"
;;
urpm-rpm)
# urpmq does not support --
CMD="urpmq -y"
......
#!/bin/sh
#
# Copyright (C) 2012, 2016, 2017 Etersoft
# Copyright (C) 2012, 2016, 2017 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016, 2017, 2019 Etersoft
# Copyright (C) 2012, 2016, 2017, 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
......@@ -61,6 +61,9 @@ case $PMTYPE in
sudocmd apt-file update
docmd apt-file search $pkg_filenames
return ;;
packagekit-*)
CMD="pkcon search file"
;;
yum-rpm)
# TODO
info "Search by full packages list is not implemented yet"
......
......@@ -118,7 +118,7 @@ get_local_alt_contents_index()
tasknumber()
{
local num="$(echo "$*" | sed -e "s| *#*||g")"
isnumber "$num" && echo "$num"
local num="$(echo "$1" | sed -e "s| *#*||g")"
isnumber "$num" && echo "$*"
}
......@@ -475,12 +475,16 @@ if [ -n "$FORCEPM" ] ; then
return
fi
# TODO: in more appropriate way
#which pkcon 2>/dev/null >/dev/null && info "You can run $ PMTYPE=packagekit epm to use packagekit backend"
# TODO: move it in distr_vendor?
# FIXME: some problems with multibased distros (Server Edition on CentOS and Desktop Edition on Ubuntu)
case $DISTRNAME in
ALTLinux)
CMD="apt-rpm"
#which ds-install 2>/dev/null >/dev/null && CMD=deepsolver-rpm
#which pkcon 2>/dev/null >/dev/null && CMD=packagekit-rpm
;;
PCLinux)
CMD="apt-rpm"
......@@ -550,18 +554,16 @@ esac
PMTYPE=$CMD
}
# https://unix.stackexchange.com/questions/196166/how-to-find-out-if-a-system-uses-sysv-upstart-or-systemd-initsystem
is_active_systemd()
{
local a
SYSTEMCTL=/bin/systemctl
SYSTEMD_CGROUP_DIR=/sys/fs/cgroup/systemd
[ -x "$SYSTEMCTL" ] || return
[ -d "$SYSTEMD_CGROUP_DIR" ] || return
#a='' mountpoint -q "$SYSTEMD_CGROUP_DIR" || return
cat /proc/1/cmdline | grep -q 'systemd' && return
cat /proc/1/cmdline | grep -q '/sbin/init' || return
readlink /sbin/init | grep -q 'systemd' || return
#[ -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()
......
......@@ -127,7 +127,7 @@ EOF
# use verbose for get package status
#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" __epm_search_internal | grep -q "^$pkg-[0-9]" && continue
(pkg_filenames="$pkg" __epm_search_internal) | grep -q "^$pkg-[0-9]" && continue
res=1
info "Package '$pkg' does not found in repository."
done
......
......@@ -38,6 +38,9 @@ case $PMTYPE in
#sudocmd apt-get -f install || exit
#sudocmd apt-get autoremove
;;
packagekit-*)
docmd pkcon refresh
;;
#snappy)
# sudocmd snappy
# ;;
......@@ -45,14 +48,12 @@ case $PMTYPE in
sudocmd aptitude update || return
;;
yum-rpm)
info "update command is stubbed for yum"
# yum makecache
#sudocmd yum check-update
# just skipped
[ -n "$verbose" ] && info "update command is stubbed for yum"
;;
dnf-rpm)
info "update command is stubbed for dnf"
# dnf makecache
#sudocmd dnf check-update
# just skipped
[ -n "$verbose" ] && info "update command is stubbed for dnf"
;;
urpm-rpm)
sudocmd urpmi.update -a
......
#!/bin/sh
#
# Copyright (C) 2012, 2014, 2016 Etersoft
# Copyright (C) 2012, 2014, 2016 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2014, 2016, 2019 Etersoft
# Copyright (C) 2012, 2014, 2016, 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
......@@ -41,6 +41,10 @@ epm_upgrade()
aptitude-dpkg)
CMD="aptitude dist-upgrade"
;;
packagekit-*)
docmd pkcon update
return
;;
yum-rpm)
local OPTIONS="$(subst_option non_interactive -y)"
# can do update repobase automagically
......
......@@ -44,6 +44,9 @@ case $PMTYPE in
aptitude-dpkg)
CMD="aptitude why"
;;
packagekit-*)
CMD="pkcon depends-on"
;;
yum-rpm)
CMD="repoquery --whatrequires"
;;
......
......@@ -127,11 +127,20 @@ $(get_help HELPOPT)
"
}
detect_virt()
{
which systemd-detect-virt >/dev/null 2>/dev/null || return
a= systemd-detect-virt
}
print_version()
{
local on_text="(host system)"
local virt="$(detect_virt)"
[ "$virt" = "none" ] || [ "$virt" = "" ] || on_text="(under $virt)"
echo "Service manager version @VERSION@"
echo "Running on $($DISTRVENDOR) with $SERVICETYPE"
echo "Copyright (c) Etersoft 2012-2018"
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."
}
......
# This spec is backported to ALTLinux p8 automatically by rpmbph script from etersoft-build-utils.
#
Name: eepm
Version: 2.6.0
Version: 3.1.0
Release: alt0.M80P.1
Summary: Etersoft EPM package manager
......@@ -90,9 +90,27 @@ rm -f %buildroot%_datadir/%name/tools_eget
%_sysconfdir/bash_completion.d/cerv
%changelog
* Tue Oct 01 2019 Vitaly Lipatov <lav@altlinux.ru> 2.6.0-alt0.M80P.1
* Fri Nov 08 2019 Vitaly Lipatov <lav@altlinux.ru> 3.1.0-alt0.M80P.1
- backport to ALTLinux p8 (by rpmbph script)
* Fri Nov 08 2019 Vitaly Lipatov <lav@altlinux.ru> 3.1.0-alt1
- add epm full-upgrade
- kernel update/remove: add --auto support (non interactive)
- is_active_systemd: rewrite systemd detection
- serv: add print out virtualization type (via systemd helper)
* Tue Nov 05 2019 Vitaly Lipatov <lav@altlinux.ru> 3.0.0-alt1
- distr_info: p9 support
- addrepo: add check for empty DISTRVERSION
- epm install: add support for several task numbers
- fix tasknumber checking
- addrepo: add support for dnf, add support for epel repo add
- release_upgrade: install etersoft-gpgkeys firstly if used one
- epm: add alias for policy (resolve) and release-upgrade (upgrade-system)
- add initial packagekit (pkcon) support
- more clean and strict rules
- workaround against ALT bug 37272
* Sat Sep 28 2019 Vitaly Lipatov <lav@altlinux.ru> 2.6.0-alt1
- add repack.d/XenDesktopVDA.sh (ALT bug 37167)
- fix systemd detection
......
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