epm-removerepo 1.89 KB
Newer Older
1 2
#!/bin/sh
#
3 4
# Copyright (C) 2012, 2017  Etersoft
# Copyright (C) 2012, 2017  Vitaly Lipatov <lav@etersoft.ru>
5
#
6 7 8
# 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
9 10 11 12 13
# (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
14
# GNU Affero General Public License for more details.
15
#
16 17
# 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/>.
18 19
#

20 21
load_helper epm-sh-altlinux

22 23
epm_removerepo()
{
24
local repo="$(eval echo $quoted_args)"
25 26 27 28 29 30 31

case $DISTRNAME in
	ALTLinux)
		case "$repo" in
			autoimports)
				info "remove autoimports repo"
				[ -n "$DISTRVERSION" ] || fatal "Empty DISTRVERSION"
Vitaly Lipatov's avatar
Vitaly Lipatov committed
32
				repo="$repo.$(echo "$DISTRVERSION" | tr "[:upper:]" "[:lower:]")"
33 34 35
				;;
		esac

36 37
		if tasknumber "$repo" >/dev/null ; then
			repo="$(epm repolist | grep "repo/$(tasknumber $repo)" | line)"
38
		fi
39
		[ -n "$repo" ] || fatal "No such repo or task"
40
		assure_exists apt-repo
41
		sudocmd apt-repo rm "$repo"
42
		return
43
		;;
44 45 46
esac;

case $PMTYPE in
Vitaly Lipatov's avatar
Vitaly Lipatov committed
47
	apt-dpkg|aptitude-dpkg)
48
		info "You need remove repo from /etc/apt/sources.list"
49 50
		;;
	yum-rpm)
51
		assure_exists yum-utils
52
		sudocmd yum-config-manager --disable "$repo"
53 54
		;;
	urpm-rpm)
55
		sudocmd urpmi.removemedia "$repo"
56
		;;
57
	zypper-rpm)
58
		sudocmd zypper removerepo "$repo"
59 60
		;;
	emerge)
61
		sudocmd layman "-d$repo"
62 63
		;;
	pacman)
64
		info "You need remove repo from /etc/pacman.conf"
65
		;;
66
	npackd)
67
		sudocmd npackdcl remove-repo --url="$repo"
68
		;;
69
	slackpkg)
70
		info "You need remove repo from /etc/slackpkg/mirrors"
71 72
		;;
	*)
73
		fatal "Have no suitable command for $PMTYPE"
74 75 76 77
		;;
esac

}