epm-update 2.41 KB
Newer Older
1 2
#!/bin/sh
#
3 4
# Copyright (C) 2012, 2014, 2016-2017  Etersoft
# Copyright (C) 2012, 2014, 2016-2017  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
#

# copied from korinf/tools/run-script/scripts/update

22 23
load_helper epm-sh-warmup

24 25
epm_update()
{
26
	[ -z "$*" ] || fatal "No arguments are allowed here"
Vitaly Lipatov's avatar
Vitaly Lipatov committed
27
	info "Running command for update remote package repository database"
28

29 30
warmup_hibase

31
case $PMTYPE in
32
	apt-rpm)
33 34 35 36 37 38
		# TODO: hack against cd to cwd in apt-get on ALT
		cd /
		sudocmd apt-get update
		local ret="$?"
		cd - >/dev/null
		return $ret
39
		#sudocmd apt-get -f install || exit
40
		;;
41
	apt-dpkg)
42
		sudocmd apt-get update || return
43 44
		#sudocmd apt-get -f install || exit
		#sudocmd apt-get autoremove
Vitaly Lipatov's avatar
Vitaly Lipatov committed
45
		;;
46
	packagekit)
47 48
		docmd pkcon refresh
		;;
49 50 51
	#snappy)
	#	sudocmd snappy
	#	;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
52
	aptitude-dpkg)
53
		sudocmd aptitude update || return
Vitaly Lipatov's avatar
Vitaly Lipatov committed
54
		;;
55
	yum-rpm)
56
		# just skipped
57
		[ -z "$verbose" ] || info "update command is stubbed for yum"
58 59
		;;
	dnf-rpm)
60
		# just skipped
61
		[ -z "$verbose" ] || info "update command is stubbed for dnf"
62
		;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
63
	urpm-rpm)
64
		sudocmd urpmi.update -a
65
		;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
66
	pacman)
67
		sudocmd pacman -S -y
Vitaly Lipatov's avatar
Vitaly Lipatov committed
68
		;;
69 70 71
	aura)
		sudocmd aura -A -y
		;;
72
	zypper-rpm)
73
		sudocmd zypper $(subst_option non_interactive --non-interactive) refresh
74
		;;
75
	emerge)
76
		sudocmd emerge --sync
77
		;;
78
	slackpkg)
79
		sudocmd /usr/sbin/slackpkg -batch=on update
80
		;;
81 82 83
	deepsolver-rpm)
		sudocmd ds-update
		;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
84 85 86
	npackd)
		sudocmd packdcl detect # get packages from MSI database
		;;
87
	homebrew)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
88
		docmd brew update
89
		;;
90 91
	opkg)
		sudocmd opkg update
92
		;;
93 94 95
	apk)
		sudocmd apk update
		;;
96 97 98 99
	pkgsrc)
		# portsnap extract for the first time?
		sudocmd portsnap fetch update
		;;
100 101 102
	aptcyg)
		sudocmd apt-cyg update
		;;
103 104 105
	xbps)
		sudocmd xbps-install -S
		;;
106 107 108
	winget)
		sudocmd winget source update
		;;
109
	*)
110
		fatal "Have no suitable update command for $PMTYPE"
111 112 113 114
		;;
esac

}