epm-epm_install 1.99 KB
Newer Older
1 2 3 4
#!/bin/sh

# Copyright (C) 2016  Etersoft
# Copyright (C) 2016  Danil Mikhailov <danil@etersoft.ru>
5
# Copyright (C) 2016  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
__epm_korinf_site() {
24
    local archprefix=""
25
    [ "$($DISTRVENDOR -a)" = "x86_64" ] && archprefix="x86_64/"
26 27 28 29 30 31 32 33 34 35 36
    local aftername="-"
    [ "$($DISTRVENDOR -p)" = "deb" ] && aftername="_"
    echo "http://updates.etersoft.ru/pub/Korinf/$archprefix$($DISTRVENDOR -e)"
}

__epm_korinf_list() {
    [ "$1" = "--list" ] && shift
    local MASK="$1"
    showcmd eget --list "$(__epm_korinf_site)/$MASK*.$($DISTRVENDOR -p)"
    eget --list "$(__epm_korinf_site)/$MASK*.$($DISTRVENDOR -p)" | sort
}
37

38 39 40 41

__epm_korinf_install(){
    local PACKAGE="$1"
    # FIXME: some way to get latest package
42 43 44
    local fn="$(__epm_korinf_list $PACKAGE$aftername | tail -n1)"
    [ -n "$fn" ] || fatal "Can't find package file for $PACKAGE"
    local download_link=$(__epm_korinf_site)/$fn
45
    #info "Install $download_link ..."
Vitaly Lipatov's avatar
Vitaly Lipatov committed
46
    pkg_names='' pkg_files='' pkg_urls="$download_link" epm_install
47
}
48 49 50 51 52 53

epm_epm_install(){
    local i
    local pkglist="$pkg_filenames"
    # install epm by default
    [ -n "$pkglist" ] || pkglist="eepm"
54 55 56 57 58 59 60 61

    case "$pkglist" in
        --list*)
            __epm_korinf_list $pkglist
            return
            ;;
    esac

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