epm-install 15.9 KB
Newer Older
Vitaly Lipatov's avatar
Vitaly Lipatov committed
1 2
#!/bin/sh
#
3 4
# Copyright (C) 2012-2018  Etersoft
# Copyright (C) 2012-2018  Vitaly Lipatov <lav@etersoft.ru>
Vitaly Lipatov's avatar
Vitaly Lipatov committed
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
Vitaly Lipatov's avatar
Vitaly Lipatov committed
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.
Vitaly Lipatov's avatar
Vitaly Lipatov committed
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/>.
Vitaly Lipatov's avatar
Vitaly Lipatov committed
18 19
#

20
load_helper epm-sh-altlinux
21
load_helper epm-query
22
load_helper epm-assure
23
load_helper epm-repack
24
load_helper epm-check_updated_repo
25
load_helper epm-sh-warmup
26

27 28 29 30 31 32
__fast_hack_for_filter_out_installed_rpm()
{
	LANG=C LC_ALL=C xargs -n1 rpm -q 2>&1 | grep 'is not installed' |
		sed -e 's|^.*package \(.*\) is not installed.*|\1|g'
}

33 34 35 36 37
# TODO: use when run install with epm --skip-installed install
filter_out_installed_packages()
{
	[ -z "$skip_installed" ] && cat && return

38 39 40 41 42 43 44
	case $PMTYPE in
		yum-rpm|dnf-rpm)
			if [ "$($DISTRVENDOR -a)" = "x86_64" ] ; then
				# shellcheck disable=SC2013
				for i in $(cat) ; do
					is_installed "$(__print_with_arch_suffix $i .x86_64)" && continue
					is_installed "$(__print_with_arch_suffix $i .noarch)" && continue
45
					echo $i
46 47 48 49 50 51 52
				done
			else
				__fast_hack_for_filter_out_installed_rpm
			fi
			;;
		*-rpm)
			__fast_hack_for_filter_out_installed_rpm
53
			;;
54 55 56 57 58
		# dpkg -l lists some non ii status (un, etc)
		#"deb")
		#	LANG=C LC_ALL=C xargs -n1 dpkg -l 2>&1 | grep -i 'no packages found matching' |
		#		sed -e 's|\.\+$||g' -e 's|^.*[Nn]o packages found matching \(.*\)|\1|g'
		#	;;
59
		*)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
60
			# shellcheck disable=SC2013
61 62 63
			for i in $(cat) ; do
				is_installed $i || echo $i
			done
64
			;;
65
	esac | sed -e "s|rpm-build-altlinux-compat[^ ]*||g" | filter_strip_spaces
66 67
}

68 69 70
# for zypper before SUSE/11.0
__use_zypper_no_gpg_checks()
{
Vitaly Lipatov's avatar
Vitaly Lipatov committed
71
    a='' zypper install --help 2>&1 | grep -q -- "--no-gpg-checks" && echo "--no-gpg-checks"
72
}
73

74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
# args: cmd_reinstall, cmd_install, packages
__separate_sudocmd_foreach()
{
    local cmd_re=$1
    local cmd_in=$2
    shift 2
    separate_installed $@
    if [ -n "$pkg_noninstalled" ] ; then
        sudocmd_foreach "$cmd_re" $pkg_noninstalled || return
    fi
    if [ -n "$pkg_installed" ] ; then
        sudocmd_foreach "$cmd_in" $pkg_installed || return
    fi
    return 0
}

# args: cmd_reinstall, cmd_install, packages
__separate_sudocmd()
{
    local cmd_re=$1
    local cmd_in=$2
    shift 2
    separate_installed $@
    if [ -n "$pkg_noninstalled" ] ; then
        sudocmd "$cmd_re" $pkg_noninstalled || return
    fi
    if [ -n "$pkg_installed" ] ; then
        sudocmd "$cmd_in" $pkg_installed || return
    fi
    return 0
}

Vitaly Lipatov's avatar
Vitaly Lipatov committed
106
# copied from etersoft-build-utils/share/eterbuild/functions/rpmpkg
107
epm_install_names()
Vitaly Lipatov's avatar
Vitaly Lipatov committed
108
{
109 110 111 112
	[ -z "$1" ] && return

	warmup_hibase

113 114 115 116 117
	if [ -n "$non_interactive" ] ; then
		epm_ni_install_names "$@"
		return
	fi

118
	case $PMTYPE in
119
		apt-rpm|apt-dpkg)
120
			APTOPTIONS="$APTOPTIONS $(subst_option verbose "-o Debug::pkgMarkInstall=1 -o Debug::pkgProblemResolver=1")"
