-
Notifications
You must be signed in to change notification settings - Fork 4
/
gnu_latest.sh
102 lines (96 loc) · 2.92 KB
/
gnu_latest.sh
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/usr/bin/env bash
##
# @file gnu_latest.sh
# @brief download and compile latest version of any GNU tool
# @author C Anderson
# @version 1.01
# @date 2015-06-01
##
# @brief gnu_latest download and make GNU tool
#
# n.b., best run from working directory such as /usr/src or ~/src
##
. include decho dprintf
# https://www.torproject.org/dist/torbrowser/4.5.3/tor-browser-linux64-4.5.3_en-US.tar.xz
download_and_make_install ()
{
local latesturl=$1 && shift
local app=
local latestfile=
if test -z "$app"; then
app=${latesturl##*/}
app=${app%%.*}
fi
if test -z "$latestfile"; then
latestfile=${latesturl##*/}
fi
dprintf "Latest URL: %s\n" "$latesturl"
(
rm -rf "$app.$$"
mkdir $app.$$ || exit 1
cd $app.$$ || exit 1
curl -L "$latesturl" -o "$latestfile"
tar -xvf "$latestfile"
# Find the directory that has been created
for fn in *; do
if test -d "$fn"; then
cd "$fn"
./configure "$@"
make install
fi
done
)
}
gnu_latest_make_install ()
{
local version
local app=$1 && shift
[[ $1 =~ \. ]] && version="-$1." && shift
local archiver=$1 && shift
local baseurl="http://ftp.gnu.org/gnu/$app";
dprintf "baseurl: %s\n" "$baseurl"
local dirurl="$baseurl/?C=M;O=D";
dprintf "dirurl: %s\n" "$dirurl"
# <tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]"></td>
# <td><a href="dico-latest.tar.xz.sig">dico-latest.tar.xz.sig</a></td>
# <td align="right">2012-03-04 09:19 </td><td align="right">189 </td>
# <td> </td></tr>
local result=$(
curl "$dirurl" \
| egrep -o '<a href[^<]+' \
| egrep -o '>.*\.tar\.[^.]+$' \
| head -n1 \
;
)
dprintf "result: " "$result"
local latestfile=${result:1}
archiver=${latestfile##*.} # We don't really care about since tar can
# automatically de-archive
local latesturl="${baseurl}/${latestfile}"
download_and_make_install "$latesturl"
}
##
# @brief gnu_latest_make_install @gnu_latest_make with install (requires root)
##
# gnu_latest_make_install ()
# {
# gnu_latest_make "$@" && make install
# }
##
# @brief gnu_latest_list Get list of GNU source packages available
gnu_latest_list ()
{
:
# <img src="/icons/folder.gif" alt="[DIR]" /> <a href="bc/">bc/</a> 02-Aug-2003 07:07 -
# <img src="/icons/folder.gif" alt="[DIR]" /> <a href="GNUsBulletins/">GNUsBulletins/</a> 24-Mar-2003 18:00
# <img src="/icons/unknown.gif" alt="[ ]" /> <a href="gnu-keyring.gpg">gnu-keyring.gpg</a> 01-Jun-2015 05:22 1.0M
}
gnu_latest_wget_install ()
{
cd /usr/src
gnu_latest_make_install gmp &&
gnu_latest_make_install nettle 2.7 && # http://comments.gmane.org/gmane.comp.encryption.gpg.gnutls.devel/7532 -- GnuTLS cannot be built against Nettle 3.0. You'll need to use nettle 2.7.
gnu-latest_make_install gnutls xz &&
gnu-latest-make_install wget "" --with-libgnutls-prefix=/usr/local &&
echo done
}