-
Notifications
You must be signed in to change notification settings - Fork 3
/
fetchsingular
executable file
·62 lines (55 loc) · 1.67 KB
/
fetchsingular
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh -e
#
# SingularInterface: A GAP interface to Singular
#
# Copyright of SingularInterface belongs to its developers.
# Please refer to the COPYRIGHT file for details.
#
# SPDX-License-Identifier: GPL-2.0-or-later
VERSION=4.1.2
PATCHLEVEL=p1
TARFILE=singular-$VERSION$PATCHLEVEL.tar.gz
URL=http://www.mathematik.uni-kl.de/ftp/pub/Math/Singular/SOURCES/4-1-2/$TARFILE
MD5=14a2966b652bcb020364c6824cd0de6d
mkdir -p singular
# Download
if [ -e $TARFILE ] ; then
echo "Checking for $TARFILE... found existing file, using that"
# TODO: add a checksum check?
elif command -v wget >/dev/null 2>&1 ; then
echo "Checking for $TARFILE... downloading with wget"
wget $URL
elif command -v curl >/dev/null 2>&1 ; then
echo "Checking for $TARFILE... downloading with curl"
curl -O $URL
else
echo "Checking for $TARFILE... not found and unable to download"
echo
echo "Please manually download the following file:"
echo " $URL"
echo "Put it into the SingularInterface directory and re-run this script."
exit 1
fi
# Verify checksum
echo "Verifying MD5 checksum of $TARFILE..."
if command -v md5 >/dev/null 2>&1 ; then
COMPUTED_MD5=`md5 $TARFILE`
elif command -v md5sum >/dev/null 2>&1 ; then
COMPUTED_MD5=`md5sum $TARFILE`
elif command -v openssl >/dev/null 2>&1 ; then
COMPUTED_MD5=`openssl md5 $TARFILE`
else
COMPUTED_MD5=skip
fi
case $COMPUTED_MD5 in
skip) echo " could not compute MD5 checksum, skipping test" ;;
*$MD5* ) echo " valid MD5 checksum" ;;
*) echo " invalid MD5 checksum, aborting"
exit 1
;;
esac
# Extract
tar xvf $TARFILE
# Move output to right place
rm -rf singular/src
mv singular-$VERSION singular/src