3
# Copyright (C) 2012, 2014, 2016, 2019, 2021 Etersoft
4
# Copyright (C) 2012, 2014, 2016, 2019, 2021 Vitaly Lipatov <lav@etersoft.ru>
6
# This program is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU Affero General Public License as published by
8
# the Free Software Foundation, either version 3 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU Affero General Public License for more details.
16
# You should have received a copy of the GNU Affero General Public License
17
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
load_helper epm-check_updated_repo
21
load_helper epm-sh-warmup
27
# it is useful for first time running
32
if [ "$BASEDISTRNAME" = "alt" ] ; then
33
load_helper epm-sh-altlinux
34
if tasknumber "$@" >/dev/null ; then
35
load_helper epm-addrepo
36
load_helper epm-reposave
37
load_helper epm-removerepo
38
load_helper epm-Install
40
local installlist="$(get_task_packages $*)"
41
# hack: drop -devel packages to avoid package provided by multiple packages
42
installlist="$(estrlist reg_exclude ".*-devel .*-devel-static" "$installlist")"
43
[ -n "$verbose" ] && info "Packages from task(s): $installlist"
44
# install only installed packages (simulate upgrade packages)
45
installlist="$(get_only_installed_packages "$installlist")"
46
[ -n "$verbose" ] && info "Packages to upgrade: $installlist"
47
if [ -z "$installlist" ] ; then
48
warning "There is no installed packages for upgrade from task $*"
55
(pkg_names="$installlist" epm_install) || fatal "Can't update repo"
63
# Solus supports upgrade for a package (with all dependencies)
64
if [ -n "$1" ] && [ "$DISTRNAME" = "Solus" ] ; then
65
sudocmd eopkg upgrade "$@"
69
# if possible, it will put pkg_urls into pkg_files and reconstruct pkg_filenames
70
if [ -n "$pkg_urls" ] ; then
71
info "Downloading packages assigned to upgrade ..."
72
load_helper epm-download
73
__handle_pkg_urls_to_install
76
info "Running command for upgrade packages"
81
# upgrade only install files from the list
82
if [ -n "$pkg_files" ] ; then
83
load_helper epm-install
84
#sudocmd rpm -Fvh $pkg_files
85
(pkg_files=$pkg_files force="$force -F" epm_install)
87
elif [ -n "$pkg_names" ] ; then
88
# hack for https://bugzilla.altlinux.org/41225
91
fatal "Option $pkg_names is not allowed here"
93
load_helper epm-install
94
(pkg_names=$(get_only_installed_packages $pkg_names) epm_install)
102
local APTOPTIONS="$dryrun $(subst_option non_interactive -y) $(subst_option verbose "-V -o Debug::pkgMarkInstall=1 -o Debug::pkgProblemResolver=1")"
103
CMD="apt-get $APTOPTIONS $noremove $force_yes dist-upgrade"
106
CMD="aptitude dist-upgrade"
113
local OPTIONS="$(subst_option non_interactive -y)"
114
# can do update repobase automagically
115
CMD="yum $OPTIONS update $*"
118
local OPTIONS="$(subst_option non_interactive -y)"
119
CMD="dnf $OPTIONS distro-sync $*"
125
# or --auto-select --replace-files
126
CMD="urpmi --update --auto-select $*"
129
CMD="zypper $(subst_option non_interactive --non-interactive) dist-upgrade"
132
CMD="pacman -S -u $force"
138
CMD="emerge -NuDa world"
141
CMD="conary updateall"
144
CMD="freebsd-update fetch install"
153
CMD="choco update all"
157
sudocmd brew upgrade $(brew outdated)
167
CMD="/usr/sbin/slackpkg upgrade-all"
170
CMD="guix package -u"
173
CMD="$PMTYPE update-all"
176
if [ -z "$1" ] ; then
177
sudocmd winget upgrade --all
183
# shellcheck disable=SC2046
184
docmd_foreach "epm install" $(short=1 epm packages)
188
CMD="xbps-install -Su"
191
CMD="nix-env -u $dryrun"
197
fatal "Have no suitable command for $PMTYPE"