Ticket #68: dohttp.5

File dohttp.5, 2.6 KB (added by meka, 3 years ago)

Added USE_GETDELTA. Currently, gentdelta downloads everything to /usr/portage/distfiles, so sync trough tar+http doesn't work. Put something like if [ ! -z "${PN}"]; then; export USE_GETDELTA="yes"; fi to fix this.

Line 
1#!/bin/bash
2# vim: set sw=4 sts=4 et :
3
4# Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
5#
6# This file is part of the Paludis package manager. Paludis is free software;
7# you can redistribute it and/or modify it under the terms of the GNU General
8# Public License, version 2, as published by the Free Software Foundation.
9#
10# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
11# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
13# details.
14#
15# You should have received a copy of the GNU General Public License along with
16# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
17# Place, Suite 330, Boston, MA  02111-1307  USA
18
19export PATH="$(${PALUDIS_EBUILD_DIR}/utils/canonicalise ${PALUDIS_EBUILD_DIR}/utils/ ):${PATH}"
20source ${PALUDIS_EBUILD_DIR}/echo_functions.bash
21
22if [[ -n "${PALUDIS_USE_SAFE_RESUME}" ]] ; then
23    if [[ -f "${2}.-PARTIAL-" ]] ; then
24        if [[ $(getfsize "${2}".-PARTIAL- ) -ge 123456 ]] ; then
25            einfo_unhooked "Attempting resume using ${2}.-PARTIAL-"
26        else
27            einfo_unhooked "Not attempting resume using ${2}.-PARTIAL- (too small)"
28            echo rm -f "${2}".-PARTIAL-
29            rm -f "${2}".-PARTIAL-
30        fi
31    fi
32
33    if [ "$USE_GETDELTA" == "yes" ]; then
34        echo /usr/bin/getdelta-paludis.sh "${1}" 1>&2
35        if /usr/bin/getdelta-paludis.sh "${1}" ; then
36            echo mv -f "${2}".-PARTIAL- "${2}"
37            mv -f "${2}".-PARTIAL- "${2}" >&/dev/null
38            exit 0
39        else
40            rm -f "${2}"
41            exit 1
42        fi
43    else
44        echo ${WGET_WRAPPER} ${LOCAL_WGET:-wget} ${EXTRA_WGET} -T 30 -t 1 --continue -O "${2}".-PARTIAL- "${1}" 1>&2
45        if ${WGET_WRAPPER} ${LOCAL_WGET:-wget} ${EXTRA_WGET} -T 30 -t 1 --continue -O "${2}".-PARTIAL- "${1}" ; then
46            echo mv -f "${2}".-PARTIAL- "${2}"
47            mv -f "${2}".-PARTIAL- "${2}"
48            exit 0
49        else
50            rm -f "${2}"
51            exit 1
52        fi
53    fi
54else
55    if [ "$USE_GETDELTA" == "yes" ]; then
56        echo /usr/bin/getdelta.sh "${1}" 1>&2
57        if /usr/bin/getdelta.sh "${1}" ; then
58            exit 0
59        else
60            rm -f "${2}"
61            exit 1
62        fi
63    else
64        echo ${WGET_WRAPPER} ${LOCAL_WGET:-wget} ${EXTRA_WGET} -T 30 -t 1 -O "${2}" "${1}" 1>&2
65        if ${WGET_WRAPPER} ${LOCAL_WGET:-wget} ${EXTRA_WGET} -T 30 -t 1 -O "${2}" "${1}" ; then
66            exit 0
67        else
68            rm -f "${2}"
69            exit 1
70        fi
71    fi
72fi
73