#!/bin/sh # # Copyright (C) 2012, 2017, 2020 Etersoft # Copyright (C) 2012, 2017, 2020 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-sh-altlinux # remove grepped lines __epm_removerepo_alt_grepremove() { local rp epm repolist | grep -E "$1" | while read rp ; do sudocmd apt-repo $dryrun rm "$rp" done } __epm_removerepo_alt() { local repo="$*" [ -n "$repo" ] || fatal "No such repo or task. Use epm repo remove <autoimports|archive|tasks|TASKNUMBER>" assure_exists apt-repo if tasknumber "$repo" >/dev/null ; then local tn for tn in $(tasknumber "$repo") ; do __epm_removerepo_alt_grepremove " repo/$tn/" done return fi case "$1" in autoimports) info "remove autoimports repo" [ -n "$DISTRVERSION" ] || fatal "Empty DISTRVERSION" repo="autoimports.$(echo "$DISTRVERSION" | tr "[:upper:]" "[:lower:]")" sudocmd apt-repo $dryrun rm "$repo" ;; archive) info "remove archive repos" __epm_removerepo_alt_grepremove "archive/" ;; tasks) info "remove task repos" __epm_removerepo_alt_grepremove " repo/[0-9]+/" ;; task) shift __epm_removerepo_alt_grepremove " repo/$1/" ;; *) sudocmd apt-repo $dryrun rm "$*" ;; esac } epm_removerepo() { case $DISTRNAME in ALTLinux) __epm_removerepo_alt "$@" return ;; esac; case $PMTYPE in apt-dpkg) assure_exists apt-add-repository software-properties-common sudocmd apt-add-repository --remove "$@" info "Check file /etc/apt/sources.list if needed" ;; aptitude-dpkg) info "You need remove repo from /etc/apt/sources.list" ;; yum-rpm) assure_exists yum-utils sudocmd yum-config-manager --disable "$@" ;; urpm-rpm) sudocmd urpmi.removemedia "$@" ;; zypper-rpm) sudocmd zypper removerepo "$@" ;; emerge) sudocmd layman "-d$@" ;; pacman) info "You need remove repo from /etc/pacman.conf" ;; npackd) sudocmd npackdcl remove-repo --url="$@" ;; winget) sudocmd winget source remove "$@" ;; slackpkg) info "You need remove repo from /etc/slackpkg/mirrors" ;; *) fatal "Have no suitable command for $PMTYPE" ;; esac }