You need to sign in or sign up before continuing.
epm-install 16.1 KB
Newer Older
Vitaly Lipatov's avatar
Vitaly Lipatov committed
1 2
#!/bin/sh
#
3 4
# Copyright (C) 2012-2020  Etersoft
# Copyright (C) 2012-2020  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-sh-install
22
load_helper epm-query
23
load_helper epm-assure
24
load_helper epm-repack
25
load_helper epm-check_updated_repo
26
load_helper epm-sh-warmup
27

28

29 30 31
# for zypper before SUSE/11.0
__use_zypper_no_gpg_checks()
{
Vitaly Lipatov's avatar
Vitaly Lipatov committed
32
    a='' zypper install --help 2>&1 | grep -q -- "--no-gpg-checks" && echo "--no-gpg-checks"
33
}
34

35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
# 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
67
# copied from etersoft-build-utils/share/eterbuild/functions/rpmpkg
68
epm_install_names()
Vitaly Lipatov's avatar
Vitaly Lipatov committed
69
{
70 71 72 73
	[ -z "$1" ] && return

	warmup_hibase

74 75 76 77 78
	if [ -n "$non_interactive" ] ; then
		epm_ni_install_names "$@"
		return
	fi

79
	case $PMTYPE in
80
		apt-rpm|apt-dpkg)
81
			APTOPTIONS="$APTOPTIONS $(subst_option verbose "-o Debug::pkgMarkInstall=1 -o Debug::pkgProblemResolver=1")"
82
			sudocmd apt-get $APTOPTIONS $noremove install $@ && save_installed_packages $@
83
			return ;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
84 85 86
		aptitude-dpkg)
			sudocmd aptitude install $@
			return ;;
87 88 89
		deepsolver-rpm)
			sudocmd ds-install $@
			return ;;
90
		urpm-rpm)
91
			sudocmd urpmi $URPMOPTIONS $@
92
			return ;;
93
		packagekit)
94 95
			docmd pkcon install $@
			return ;;
96
		pkgsrc)
97
			sudocmd pkg_add -r $@
Vitaly Lipatov's avatar
Vitaly Lipatov committed
98
			return ;;
99 100 101
		pkgng)
			sudocmd pkg install $@
			return ;;
102
		emerge)
103
			sudocmd emerge -uD $@
104
			return ;;
105
		pacman)
106
			sudocmd pacman -S $force $nodeps $@
107
			return ;;
108 109 110
		aura)
			sudocmd aura -A $force $nodeps $@
			return ;;
111
		yum-rpm)
112
			sudocmd yum $YUMOPTIONS install $(echo "$*" | exp_with_arch_suffix)
113
			return ;;
114
		dnf-rpm)
115
			sudocmd dnf install $(echo "$*" | exp_with_arch_suffix)
116
			return ;;
117 118 119
		snappy)
			sudocmd snappy install $@
			return ;;
120
		zypper-rpm)
121
			sudocmd zypper install $ZYPPEROPTIONS $@
122 123
			return ;;
		mpkg)
124
			sudocmd mpkg install $@
125
			return ;;
126 127 128
		conary)
			sudocmd conary update $@
			return ;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
129
		npackd)
130 131
			# FIXME: correct arg
			__separate_sudocmd_foreach "npackdcl add --package=" "npackdcl update --package=" $@
Vitaly Lipatov's avatar
Vitaly Lipatov committed
132
			return ;;
133
		slackpkg)
134
			__separate_sudocmd_foreach "/usr/sbin/slackpkg install" "/usr/sbin/slackpkg upgrade" $@
135 136
			return ;;
		homebrew)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
137
			# FIXME: sudo and quote
Vitaly Lipatov's avatar
Vitaly Lipatov committed
138
			SUDO='' __separate_sudocmd "brew install" "brew upgrade" "$@"
139
			return ;;
140
		opkg)
141
			[ -n "$force" ] && force=-force-depends
142
			sudocmd opkg $force install $@
143
			return ;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
144
		nix)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
145
			__separate_sudocmd "nix-env --install" "nix-env --upgrade" "$@"
