epm-upgrade 1.98 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 28

	# it is useful for first time running
	update_repo_if_needed

Vitaly Lipatov's avatar
Vitaly Lipatov committed
29
	info "Running command for upgrade packages"
30 31

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

97
	sudocmd $CMD $pkg_filenames
98
}