121
			sudocmd apt-get $APTOPTIONS $noremove install $@
122
			return ;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
123 124 125
		aptitude-dpkg)
			sudocmd aptitude install $@
			return ;;
126 127 128
		deepsolver-rpm)
			sudocmd ds-install $@
			return ;;
129
		urpm-rpm)
130
			sudocmd urpmi $URPMOPTIONS $@
131
			return ;;
132
		pkgsrc)
133
			sudocmd pkg_add -r $@
Vitaly Lipatov's avatar
Vitaly Lipatov committed
134
			return ;;
135 136 137
		pkgng)
			sudocmd pkg install $@
			return ;;
138
		emerge)
139
			sudocmd emerge -uD $@
140
			return ;;
141
		pacman)
142
			sudocmd pacman -S $force $nodeps $@
143
			return ;;
144 145 146
		aura)
			sudocmd aura -A $force $nodeps $@
			return ;;
147
		yum-rpm)
148
			sudocmd yum $YUMOPTIONS install $(echo "$*" | exp_with_arch_suffix)
149
			return ;;
150
		dnf-rpm)
151
			sudocmd dnf install $(echo "$*" | exp_with_arch_suffix)
152
			return ;;
153 154 155
		snappy)
			sudocmd snappy install $@
			return ;;
156
		zypper-rpm)
157
			sudocmd zypper install $ZYPPEROPTIONS $@
158 159
			return ;;
		mpkg)
160
			sudocmd mpkg install $@
161
			return ;;
162 163 164
		conary)
			sudocmd conary update $@
			return ;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
165
		npackd)
166 167
			# FIXME: correct arg
			__separate_sudocmd_foreach "npackdcl add --package=" "npackdcl update --package=" $@
Vitaly Lipatov's avatar
Vitaly Lipatov committed
168
			return ;;
169
		slackpkg)
170
			__separate_sudocmd_foreach "/usr/sbin/slackpkg install" "/usr/sbin/slackpkg upgrade" $@
171 172
			return ;;
		homebrew)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
173
			# FIXME: sudo and quote
Vitaly Lipatov's avatar
Vitaly Lipatov committed
174
			SUDO='' __separate_sudocmd "brew install" "brew upgrade" "$@"
175 176 177 178
			return ;;
		ipkg)
			[ -n "$force" ] && force=-force-depends
			sudocmd ipkg $force install $@
179
			return ;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
180
		nix)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
181
			__separate_sudocmd "nix-env --install" "nix-env --upgrade" "$@"
Vitaly Lipatov's avatar
Vitaly Lipatov committed
182
			return ;;
183 184 185
		apk)
			sudocmd apk add $@
			return ;;
186 187 188
		tce)
			sudocmd tce-load -wi $@
			return ;;
189 190 191
		guix)
			__separate_sudocmd "guix package -i" "guix package -i" $@
			return ;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
192
		android)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
193
			fatal "We still have no idea how to use package repository, ever if it is F-Droid."
194
			return ;;
195 196 197
		aptcyg)
			sudocmd apt-cyg install $@
			return ;;
198 199 200
		xbps)
			sudocmd xbps-install $@
			return ;;
201
		*)
202
			fatal "Have no suitable install command for $PMTYPE"
Vitaly Lipatov's avatar
Vitaly Lipatov committed
203
			;;
204 205 206
	esac
}

207
# Non interactive install
208 209
epm_ni_install_names()
{
Danil Mikhailov's avatar
Danil Mikhailov committed
210
	[ -z "$1" ] && return
211

212
	case $PMTYPE in
213
		apt-rpm|apt-dpkg)
214
			export DEBIAN_FRONTEND=noninteractive
215
			sudocmd apt-get -y $noremove --force-yes -o APT::Install::VirtualVersion=true -o APT::Install::Virtual=true -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" $APTOPTIONS install $@
216
			return ;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
217
		aptitude-dpkg)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
218
			sudocmd aptitude -y install $@
Vitaly Lipatov's avatar
Vitaly Lipatov committed
219
			return ;;
220
		yum-rpm)
221
			sudocmd yum -y $YUMOPTIONS install $(echo "$*" | exp_with_arch_suffix)
222
			return ;;
223
		dnf-rpm)
224
			sudocmd dnf -y $YUMOPTIONS install $(echo "$*" | exp_with_arch_suffix)
225
			return ;;
226
		urpm-rpm)
227
			sudocmd urpmi --auto $URPMOPTIONS $@
228 229
			return ;;
		zypper-rpm)
