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-2021 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 0xFFFFFFF1 && gpg
--list-keys 0x88888888 ; then
77 keyserver1
=keys.gnupg.net
78 keyserver2
=pool.sks-keyservers.net
79 if gpg
--keyserver "$keyserver1" --recv-key 0xFFFFFFF1 ||
80 gpg
--keyserver "$keyserver2" --recv-key 0xFFFFFFF1 ; then
81 if gpg
--keyserver "$keyserver1" --recv-key 0x88888888 ||
82 gpg
--keyserver "$keyserver2" --recv-key 0x88888888; then
87 echo "Cannot fetch keyID 0x88888888, so the signature cannot be checked."
92 echo "Cannot fetch keyID 0xFFFFFFF1, so the signature cannot be checked."
99 echo "GnuPG (gpg) is not installed so the signature cannot be checked."
104 # Check signature - in case ftpmirror.gnu.org is compromised
106 if gpg
--with-fingerprint "$latest".
tar.bz2.sig
2>&1 |
107 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
108 # Source code signed by Ole Tange <ole@tange.dk>
109 # KeyID FFFFFFF1/88888888
112 # GnuPG signature failed
114 echo "The signature on $latest.tar.bz2 is wrong. This may indicate that a criminal has changed the code."
115 echo "THIS IS BAD AND THE CODE WILL NOT BE INSTALLED."
117 echo "See http://git.savannah.gnu.org/cgit/parallel.git/tree/README for other installation methods."
121 # GnuPG not installed or public keys not downloaded
122 echo "This means that if the code has been changed by criminals, you will not discover that!"
124 echo "Continue anyway? (y/n)"
126 if test "$YN" = "n"; then
135 bzip2 -dc "$latest".
tar.bz2 |
tar xf
-
136 cd "$latest" ||
exit 2
137 if .
/configure
&& make && make install; then
139 echo "GNU $latest installed globally"
141 if .
/configure
--prefix="$HOME" && make && make install; then
143 echo "GNU $latest installed in $HOME/bin"
145 mkdir
-p "$HOME"/bin
/;
147 cp src
/parallel src
/env_parallel
* src
/sem src
/sql src
/niceload src
/parcat
"$HOME"/bin
;
149 echo "GNU $latest copied to $HOME/bin"
152 # Is $HOME/bin already in $PATH?
153 if echo "$PATH" |
grep "$HOME"/bin
>/dev
/null
; then
154 # $HOME/bin is already in $PATH
157 # Add $HOME/bin to $PATH for both bash and csh
158 echo 'PATH=$PATH:$HOME/bin' >> "$HOME"/.bashrc
159 echo 'setenv PATH ${PATH}:${HOME}/bin' >> "$HOME"/.cshrc
162 # Is $HOME/share/man already in $MANPATH?
163 if echo "$MANPATH" |
grep "$HOME"/share
/man
>/dev
/null
; then
164 # $HOME/share/man is already in $MANPATH
167 # Add $HOME/share/man to $MANPATH for both bash and csh
168 echo 'export MANPATH=$MANPATH:$HOME/share/man' >> "$HOME"/.bashrc
169 echo 'setenv MANPATH ${MANPATH}:${HOME}/share/man' >> "$HOME"/.cshrc
174 # Make sure the whole script is downloaded before starting