#!/bin/sh # # Copyright (C) 2016 Etersoft # Copyright (C) 2016 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/>. # __use_url_install() { case $PMTYPE in apt-rpm) # ALT Linux really? pkg_names="$pkg_names $pkg_urls" ;; #deepsolver-rpm) # pkg_names="$pkg_names $pkg_urls" # ;; #urpm-rpm) # pkg_names="$pkg_names $pkg_urls" # ;; pacman) pkg_names="$pkg_names $pkg_urls" ;; yum-rpm|dnf-rpm) pkg_names="$pkg_names $pkg_urls" ;; #zypper-rpm) # pkg_names="$pkg_names $pkg_urls" # ;; *) return 1 ;; esac return 0 } # for download before install / checking __download_pkg_urls() { local url [ -z "$pkg_urls" ] && return for url in $pkg_urls ; do # TODO: use some individual tmp dir local new_file=/tmp/$(basename "$url") if eget -O $new_file $url && [ -s "$new_file" ] ; then pkg_files="$pkg_files $new_file" to_remove_pkg_files="$to_remove_pkg_files $new_file" else warning "Failed to download $url, ignoring" fi done } # NOTE: call __clean_downloaded_pkg_files after __handle_pkg_urls_to_install() { #[ -n "$pkg_urls" ] || return # TODO: do it correctly to_remove_pkg_files= if [ "$(get_package_type "$pkg")" != $PKGFORMAT ] || ! __use_url_install ; then # use workaround with eget: download and put in pkg_files __download_pkg_urls fi pkg_urls= } __handle_pkg_urls_to_checking() { #[ -n "$pkg_urls" ] || return # TODO: do it correctly to_remove_pkg_files= # use workaround with eget: download and put in pkg_files __download_pkg_urls pkg_urls= } #__clean_downloaded_pkg_files() #{ # [ -z "$to_remove_pkg_files" ] && return # rm -fv $to_remove_pkg_files #} epm_download() { local CMD case $PMTYPE in dnf-rpm) sudocmd dnf download $pkg_filenames ;; aptcyg) sudocmd apt-cyg download $pkg_filenames ;; yum-rpm) # TODO: check yum install --downloadonly --downloaddir=/tmp <package-name> assure_exists yumdownloader yum-utils sudocmd yumdownloader $pkg_filenames ;; dnf-rpm) sudocmd dnf download $pkg_filenames ;; tce) sudocmd tce-load -w $pkg_filenames ;; *) fatal "Have no suitable command for $PMTYPE" ;; esac }