epm-upgrade 1.42 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#!/bin/sh
#
# Copyright (C) 2012  Etersoft
# Copyright (C) 2012  Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (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
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#

21
epm_upgrade()
22
{
23 24 25 26
    echo "Run command for upgrade packages"
    case $PMTYPE in
	apt-rpm|apt-dpkg)
		# FIXME: apt-get update before
27 28
		CMD="apt-get dist-upgrade"
		;;
29
	yum-rpm)
30 31
		CMD="yum update"
		;;
32
	urpm-rpm)
33 34
		# or --auto-select --replace-files
		CMD="urpmi --auto-update"
35 36
		;;
	zypper-rpm)
37
		CMD="zypper dist-upgrade"
38
		;;
39
	pacman)
40 41 42 43 44 45 46 47
		CMD="pacman -S -u"
		;;
	emerge)
		CMD="emerge -NuDa world"
		;;
	pkg_add)
		CMD="freebsd-update fetch install"
		;;
48 49 50
	chocolatey)
		CMD="chocolatey update all"
		;;
51
	slackpkg)
52
		CMD="/usr/sbin/slackpkg upgrade-all"
53
		;;
54
	*)
55
		fatal "Do not known command for $PMTYPE"
56
		;;
57
    esac
58

59
    sudocmd $CMD $pkg_filenames
60
}