Vitaly Lipatov's avatar
Vitaly Lipatov committed
146
			return ;;
147 148 149
		apk)
			sudocmd apk add $@
			return ;;
150 151 152
		tce)
			sudocmd tce-load -wi $@
			return ;;
153 154 155
		guix)
			__separate_sudocmd "guix package -i" "guix package -i" $@
			return ;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
156
		android)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
157
			fatal "We still have no idea how to use package repository, ever if it is F-Droid."
158
			return ;;
159 160 161
		aptcyg)
			sudocmd apt-cyg install $@
			return ;;
162 163 164
		xbps)
			sudocmd xbps-install $@
			return ;;
165 166 167
		appget|winget)
			sudocmd $PMTYPE install $@
			return ;;
168
		*)
169
			fatal "Have no suitable install command for $PMTYPE"
Vitaly Lipatov's avatar
Vitaly Lipatov committed
170
			;;
171 172 173
	esac
}

174
# Non interactive install
175 176
epm_ni_install_names()
{
Danil Mikhailov's avatar
Danil Mikhailov committed
177
	[ -z "$1" ] && return
178

179
	case $PMTYPE in
180
		apt-rpm|apt-dpkg)
181
			export DEBIAN_FRONTEND=noninteractive
182
			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 $@
183
			return ;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
184
		aptitude-dpkg)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
185
			sudocmd aptitude -y install $@
Vitaly Lipatov's avatar
Vitaly Lipatov committed
186
			return ;;
187
		yum-rpm)
188
			sudocmd yum -y $YUMOPTIONS install $(echo "$*" | exp_with_arch_suffix)
189
			return ;;
190
		dnf-rpm)
191
			sudocmd dnf -y $YUMOPTIONS install $(echo "$*" | exp_with_arch_suffix)
192
			return ;;
193
		urpm-rpm)
194
			sudocmd urpmi --auto $URPMOPTIONS $@
195 196
			return ;;
		zypper-rpm)
197
			# FIXME: returns true ever no package found, need check for "no found", "Nothing to do."
198
			yes | sudocmd zypper --non-interactive $ZYPPEROPTIONS install $@
199
			return ;;
200
		packagekit)
201 202
			docmd pkcon install --noninteractive $@
			return ;;
203
		pkgsrc)
204
			sudocmd pkg_add -r $@
Vitaly Lipatov's avatar
Vitaly Lipatov committed
205
			return ;;
206 207 208
		pkgng)
			sudocmd pkg install -y $@
			return ;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
209 210 211
		emerge)
			sudocmd emerge -uD $@
			return ;;
212
		pacman)
213
			sudocmd pacman -S --noconfirm $force $nodeps $@
214
			return ;;
215 216 217
		aura)
			sudocmd aura -A $force $nodeps $@
			return ;;
218 219
		npackd)
			#  npackdcl update --package=<package> (remove old and install new)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
220
			sudocmd npackdcl add --package="$*"
221
			return ;;
222 223 224
		chocolatey)
			docmd chocolatey install $@
			return ;;
225 226
		opkg)
			sudocmd opkg -force-defaults install $@
227
			return ;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
228 229 230
		nix)
			sudocmd nix-env --install $@
			return ;;
231 232 233
		apk)
			sudocmd apk add $@
			return ;;
234 235 236
		tce)
			sudocmd tce-load -wi $@
			return ;;
237 238 239
		xbps)
			sudocmd xbps-install -y $@
			return ;;
240 241 242
		appget|winget)
			sudocmd $PMTYPE -s install $@
			return ;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
243 244
		homebrew)
			# FIXME: sudo and quote
Vitaly Lipatov's avatar
Vitaly Lipatov committed
245
			SUDO='' __separate_sudocmd "brew install" "brew upgrade" $@
Vitaly Lipatov's avatar
Vitaly Lipatov committed
246
			return ;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
247 248 249
		#android)
		#	sudocmd pm install $@
		#	return ;;
250
		slackpkg)
251
			# FIXME: broken status when use batch and default answer
