epm-upgrade 1.48 KB
Newer Older
1 2 3 4 5
#!/bin/sh
#
# Copyright (C) 2012  Etersoft
# Copyright (C) 2012  Vitaly Lipatov <lav@etersoft.ru>
#
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
epm_upgrade()
21
{
22 23 24 25
	local CMD
	echo "Run command for upgrade packages"

	case $PMTYPE in
26 27
	apt-rpm|apt-dpkg)
		# FIXME: apt-get update before
28 29
		CMD="apt-get dist-upgrade"
		;;
30
	yum-rpm)
31 32
		CMD="yum update"
		;;
33 34 35
	dnf-rpm)
		CMD="dnf update"
		;;
36
	urpm-rpm)
37 38
		# or --auto-select --replace-files
		CMD="urpmi --auto-update"
39 40
		;;
	zypper-rpm)
41
		CMD="zypper dist-upgrade"
42
		;;
43
	pacman)
44 45 46 47 48
		CMD="pacman -S -u"
		;;
	emerge)
		CMD="emerge -NuDa world"
		;;
49
	pkgsrc)
50 51
		CMD="freebsd-update fetch install"
		;;
52 53 54
	chocolatey)
		CMD="chocolatey update all"
		;;
55 56 57 58 59 60
	homebrew)
		CMD="brew upgrade"
		;;
	ipkg)
		CMD="ipkg upgrade"
		;;
61
	slackpkg)
62
		CMD="/usr/sbin/slackpkg upgrade-all"
63
		;;
64
	*)
65
		fatal "Do not known command for $PMTYPE"
66
		;;
67
	esac
68

69
	sudocmd $CMD $pkg_filenames
70
}