230
			# FIXME: returns true ever no package found, need check for "no found", "Nothing to do."
231
			yes | sudocmd zypper --non-interactive $ZYPPEROPTIONS install $@
232
			return ;;
233
		pkgsrc)
234
			sudocmd pkg_add -r $@
Vitaly Lipatov's avatar
Vitaly Lipatov committed
235
			return ;;
236 237 238
		pkgng)
			sudocmd pkg install -y $@
			return ;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
239 240 241
		emerge)
			sudocmd emerge -uD $@
			return ;;
242
		pacman)
243
			sudocmd pacman -S --noconfirm $force $nodeps $@
244
			return ;;
245 246 247
		aura)
			sudocmd aura -A $force $nodeps $@
			return ;;
248 249
		npackd)
			#  npackdcl update --package=<package> (remove old and install new)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
250
			sudocmd npackdcl add --package="$*"
251
			return ;;
252 253 254
		chocolatey)
			docmd chocolatey install $@
			return ;;
255 256 257
		ipkg)
			sudocmd ipkg -force-defaults install $@
			return ;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
258 259 260
		nix)
			sudocmd nix-env --install $@
			return ;;
261 262 263
		apk)
			sudocmd apk add $@
			return ;;
264 265 266
		tce)
			sudocmd tce-load -wi $@
			return ;;
267 268 269
		xbps)
			sudocmd xbps-install -y $@
			return ;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
270 271
		homebrew)
			# FIXME: sudo and quote
Vitaly Lipatov's avatar
Vitaly Lipatov committed
272
			SUDO='' __separate_sudocmd "brew install" "brew upgrade" $@
Vitaly Lipatov's avatar
Vitaly Lipatov committed
273
			return ;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
274 275 276
		#android)
		#	sudocmd pm install $@
		#	return ;;
277
		slackpkg)
278
			# FIXME: broken status when use batch and default answer
279
			__separate_sudocmd_foreach "/usr/sbin/slackpkg -batch=on -default_answer=yes install" "/usr/sbin/slackpkg -batch=on -default_answer=yes upgrade" $@
280
			return ;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
281
		*)
282
			fatal "Have no suitable appropriate install command for $PMTYPE"
Vitaly Lipatov's avatar
Vitaly Lipatov committed
283 284 285 286
			;;
	esac
}

287 288 289 290 291 292
__epm_check_if_rpm_already_installed()
{
	# Not: we can make optimize if just check version?
	LANG=C $SUDO rpm -Uvh $force $nodeps $@ 2>&1 | grep -q "is already installed"
}

293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309
__handle_direct_install()
{
    case "$DISTRNAME" in
        "ALTLinux")
            load_helper epm-download
            local pkg url
            for pkg in $pkg_names ; do
                url=$(__epm_get_altpkg_url $pkg)
                [ -n "$url" ] || continue
                # TODO: use estrlist
                pkg_urls="$pkg_urls $url"
            done
            # FIXME: need remove
            pkg_names=""
            ;;
    esac
}
310

311
epm_install_files()
Vitaly Lipatov's avatar
Vitaly Lipatov committed
312
{
Danil Mikhailov's avatar
Danil Mikhailov committed
313
    [ -z "$1" ] && return
314

Vitaly Lipatov's avatar
Vitaly Lipatov committed
315 316 317 318
    # TODO: check read permissions
    # sudo test -r FILE
    # do not fallback to install_names if we have no permissions

319
    case $PMTYPE in
320
        apt-rpm)
321 322
            __epm_check_if_try_install_deb $@ && return

323
            # do not using low-level for install by file path (FIXME: reasons?)
324 325 326
            if ! is_dirpath "$@" || [ "$(get_package_type "$@")" = "rpm" ] ; then
                sudocmd rpm -Uvh $force $nodeps $@ && return
                local RES=$?
327
                # TODO: check rpm result code and convert it to compatible format if possible
328
                __epm_check_if_rpm_already_installed $@ && return
329

330
            # if run with --nodeps, do not fallback on hi level
331
            [ -n "$nodeps" ] && return $RES
332
            fi
333

334 335
            # use install_names
            ;;
336

Vitaly Lipatov's avatar
Vitaly Lipatov committed
337
        apt-dpkg|aptitude-dpkg)
338 339 340 341
            # the new version of the conf. file is installed with a .dpkg-dist suffix
            if [ -n "$non_interactive" ] ; then
                DPKGOPTIONS="--force-confdef --force-confold"
            fi
342 343 344

            __epm_check_if_try_install_rpm $@ && return

345
            # FIXME: return false in case no install and in case install with broken deps
