File: cpl-plugin-calib.postinst.in

package info (click to toggle)
cpl-plugin-giraf 2.16.7%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 8,248 kB
  • sloc: ansic: 61,815; sh: 4,372; python: 3,558; makefile: 361
file content (45 lines) | stat: -rw-r--r-- 912 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh

#set -o pipefail

PIPELINE=__PIPELINE__
VERSION=__VERSION__
SHASUM=__SHASUM__

CALIB=${PIPELINE}-calib-${VERSION}
COMPONENTS="${CALIB}/cal"
TARGETDIR="/usr/share/cpl-plugins/${PIPELINE}-${VERSION}"

downloaded=0

if [ "$1" = "configure" ] ; then
    mkdir -p ${TARGETDIR}

    for suffix in "" $(seq -f -%.0f 1 9) ; do

	KIT=${PIPELINE}-kit-${VERSION}${suffix}
	URL=ftp://ftp.eso.org/pub/dfs/pipelines/giraffe/${KIT}.tar.gz
	TAR=${KIT}/${CALIB}.tar.gz

	wget -O- ${URL} | tar xzC ${TARGETDIR} ${TAR}
	if [ ! $? = 0 ] ; then
	    rm -rf ${TARGETDIR}/${KIT}
	    continue
	fi
	if echo "${SHASUM} *${TARGETDIR}/${TAR}" | sha1sum -c --quiet - ; then
	    tar xzf ${TARGETDIR}/${TAR} -C ${TARGETDIR} ${COMPONENTS} --strip-components=1
	    rm -rf ${TARGETDIR}/${KIT}
	    downloaded=1
	    break
	fi
	rm -rf ${TARGETDIR}/${KIT}
    done
fi

if [ $downloaded = 0 ] ; then
    exit 1
fi

set -e

#DEBHELPER#