epm-install-print-command 4.06 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 24 25 26 27 28 29 30 31 32 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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
#!/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_print_install_files_command()
{
    # print out low level command by default (wait --low-level for control it)
    #[ -z "$1" ] && return
    [ -z "$1" ] && [ -n "$pkg_names" ] && return
    case $PMTYPE in
        *-rpm)
            echo "rpm -Uvh --force $nodeps $*"
            ;;
        *-dpkg)
            echo "dpkg -i $*"
            ;;
        pkgsrc)
            echo "pkg_add $*"
            ;;
        pkgng)
            echo "pkg add $*"
            ;;
        emerge)
            # need be placed in /usr/portage/packages/somewhere
            echo "emerge --usepkg $*"
            ;;
        pacman)
            echo "pacman -U --noconfirm $nodeps $*"
            ;;
        slackpkg)
            echo "/sbin/installpkg $*"
            ;;
        npackd)
            echo "npackdcl add --package=$*"
            ;;
        opkg)
            echo "opkg install $*"
            ;;
        eopkg)
            echo "eopkg install $*"
            ;;
        android)
            echo "pm install $*"
            ;;
        termux-pkg)
            echo "pkg install $*"
            ;;
        aptcyg)
            echo "apt-cyg install $*"
            ;;
        tce)
            echo "tce-load -wi $*"
            ;;
        xbps)
            echo "xbps-install -y $*"
            ;;
        appget|winget)
            echo "$PMTYPE install -s $*"
            ;;
        homebrew)
            # FIXME: sudo and quote
            echo "brew install $*"
            ;;

        *)
82
            fatal 'Have no suitable appropriate install command for $PMTYPE'
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
            ;;
    esac
}

epm_print_install_names_command()
{
    # check for pkg_files to support print out command without pkg names in args
    #[ -z "$1" ] && [ -n "$pkg_files" ] && return
    [ -z "$1" ] && return
    case $PMTYPE in
        apt-rpm)
            echo "apt-get -y --force-yes -o APT::Install::VirtualVersion=true -o APT::Install::Virtual=true $APTOPTIONS install $*"
            return ;;
        apt-dpkg)
            # this command  not for complex use. ACCEPT_EULA=y DEBIAN_FRONTEND=noninteractive
            echo "apt-get -y --force-yes -o APT::Install::VirtualVersion=true -o APT::Install::Virtual=true $APTOPTIONS install $*"
            return ;;
        aptitude-dpkg)
            echo "aptitude -y install $*"
            return ;;
        yum-rpm)
            echo "yum -y $YUMOPTIONS install $*"
            return ;;
        dnf-rpm)
            echo "dnf -y $YUMOPTIONS --allowerasing install $*"
            return ;;
        urpm-rpm)
            echo "urpmi --auto $URPMOPTIONS $*"
            return ;;
        zypper-rpm)
            echo "zypper --non-interactive $ZYPPEROPTIONS install $*"
            return ;;
        packagekit)
            echo "pkcon --noninteractive $*"
            return ;;
        pacman)
            echo "pacman -S --noconfirm $*"
            return ;;
        choco)
            echo "choco install $*"
            return ;;
        nix)
            echo "nix-env --install $*"
            return ;;
        eopkg)
            echo "eopkg install $*"
            return ;;
        termux-pkg)
            echo "pkg install $*"
            return ;;
        appget|winget)
            echo "$PMTYPE install $*"
            return ;;
        *)
137
            fatal 'Have no suitable appropriate install command for $PMTYPE'
138 139 140
            ;;
    esac
}