252
			__separate_sudocmd_foreach "/usr/sbin/slackpkg -batch=on -default_answer=yes install" "/usr/sbin/slackpkg -batch=on -default_answer=yes upgrade" $@
253
			return ;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
254
		*)
255
			fatal "Have no suitable appropriate install command for $PMTYPE"
Vitaly Lipatov's avatar
Vitaly Lipatov committed
256 257 258 259
			;;
	esac
}

260 261 262 263 264 265
__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"
}

266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
__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
}
283

284 285 286 287 288 289 290 291 292
# TODO: forbid src.rpm
__epm_check_if_src_rpm()
{
    local pkg
    for pkg in $@ ; do
        echo "$pkg" | grep -q "\.src.\rpm" && fatal "Installation of a source packages (like '$pkg') is not supported."
    done
}

293
__epm_check_if_needed_repack()
294
{
295 296 297 298
    local pkgname="$(epm print name from "$1")"
    local repackcode="$CONFIGDIR/repack.d/$pkgname.sh"
    [ -x "$repackcode" ] || return
    warning "There is exists repack rules for $pkgname package. It is better install this package via epm --repack install or epm play."
299 300
}

301
epm_install_files()
Vitaly Lipatov's avatar
Vitaly Lipatov committed
302
{
Danil Mikhailov's avatar
Danil Mikhailov committed
303
    [ -z "$1" ] && return
304

Vitaly Lipatov's avatar
Vitaly Lipatov committed
305 306 307
    # TODO: check read permissions
    # sudo test -r FILE
    # do not fallback to install_names if we have no permissions
308 309
    case "$DISTRNAME" in
        "ALTLinux")
Vitaly Lipatov's avatar
Vitaly Lipatov committed
310

Vitaly Lipatov's avatar
Vitaly Lipatov committed
311
            # TODO: replace with name changed function
312
            __epm_check_if_try_install_deb $@ && return
313
            __epm_check_if_src_rpm $@
314

315
            # do not using low-level for install by file path (FIXME: reasons?)
316
            if ! is_dirpath "$@" || [ "$(get_package_type "$@")" = "rpm" ] ; then
317
                __epm_check_vendor $@
318
                __epm_check_if_needed_repack $@
319
                sudocmd rpm -Uvh $force $noscripts $nodeps $@ && save_installed_packages $@ && return
320
                local RES=$?
321
                # TODO: check rpm result code and convert it to compatible format if possible
322
                __epm_check_if_rpm_already_installed $@ && return
323

324
            # if run with --nodeps, do not fallback on hi level
325
            [ -n "$nodeps" ] && return $RES
326
            fi
327

328 329
            epm_install_names "$@"
            return
330
            ;;
331
    esac
332

333
    case $PMTYPE in
Vitaly Lipatov's avatar
Vitaly Lipatov committed
334
        apt-dpkg|aptitude-dpkg)
335 336 337 338
            # 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
339 340 341

            __epm_check_if_try_install_rpm $@ && return

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

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

            # repeat install for get correct status
            sudocmd dpkg $DPKGOPTIONS -i $@
Vitaly Lipatov's avatar
Vitaly Lipatov committed
354
            return
355
            ;;
356

357
       *-rpm)
358
            __epm_check_if_try_install_deb $@ && return
359
            __epm_check_if_src_rpm $@
360
            sudocmd rpm -Uvh $force $noscripts $nodeps $@ && return
361 362
            local RES=$?

363 364
            __epm_check_if_rpm_already_installed $@ && return

365
            # if run with --nodeps, do not fallback on hi level
366
            [ -n "$nodeps" ] && return $RES
367

368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384
            case $PMTYPE in
                yum-rpm|dnf-rpm)
                    YUMOPTIONS=--nogpgcheck
                    # use install_names
                    ;;
                zypper-rpm)
                    ZYPPEROPTIONS=$(__use_zypper_no_gpg_checks)
                    # use install_names
                    ;;
                urpm-rpm)
                    URPMOPTIONS=--no-verify-rpm
                    # use install_names
                    ;;
                *)
                    # use install_names
                    ;;
            esac
385
            ;;
386
        packagekit)
387 388
            docmd pkcon install-local $@
            return ;;
