You need to sign in or sign up before continuing.
epm-install-rpm 2.29 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#!/bin/sh
#
# Copyright (C) 2012-2020  Etersoft
# Copyright (C) 2012-2020  Vitaly Lipatov <lav@etersoft.ru>
#
# 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
# (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 Affero General Public License for more details.
#
# 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/>.
#

epm_install_files_rpm()
{
    local files="$*"
    [ -z "$files" ] && return
24

25
    if __epm_repack_if_needed $files ; then
26
        [ -n "$repacked_pkgs" ] || fatal 'Can'\''t convert $files'
27 28 29 30 31 32 33 34 35
        files="$repacked_pkgs"
    fi

    if [ -n "$save_only" ] ; then
        echo
        cp -v $files "$EPMCURDIR"
        return
    fi

36 37 38 39 40 41
    if [ -n "$put_to_repo" ] ; then
        load_helper epm-repopkg
        epm_put_to_repo $files
        return
    fi

42 43 44 45
    if [ -n "$force_overwrite" ] ; then
        force_overwrite="--replacefiles"
    fi

46

47 48 49 50
    __epm_check_if_src_rpm $files

    # --replacepkgs: Install the Package Even If Already Installed
    local replacepkgs="$(__epm_get_replacepkgs $files)"
51
    sudocmd rpm -Uvh $replacepkgs $(subst_option dryrun --test) $force $noscripts $nodeps $files $force_overwrite && return
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
    local RES=$?

    __epm_check_if_rpm_already_installed $force $replacepkgs $noscripts $nodeps $files && return

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

    # fallback to install names

    # separate second output
    info

    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

    epm_install_names $files
    return

}