epm-removerepo 2.33 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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
			archive)
				info "remove archive repos"
				assure_exists apt-repo
				epm repolist | grep "archive/" | while read repo ; do
					sudocmd apt-repo rm "$repo"
				done
				return 0
				;;
			tasks)
				info "remove task repos"
				assure_exists apt-repo
				epm repolist | grep "/repo/" | while read repo ; do
					sudocmd apt-repo rm "$repo"
				done
				return 0
				;;
			*)
				if tasknumber "$repo" >/dev/null ; then
					repo="$(epm repolist | grep "repo/$(tasknumber "$repo")" | line)"
					# "
				fi
				;;
56 57
		esac

58
		[ -n "$repo" ] || fatal "No such repo or task. Use epm remove repo [autoimports|archive|TASK]"
59
		assure_exists apt-repo
60
		sudocmd apt-repo rm "$repo"
61
		return
62
		;;
63 64 65
esac;

case $PMTYPE in
Vitaly Lipatov's avatar
Vitaly Lipatov committed
66
	apt-dpkg|aptitude-dpkg)
67
		info "You need remove repo from /etc/apt/sources.list"
68 69
		;;
	yum-rpm)
70
		assure_exists yum-utils
71
		sudocmd yum-config-manager --disable "$repo"
72 73
		;;
	urpm-rpm)
74
		sudocmd urpmi.removemedia "$repo"
75
		;;
76
	zypper-rpm)
77
		sudocmd zypper removerepo "$repo"
78 79
		;;
	emerge)
80
		sudocmd layman "-d$repo"
81 82
		;;
	pacman)
83
		info "You need remove repo from /etc/pacman.conf"
84
		;;
85
	npackd)
86
		sudocmd npackdcl remove-repo --url="$repo"
87
		;;
88
	slackpkg)
89
		info "You need remove repo from /etc/slackpkg/mirrors"
90 91
		;;
	*)
92
		fatal "Have no suitable command for $PMTYPE"
93 94 95 96
		;;
esac

}