#!/bin/sh # Copyright (C) 2016, 2020 Etersoft # Copyright (C) 2016 Danil Mikhailov <danil@etersoft.ru> # Copyright (C) 2016, 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/>. # load_helper epm-install # copied from play.d/common.sh check_url_is_accessible() { local res eget --check "$1" } # update URL variable update_url_if_need_mirrored() { local MIRROR="$1" local SECONDURL check_url_is_accessible "$URL" && return if [ -n "$MIRROR" ] ; then check_url_is_accessible "$MIRROR" && URL="$MIRROR" return fi MIRROR="https://mirror.eterfund.ru" SECONDURL="$(echo "$URL" | sed -e "s|^.*://|$MIRROR/|")" check_url_is_accessible "$SECONDURL" && URL="$SECONDURL" && return MIRROR="https://mirror.eterfund.org" SECONDURL="$(echo "$URL" | sed -e "s|^.*://|$MIRROR/|")" check_url_is_accessible "$SECONDURL" && URL="$SECONDURL" && return } __epm_korinf_site_mask() { local MASK="$1" local archprefix="" # short hack to install needed package rhas "$MASK" "[-_]" || MASK="$MASK[-_][0-9]" # set arch for Korinf compatibility [ "$($DISTRVENDOR -a)" = "x86_64" ] && archprefix="x86_64/" URL="http://updates.etersoft.ru/pub/Korinf" update_url_if_need_mirrored echo "$URL/$archprefix$($DISTRVENDOR -e)/$MASK*.$($DISTRVENDOR -p)" } __epm_korinf_list() { local MASK="$1" MASK="$(__epm_korinf_site_mask "$MASK")" showcmd eget --list "$MASK" eget --list "$MASK" | sort } __epm_korinf_install() { local PACKAGE="$1" # due Error: Can't use epm call from the piped script #epm install $(__epm_korinf_site_mask "$PACKAGE") [ -n "$non_interactive" ] || interactive="--interactive" pkg_names='' pkg_files='' pkg_urls="$(__epm_korinf_site_mask "$PACKAGE")" epm_install } epm_epm_install() { local i local pkglist="$*" # install epm by default if [ -z "$pkglist" ] || [ "$pkglist" = "epm" ] || [ "$pkglist" = "eepm" ]; then # if [ "$($DISTRVENDOR -s)" = "alt" ] ; then # pkglist="distro_info eepm" # else pkglist="eepm" # fi fi case "$pkglist" in --list*) shift __epm_korinf_list "$1" return ;; esac for i in $pkglist ; do __epm_korinf_install $i done }