epm-upgrade 1.91 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

29 30 31
	echo "Run command for upgrade packages"

	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
	urpm-rpm)
48 49
		# or --auto-select --replace-files
		CMD="urpmi --auto-update"
50 51
		;;
	zypper-rpm)
52
		CMD="zypper dist-upgrade"
53
		;;
54
	pacman)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
55
		CMD="pacman -S -u $force"
56
		;;
57 58 59
	aura)
		CMD="aura -A -u"
		;;
60 61 62
	emerge)
		CMD="emerge -NuDa world"
		;;
63 64 65
	conary)
		CMD="conary updateall"
		;;
66
	pkgsrc)
67 68
		CMD="freebsd-update fetch install"
		;;
69 70 71
	chocolatey)
		CMD="chocolatey update all"
		;;
72
	homebrew)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
73 74 75
		#CMD="brew upgrade"
		sudocmd "brew upgrade `brew outdated`"
		return
76 77 78 79
		;;
	ipkg)
		CMD="ipkg upgrade"
		;;
80
	slackpkg)
81
		CMD="/usr/sbin/slackpkg upgrade-all"
82
		;;
83 84 85
	guix)
		CMD="guix package -u"
		;;
86
	*)
87
		fatal "Have no suitable command for $PMTYPE"
88
		;;
89
	esac
90

91
	sudocmd $CMD $pkg_filenames
92
}