346
            sudocmd dpkg $DPKGOPTIONS -i $@
347
            local RES=$?
348 349
            # if run with --nodeps, do not fallback on hi level

350
            [ -n "$nodeps" ] && return $RES
351
            # fall to apt-get -f install for fix deps
Vitaly Lipatov's avatar
Vitaly Lipatov committed
352 353
            # can't use APTOPTIONS with empty install args
            epm_install_names -f
354 355 356

            # repeat install for get correct status
            sudocmd dpkg $DPKGOPTIONS -i $@
Vitaly Lipatov's avatar
Vitaly Lipatov committed
357
            return
358
            ;;
359

360
        yum-rpm|dnf-rpm)
361 362
            __epm_check_if_try_install_deb $@ && return

363 364 365
            sudocmd rpm -Uvh $force $nodeps $@ && return
            # if run with --nodeps, do not fallback on hi level

366 367
            __epm_check_if_rpm_already_installed $@ && return

368 369 370 371
            [ -n "$nodeps" ] && return
            YUMOPTIONS=--nogpgcheck
            # use install_names
            ;;
372

373
        zypper-rpm)
374
            __epm_check_if_try_install_deb $@ && return
375
            sudocmd rpm -Uvh $force $nodeps $@ && return
376 377
            local RES=$?

378 379
            __epm_check_if_rpm_already_installed $@ && return

380 381
            # if run with --nodeps, do not fallback on hi level

382
            [ -n "$nodeps" ] && return $RES
383
            ZYPPEROPTIONS=$(__use_zypper_no_gpg_checks)
384 385
            # use install_names
            ;;
386

387
        urpm-rpm)
388
            __epm_check_if_try_install_deb $@ && return
389
            sudocmd rpm -Uvh $force $nodeps $@ && return
390 391
            local RES=$?

392 393
            __epm_check_if_rpm_already_installed $@ && return

394
            # if run with --nodeps, do not fallback on hi level
395
            [ -n "$nodeps" ] && return $RES
396 397

            URPMOPTIONS=--no-verify-rpm
398 399
            # use install_names
            ;;
400
        pkgsrc)
401
            sudocmd pkg_add $@
402
            return ;;
403 404 405 406 407 408 409 410 411 412 413
        pkgng)
            local PKGTYPE="$(get_package_type $@)"
            case "$PKGTYPE" in
                tbz)
                    sudocmd pkg_add $@
                    ;;
                *)
                    sudocmd pkg add $@
                    ;;
            esac
            return ;;
414 415 416
        android)
            sudocmd pm install $@
            return ;;
417
        emerge)
418 419
            load_helper epm-install-emerge
            sudocmd epm_install_emerge $@
420
            return ;;
421
        pacman)
422
            sudocmd pacman -U --noconfirm $force $nodeps $@ && return
423 424 425
            local RES=$?

            [ -n "$nodeps" ] && return $RES
426
            sudocmd pacman -U $force $@
427
            return ;;
428
        slackpkg)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
429
            # FIXME: check for full package name
Vitaly Lipatov's avatar
Vitaly Lipatov committed
430
            # FIXME: broken status when use batch and default answer
431
            __separate_sudocmd_foreach "/sbin/installpkg" "/sbin/upgradepkg" $@
432
            return ;;
433 434
    esac

435
    # other systems can install file package via ordinary command
436
    epm_install_names "$@"
437 438
}

439 440
epm_print_install_command()
{
441 442 443
    # print out low level command by default (wait --low-level for control it)
    #[ -z "$1" ] && return
    [ -z "$1" ] && [ -n "$pkg_names" ] && return
444
    case $PMTYPE in
445
        apt-rpm|yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
446
            echo "rpm -Uvh --force $nodeps $*"
447
            ;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
448
        apt-dpkg|aptitude-dpkg)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
449
            echo "dpkg -i $*"
450
            ;;
451
        pkgsrc)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
452
            echo "pkg_add $*"
453
            ;;
454
        pkgng)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
455
            echo "pkg add $*"
456
            ;;
457 458
        emerge)
            # need be placed in /usr/portage/packages/somewhere
Vitaly Lipatov's avatar
Vitaly Lipatov committed
459
            echo "emerge --usepkg $*"
460
            ;;
461
        pacman)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
462
            echo "pacman -U --noconfirm --force $nodeps $*"
463 464
            ;;
        slackpkg)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
465
            echo "/sbin/installpkg $*"
466
            ;;
467
        npackd)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
468
            echo "npackdcl add --package=$*"
469
            ;;
470
        ipkg)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
