3
# Copyright (C) 2012, 2017, 2020, 2021 Etersoft
4
# Copyright (C) 2012, 2017, 2020, 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-sh-altlinux
23
__epm_removerepo_alt_grepremove()
26
# ^rpm means full string
27
if [ "$1" = "all" ] || rhas "$1" "^rpm" ; then
30
rl="$( epm --quiet repolist 2>/dev/null | grep -F "$1")"
31
[ -z "$rl" ] && warning "Can't find '$1' in the repos (see '# epm repolist' output)" && return 1
33
echo "$rl" | while read rp ; do
34
# TODO: print removed lines
35
if [ -n "$dryrun" ] ; then
36
docmd apt-repo $dryrun rm "$rp"
39
if [ -z "$quiet" ] ; then
40
sudocmd apt-repo $dryrun rm "$rp"
42
sudorun apt-repo $dryrun rm "$rp"
50
[ -n "$repo" ] || fatal "No such repo or task. Use epm repo remove <regexp|autoimports|archive|tasks|TASKNUMBER>"
52
assure_exists apt-repo
54
if tasknumber "$repo" >/dev/null ; then
56
for tn in $(tasknumber "$repo") ; do
57
__epm_removerepo_alt_grepremove " repo/$tn/"
62
local branch="$(echo "$DISTRVERSION" | tr "[:upper:]" "[:lower:]")"
66
info "remove autoimports repo"
67
[ -n "$DISTRVERSION" ] || fatal "Empty DISTRVERSION"
68
repo="autoimports.$branch"
69
sudocmd apt-repo $dryrun rm "$repo"
72
info "remove archive repos"
73
__epm_removerepo_alt_grepremove "archive/"
76
info "remove korinf repo"
77
__epm_removerepo_alt_grepremove "Korinf/"
80
info "remove task repos"
81
__epm_removerepo_alt_grepremove " repo/[0-9]+/"
85
__epm_removerepo_alt_grepremove " repo/$1/"
88
fatal "epm removerepo: no options are supported"
91
# TODO: if return empty for whole line, use grep
92
# sudocmd apt-repo $dryrun rm "$*"
93
__epm_removerepo_alt_grepremove "$*"
102
case $BASEDISTRNAME in
104
__epm_removerepo_alt "$@"
108
echo "Use workaround for AstraLinux"
109
[ -n "$*" ] || fatal "empty repo name"
110
# aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for AstraLinuxCE/orel
111
sudocmd sed -i -e "s|.*$*.*||" /etc/apt/sources.list
112
if [ -d /etc/apt/sources.list.d ] && ls /etc/apt/sources.list.d/*.list >/dev/null 2>/dev/null ; then
113
sudocmd sed -i -e "s|.*$*.*||" /etc/apt/sources.list.d/*.list
121
assure_exists apt-add-repository software-properties-common
122
# FIXME: it is possible there is troubles to pass the args
123
sudocmd apt-add-repository --remove "$*"
124
info "Check file /etc/apt/sources.list if needed"
127
info "You need remove repo from /etc/apt/sources.list"
130
assure_exists yum-utils
131
sudocmd yum-config-manager --disable "$@"
134
if [ "$1" = "all" ] ; then
135
sudocmd urpmi.removemedia -av
138
sudocmd urpmi.removemedia "$@"
141
sudocmd zypper removerepo "$@"
144
sudocmd layman "-d$1"
147
info "You need remove repo from /etc/pacman.conf"
150
sudocmd npackdcl remove-repo --url="$*"
153
sudocmd winget source remove "$@"
156
sudocmd eopkg remove-repo "$@"
159
info "You need remove repo from /etc/slackpkg/mirrors"
162
fatal "Have no suitable command for $PMTYPE"