-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathinstall_utils
33 lines (31 loc) · 1.36 KB
/
install_utils
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
# Copyright (C) 2001-2016 Quantum ESPRESSO group
# Copyright (C) 2017 Filippo Spiga
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License. See the file `License' in the root directory
# of the present distribution.
#
# Utilities
###########################################################
# Template function
# $(1) = package name
# $(2) = package URL
# $(3) = directory name
# $(4) = plugin/code name
###########################################################
define download_and_unpack
@(if test ! -s ../archive/`echo "$(2)" | sed 's/.*\///;s/.*=//'` && test ! -e ../$(3) ; then \
wget -O ../archive/`echo "$(2)" | sed 's/.*\///;s/.*=//'` $(2) > /dev/null 2>&1; \
if test "`echo $$?`" -ne "0" ; then \
curl -o ../archive/`echo "$(2)" | sed 's/.*\///;s/.*=//'` $(2) > /dev/null 2>&1; \
if test "`echo $$?`" -ne "0" ; then \
echo "*** Unable to download $(4). Test whether curl or wget is installed and working," ; \
echo "*** if you have direct access to internet. If not, copy into archive/ the file" ; \
echo "*** located here $(2)" ; \
exit 1 ; fi ; fi ; fi)
if test ! -e ../$(3); then \
(gzip -dc ../archive/`echo "$(2)" | sed 's/.*\///;s/.*=//'` | \
(cd ../ ; tar -xvf - ; ln -s $(1) $(3)) ) ; fi
endef