epm-upgrade 2.12 KB
Newer Older
1 2
#!/bin/sh
#
Vitaly Lipatov's avatar
Vitaly Lipatov committed
3 4
# Copyright (C) 2012,2014  Etersoft
# Copyright (C) 2012,2014  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-check_updated_repo

22
epm_upgrade()
23
{
24
	local CMD
25

26 27
	[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"

28 29 30
	# it is useful for first time running
	update_repo_if_needed

Vitaly Lipatov's avatar
Vitaly Lipatov committed
31
	info "Running command for upgrade packages"
32 33

	case $PMTYPE in
34
	apt-rpm|apt-dpkg)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
35 36
		# non_interactive
		# Функцию добавления параметра при условии
37 38
		CMD="apt-get dist-upgrade"
		;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
39 40 41
	aptitude-dpkg)
		CMD="aptitude dist-upgrade"
		;;
42
	yum-rpm)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
43
		# can do update repobase automagically
44 45
		CMD="yum update"
		;;
46 47 48
	dnf-rpm)
		CMD="dnf update"
		;;
49 50 51
	snappy)
		CMD="snappy update"
		;;
52
	urpm-rpm)
53 54
		# or --auto-select --replace-files
		CMD="urpmi --auto-update"
55 56
		;;
	zypper-rpm)
57
		CMD="zypper dist-upgrade"
58
		;;
59
	pacman)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
60
		CMD="pacman -S -u $force"
61
		;;
62 63 64
	aura)
		CMD="aura -A -u"
		;;
65 66 67
	emerge)
		CMD="emerge -NuDa world"
		;;
68 69 70
	conary)
		CMD="conary updateall"
		;;
71
	pkgsrc)
72 73
		CMD="freebsd-update fetch install"
		;;
74 75 76
	pkgng)
		CMD="pkg upgrade"
		;;
77 78 79
	chocolatey)
		CMD="chocolatey update all"
		;;
80
	homebrew)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
81 82 83
		#CMD="brew upgrade"
		sudocmd "brew upgrade `brew outdated`"
		return
84 85 86 87
		;;
	ipkg)
		CMD="ipkg upgrade"
		;;
88
	slackpkg)
89
		CMD="/usr/sbin/slackpkg upgrade-all"
90
		;;
91 92 93
	guix)
		CMD="guix package -u"
		;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
94 95 96 97
	aptcyg)
		docmd_foreach "epm install" $(short=1 epm packages)
		return
		;;
98
	*)
99
		fatal "Have no suitable command for $PMTYPE"
100
		;;
101
	esac
102

103
	sudocmd $CMD $pkg_filenames
104
}