Ticket #68: dohttp.4

File dohttp.4, 1.7 KB (added by eternaleye@…, 3 years ago)

Finally, a WORKING one!

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
24    if [[ -f "${2}.-PARTIAL-" ]] ; then
25        if [[ $(getfsize "${2}".-PARTIAL- ) -ge 123456 ]] ; then
26            einfo_unhooked "Attempting resume using ${2}.-PARTIAL-"
27        else
28            einfo_unhooked "Not attempting resume using ${2}.-PARTIAL- (too small)"
29            echo rm -f "${2}".-PARTIAL-
30            rm -f "${2}".-PARTIAL-
31        fi
32    fi
33
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
44else
45    echo /usr/bin/getdelta.sh "${1}" 1>&2
46    if /usr/bin/getdelta.sh "${1}" ; then
47        exit 0
48    else
49        rm -f "${2}"
50        exit 1
51    fi
52
53fi
54