389
        pkgsrc)
390
            sudocmd pkg_add $@
391
            return ;;
392 393 394 395 396 397 398 399 400 401 402
        pkgng)
            local PKGTYPE="$(get_package_type $@)"
            case "$PKGTYPE" in
                tbz)
                    sudocmd pkg_add $@
                    ;;
                *)
                    sudocmd pkg add $@
                    ;;
            esac
            return ;;
403 404 405
        android)
            sudocmd pm install $@
            return ;;
406
        emerge)
407 408
            load_helper epm-install-emerge
            sudocmd epm_install_emerge $@
409
            return ;;
410
        pacman)
411
            sudocmd pacman -U --noconfirm $force $nodeps $@ && return
412 413 414
            local RES=$?

            [ -n "$nodeps" ] && return $RES
415
            sudocmd pacman -U $force $@
416
            return ;;
417
        slackpkg)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
418
            # FIXME: check for full package name
Vitaly Lipatov's avatar
Vitaly Lipatov committed
419
            # FIXME: broken status when use batch and default answer
420
            __separate_sudocmd_foreach "/sbin/installpkg" "/sbin/upgradepkg" $@
421
            return ;;
422 423
    esac

424
    # other systems can install file package via ordinary command
425
    epm_install_names "$@"
426 427
}

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

482
        *)
483
            fatal "Have no suitable appropriate install command for $PMTYPE"
484 485 486 487
            ;;
    esac
}

488 489
epm_print_install_names_command()
{
490
	# check for pkg_files to support print out command without pkg names in args
491 492
	#[ -z "$1" ] && [ -n "$pkg_files" ] && return
	[ -z "$1" ] && return
493 494
	case $PMTYPE in
		apt-rpm|apt-dpkg)
495
			echo "apt-get -y --force-yes -o APT::Install::VirtualVersion=true -o APT::Install::Virtual=true $APTOPTIONS install $*"
496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511
			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 ;;
512
		packagekit)
513 514
			echo "pkcon --noninteractive $*"
			return ;;
515 516 517 518 519 520 521 522 523
		pacman)
			echo "pacman -S --noconfirm $force $*"
			return ;;
		chocolatey)
			echo "chocolatey install $*"
			return ;;
		nix)
			echo "nix-env --install $*"
			return ;;
524 525 526
		appget|winget)
			echo "$PMTYPE install $*"
			return ;;
527 528 529 530 531 532
		*)
			fatal "Have no suitable appropriate install command for $PMTYPE"
			;;
	esac
}

533 534 535

epm_install()
{
536 537 538
    if [ "$DISTRNAME" = "ALTLinux" ] ; then
        if tasknumber "$pkg_names" >/dev/null ; then
            assure_exists apt-repo
539
            sudocmd_foreach "apt-repo test" $(tasknumber $pkg_names)
540 541
            return
        fi
542 543
    fi

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

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

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

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

562 563 564
    # to be filter happy
    warmup_lowbase

565
    # Note: filter_out_installed_packages depends on skip_installed flag
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
    # can be empty only after skip installed
    if [ -z "$files$names" ] ; then
        # TODO: assert $skip_installed
573
        [ -n "$verbose" ] && info "Skip empty install list (filtered out)"
Vitaly Lipatov's avatar
Vitaly Lipatov committed
574
        # FIXME: see to_remove below
575
        return 0
576
    fi
577

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

Vitaly Lipatov's avatar
Vitaly Lipatov committed
583
    # FIXME: see to_remove below
584
    epm_install_names $names || return
585 586 587

    # repack binary files
    if [ -n "$repack" ] ; then
Vitaly Lipatov's avatar
Vitaly Lipatov committed
588
        # FIXME: see to_remove below
Vitaly Lipatov's avatar
Vitaly Lipatov committed
589
        __epm_repack_to_rpm $files || fatal
590 591 592
        files="$repacked_rpms"
    fi

593
    epm_install_files $files
594
    local RETVAL=$?
595

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

603
    return $RETVAL
Vitaly Lipatov's avatar
Vitaly Lipatov committed
604
}