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 0xFFFFFFF1 && gpg
--list-keys 0x88888888 ; then
77 keyservers
="keyserver.ubuntu.com
82 for keyserver
in $keyservers ; do
83 if gpg
--keyserver "$keyserver" --recv-key 0xFFFFFFF1 &&
84 gpg
--keyserver "$keyserver" --recv-key 0x88888888 ; then
90 echo "Cannot fetch keyID 0x88888888, so the signature cannot be checked."
96 echo "GnuPG (gpg) is not installed so the signature cannot be checked."
101 # Check signature - in case ftpmirror.gnu.org is compromised
103 if gpg
--with-fingerprint "$latest".
tar.bz2.sig
2>&1 |
104 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
105 # Source code signed by Ole Tange <ole@tange.dk>
106 # KeyID FFFFFFF1/88888888
109 # GnuPG signature failed
111 echo "The signature on $latest.tar.bz2 is wrong. This may indicate that a criminal has changed the code."
112 echo "THIS IS BAD AND THE CODE WILL NOT BE INSTALLED."
114 echo "See http://git.savannah.gnu.org/cgit/parallel.git/tree/README for other installation methods."
118 # GnuPG not installed or public keys not downloaded
119 echo "This means that if the code has been changed by criminals, you will not discover that!"
121 echo "Continue anyway? (y/n)"
123 if test "$YN" = "n"; then
132 bzip2 -dc "$latest".
tar.bz2 |
tar xf
-
133 cd "$latest" ||
exit 2
134 if .
/configure
&& make && make install; then
136 echo "GNU $latest installed globally"
138 if .
/configure
--prefix="$HOME" && make && make install; then
140 echo "GNU $latest installed in $HOME/bin"
142 mkdir
-p "$HOME"/bin
/;
144 cp src
/parallel src
/env_parallel
* src
/sem src
/sql src
/niceload src
/parcat
"$HOME"/bin
;
146 echo "GNU $latest copied to $HOME/bin"
149 # Is $HOME/bin already in $PATH?
150 if echo "$PATH" |
grep "$HOME"/bin
>/dev
/null
; then
151 # $HOME/bin is already in $PATH
154 # Add $HOME/bin to $PATH for both bash and csh
155 echo 'PATH=$PATH:$HOME/bin' >> "$HOME"/.bashrc
156 echo 'setenv PATH ${PATH}:${HOME}/bin' >> "$HOME"/.cshrc
159 # Is $HOME/share/man already in $MANPATH?
160 if echo "$MANPATH" |
grep "$HOME"/share
/man
>/dev
/null
; then
161 # $HOME/share/man is already in $MANPATH
164 # Add $HOME/share/man to $MANPATH for both bash and csh
165 echo 'export MANPATH=$MANPATH:$HOME/share/man' >> "$HOME"/.bashrc
166 echo 'setenv MANPATH ${MANPATH}:${HOME}/share/man' >> "$HOME"/.cshrc
171 # Make sure the whole script is downloaded before starting