epm-epm_install 1.92 KB
Newer Older
1 2
#!/bin/sh

3
# Copyright (C) 2016, 2020  Etersoft
4
# Copyright (C) 2016  Danil Mikhailov <danil@etersoft.ru>
5
# Copyright (C) 2016, 2020  Vitaly Lipatov <lav@etersoft.ru>
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#
# 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/>.
#

21
load_helper epm-install
22

23 24
__epm_korinf_site_mask() {
    local MASK="$1"
25
    local archprefix=""
26 27
    # short hack to install needed package
    rhas "$MASK" "[-_]" || MASK="$MASK[-_][0-9]"
28
    # set arch for Korinf compatibility
29
    [ "$($DISTRVENDOR -a)" = "x86_64" ] && archprefix="x86_64/"
30
    echo "http://updates.etersoft.ru/pub/Korinf/$archprefix$($DISTRVENDOR -e)/$MASK*.$($DISTRVENDOR -p)"
31 32 33 34
}

__epm_korinf_list() {
    local MASK="$1"
35 36 37
    MASK="$(__epm_korinf_site_mask "$MASK")"
    showcmd eget --list "$MASK"
    eget --list "$MASK" | sort
38
}
39

40

41
__epm_korinf_install() {
42
    local PACKAGE="$1"
43 44 45
    # due Error: Can't use epm call from the piped script
    #epm install $(__epm_korinf_site_mask "$PACKAGE")
    pkg_names='' pkg_files='' pkg_urls="$(__epm_korinf_site_mask "$PACKAGE")" epm_install
46
}
47

48
epm_epm_install() {
49
    local i
50 51
    local pkglist="$*"

52 53
    # install epm by default
    [ -n "$pkglist" ] || pkglist="eepm"
54 55 56

    case "$pkglist" in
        --list*)
57 58
            shift
            __epm_korinf_list "$1"
59 60 61 62
            return
            ;;
    esac

63 64 65 66
    for i in $pkglist ; do
        __epm_korinf_install $i
    done
}