471
            echo "ipkg install $*"
472
            ;;
473
        android)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
474
            echo "pm install $*"
475
            ;;
476
        aptcyg)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
477
            echo "apt-cyg install $*"
478
            ;;
479
        tce)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
480
            echo "tce-load -wi $*"
481
            ;;
482
        xbps)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
483
            echo "xbps-install -y $*"
484
            ;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
485 486
        homebrew)
            # FIXME: sudo and quote
Vitaly Lipatov's avatar
Vitaly Lipatov committed
487
            echo "brew install $*"
Vitaly Lipatov's avatar
Vitaly Lipatov committed
488
            ;;
489

490
        *)
491
            fatal "Have no suitable appropriate install command for $PMTYPE"
492 493 494 495
            ;;
    esac
}

496 497
epm_print_install_names_command()
{
498
	# check for pkg_files to support print out command without pkg names in args
499 500
	#[ -z "$1" ] && [ -n "$pkg_files" ] && return
	[ -z "$1" ] && return
501 502
	case $PMTYPE in
		apt-rpm|apt-dpkg)
503
			echo "apt-get -y --force-yes -o APT::Install::VirtualVersion=true -o APT::Install::Virtual=true $APTOPTIONS install $*"
504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534
			return ;;
		aptitude-dpkg)
			echo "aptitude -y install $*"
			return ;;
		yum-rpm)
			echo "yum -y $YUMOPTIONS install $*"
			return ;;
		dnf-rpm)
			echo "dnf -y $YUMOPTIONS install $*"
			return ;;
		urpm-rpm)
			echo "urpmi --auto $URPMOPTIONS $*"
			return ;;
		zypper-rpm)
			echo "zypper --non-interactive $ZYPPEROPTIONS install $*"
			return ;;
		pacman)
			echo "pacman -S --noconfirm $force $*"
			return ;;
		chocolatey)
			echo "chocolatey install $*"
			return ;;
		nix)
			echo "nix-env --install $*"
			return ;;
		*)
			fatal "Have no suitable appropriate install command for $PMTYPE"
			;;
	esac
}

535 536 537

epm_install()
{
538
    if tasknumber "$pkg_names" >/dev/null ; then
539
        assure_distr ALTLinux "install with task number"
540 541 542 543 544
        assure_exists apt-repo
        sudocmd apt-repo test $(tasknumber "$pkg_names")
        return
    fi

545
    if [ -n "$show_command_only" ] ; then
546 547
        epm_print_install_command $pkg_files
        epm_print_install_names_command $pkg_names
548 549 550
        return
    fi

551
    if [ -n "$direct" ] && [ -z "$repack" ] ; then
552 553 554
        __handle_direct_install
    fi

555
    # if possible, it will put pkg_urls into pkg_files and reconstruct pkg_filenames
556 557 558 559
    if [ -n "$pkg_urls" ] ; then
        load_helper epm-download
        __handle_pkg_urls_to_install
    fi
560

561
    [ -z "$pkg_files$pkg_names" ] && info "Skip empty install list" && return 22
562

563 564 565
    # to be filter happy
    warmup_lowbase

566 567
    local names="$(echo $pkg_names | filter_out_installed_packages)"
    #local names="$(echo $pkg_names | exp_with_arch_suffix | filter_out_installed_packages)"
568
    local files="$(echo $pkg_files | filter_out_installed_packages)"
569

570 571 572 573 574 575
    # can be empty only after skip installed
    if [ -z "$files$names" ] ; then
        # TODO: assert $skip_installed
        [ -n "$verbose" ] && info "Skip empty install list"
        return 22
    fi
576

577
    if [ -z "$files" ] && [ -z "$direct" ] ; then
578 579 580
        # it is useful for first time running
        update_repo_if_needed
    fi
581

582
    epm_install_names $names || return
583 584 585 586 587 588 589

    # repack binary files
    if [ -n "$repack" ] ; then
        __epm_repack_rpm $files || fatal
        files="$repacked_rpms"
    fi

590
    epm_install_files $files
591
    local RETVAL=$?
592

593 594
    # TODO: move it to exit handler
    if [ -z "$DEBUG" ] ; then
595 596
    # TODO: reinvent
    [ -n "$to_remove_pkg_files" ] && rm -fv $to_remove_pkg_files
597
    [ -n "$to_remove_pkg_files" ] && rmdir -v $(dirname $to_remove_pkg_files | head -n1) 2>/dev/null
598
    fi
599

600
    return $RETVAL
Vitaly Lipatov's avatar
Vitaly Lipatov committed
601
}