5 This script downloads the latest version of GNU Parallel, checks
6 the signature and installs it.
8 <p> It first tries to install it globally.
9 <br> If that fails, it does a personal installation.
10 <br> If that fails, it copies to $HOME/bin
12 <p> You can download and run the script directly by:
14 <p> $ (wget -O - pi.dk/3 || lynx -source pi.dk/3 ||
15 curl pi.dk/3/ || fetch -o - http://pi.dk/3) > install.sh
16 <br> $ sha1sum install.sh | grep 12345678
17 <br> $ md5sum install.sh
18 <br> $ sha512sum install.sh
20 <p> Check the sums from https://gnu.org/s/parallel/checksums
29 # SPDX-FileCopyrightText: 2013-2022 Ole Tange, http://ole.tange.dk and Free Software and Foundation, Inc.
31 # SPDX-License-Identifier: GPL-3.0-or-later
33 # This program is free software; you can redistribute it and/or
34 # modify it under the terms of the GNU General Public License as
35 # published by the Free Software Foundation; either version 3 of
36 # the License, or (at your option) any later version.
39 # FreeBSD prefers 'fetch', MacOS prefers 'curl', Linux prefers 'wget'
41 (lynx
-source /dev
/null
&& echo lynx
-source) ||
42 (fetch
-o /dev
/null
file:///bin
/sh
&& echo fetch
-o -) ||
43 (curl
-h >/dev
/null
&& echo curl
-L) ||
44 (wget
-h >/dev
/null
&& echo wget
-qO -) ||
45 echo 'No lynx, wget, curl, fetch: Please inform parallel@gnu.org what you use for downloading URLs' >&2
47 if test "$get" = ""; then
52 echo No perl installed. GNU Parallel depends on perl. Install perl and retry.
57 latest
=$
($get http
://ftpmirror.gnu.org
/parallel |
58 perl
-ne '/.*(parallel-\d{8})/ and print $1."\n"' |
59 perl
-e 'print ((reverse sort <>)[0])')
60 if test \
! -e "$latest".
tar.bz2
; then
61 # Source tar does not exist
62 rm -f "$latest".
tar.bz2
"$latest".
tar.bz2.sig
63 $get http
://ftpmirror.gnu.org
/parallel
/"$latest".
tar.bz2
> "$latest".
tar.bz2
64 $get http
://ftpmirror.gnu.org
/parallel
/"$latest".
tar.bz2.sig
> "$latest".
tar.bz2.sig
68 if gpg
-h 2>/dev
/null
>/dev
/null
; then
70 # Setup .gnupg/gpg.conf if not already done
71 echo | gpg
2>/dev
/null
>/dev
/null
72 if gpg
--list-keys 0x2C6229E2FFFFFFF1 && gpg
--list-keys 0xD1AB451688888888 ; then
77 keyservers
="keyserver.ubuntu.com
81 for keyserver
in $keyservers ; do
82 if gpg
--keyserver "$keyserver" --recv-key 0x2C6229E2FFFFFFF1 &&
83 gpg
--keyserver "$keyserver" --recv-key 0xD1AB451688888888 ; then
89 echo "Cannot fetch keyID 0xD1AB451688888888, so the signature cannot be checked."
95 echo "GnuPG (gpg) is not installed so the signature cannot be checked."
100 # Check signature - in case ftpmirror.gnu.org is compromised
102 if gpg
--with-fingerprint "$latest".
tar.bz2.sig
2>&1 |
103 perl
-e 'exit not grep /^Primary key fingerprint: BE9C B493 81DE 3166 A3BC..66C1 2C62 29E2 FFFF FFF1|^Primary key fingerprint: CDA0 1A42 08C4 F745 0610..7E7B D1AB 4516 8888 8888/, <>'; then
104 # Source code signed by Ole Tange <ole@tange.dk>
105 # KeyID 0x2C6229E2FFFFFFF1/0xD1AB451688888888
108 # GnuPG signature failed
110 echo "The signature on $latest.tar.bz2 is wrong. This may indicate that a criminal has changed the code."
111 echo "THIS IS BAD AND THE CODE WILL NOT BE INSTALLED."
113 echo "See http://git.savannah.gnu.org/cgit/parallel.git/tree/README for other installation methods."
117 # GnuPG not installed or public keys not downloaded
118 echo "This means that if the code has been changed by criminals, you will not discover that!"
120 echo "Continue anyway? (y/n)"
122 if test "$YN" = "n"; then
131 bzip2 -dc "$latest".
tar.bz2 |
tar xf
-
132 cd "$latest" ||
exit 2
133 if .
/configure
&& make && make install; then
135 echo "GNU $latest installed globally"
137 if .
/configure
--prefix="$HOME" && make && make install; then
139 echo "GNU $latest installed in $HOME/bin"
141 mkdir
-p "$HOME"/bin
/;
143 cp src
/parallel src
/env_parallel
* src
/sem src
/sql src
/niceload src
/parcat
"$HOME"/bin
;
145 echo "GNU $latest copied to $HOME/bin"
148 # Is $HOME/bin already in $PATH?
149 if echo "$PATH" |
grep "$HOME"/bin
>/dev
/null
; then
150 # $HOME/bin is already in $PATH
153 # Add $HOME/bin to $PATH for both bash and csh
154 echo 'PATH=$PATH:$HOME/bin' >> "$HOME"/.bashrc
155 echo 'setenv PATH ${PATH}:${HOME}/bin' >> "$HOME"/.cshrc
158 # Is $HOME/share/man already in $MANPATH?
159 if echo "$MANPATH" |
grep "$HOME"/share
/man
>/dev
/null
; then
160 # $HOME/share/man is already in $MANPATH
163 # Add $HOME/share/man to $MANPATH for both bash and csh
164 echo 'export MANPATH=$MANPATH:$HOME/share/man' >> "$HOME"/.bashrc
165 echo 'setenv MANPATH ${MANPATH}:${HOME}/share/man' >> "$HOME"/.cshrc
170 # Make sure the whole script is downloaded before starting