3
# Copyright (C) 2012, 2014, 2016-2017, 2023 Etersoft
4
# Copyright (C) 2012, 2014, 2016-2017, 2023 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
# copied from korinf/tools/run-script/scripts/update
22
load_helper epm-sh-warmup
23
load_helper epm-check_updated_repo
25
# TODO: restore mirroring
28
URL="https://eepm.ru/app-versions"
29
#update_url_if_need_mirrored
31
var="$(epm tool eget -q -O- "$URL/$1")" || return
32
echo "$var" | head -n1 | cut -d" " -f1
35
__check_for_epm_version()
37
# skip update checking for eepm from repo (ALT bug #44314)
38
[ "$BASEDISTRNAME" = "alt" ] && [ "$DISTRVERSION" != "Sisyphus" ] && epm status --original eepm && return
40
local latest="$(get_latest_version eepm)"
41
#[ -z "$latest" ] && return
42
local res="$(epm print compare "$EPMVERSION" "$latest")"
43
[ "$res" = "-1" ] && info "Latest EPM version in Korinf repository is $latest. You have version $EPMVERSION running." && info "You can update eepm with \$ epm ei command."
46
__save_available_packages()
48
[ -d "$epm_vardir" ] || return 0
50
# TODO: ignore in docker
51
# update list only if the system supports bash completion
52
[ -d /etc/bash_completion.d ] || return 0
54
info "Retrieving list of all available packages (for autocompletion) ..."
55
load_helper epm-list_available
56
short=--short epm_list_available | sort | sudorun tee $epm_vardir/available-packages >/dev/null
59
__epm_update_content_index()
63
load_helper epm-sh-altlinux-contents-index
64
update_alt_contents_index
71
is_command apt-file || return 0
72
assure_exists apt-file || return 0
73
sudocmd apt-file update
82
[ -z "$*" ] || fatal "No arguments are allowed here"
84
info "Running update the package index files from remote package repository database ..."
91
# TODO: hack against cd to cwd in apt-get on ALT
93
sudocmd apt-get update
103
# TODO: hack against cd to cwd in apt-get on ALT
105
sudocmd apt-get update
111
sudocmd apt-get update || return
112
# apt-get update retrieve Contents file too
113
#sudocmd apt-file update
122
sudocmd aptitude update || return
126
[ -z "$verbose" ] || info "update command is stubbed for yum"
130
[ -z "$verbose" ] || info "update command is stubbed for dnf"
133
sudocmd urpmi.update -a
142
sudocmd zypper $(subst_option non_interactive --non-interactive) refresh
145
sudocmd emerge --sync
148
sudocmd /usr/sbin/slackpkg -batch=on update
154
sudocmd packdcl detect # get packages from MSI database
163
sudocmd eopkg update-repo
169
sudocmd nix-channel --update
172
# portsnap extract for the first time?
173
sudocmd portsnap fetch update
176
sudocmd apt-cyg update
179
sudocmd xbps-install -S
182
sudocmd winget source update
185
fatal "Have no suitable update command for $PMTYPE"
193
if [ "$1" = "--content-index" ] ; then
194
__epm_update_content_index
198
__epm_update "$@" || return
202
__save_available_packages
204
__epm_update_content_index