10seconds_install: Support $HOME with space.

This commit is contained in:
Ole Tange 2020-10-26 20:41:00 +01:00
parent 01c59822f0
commit 09d0ee1c73
14 changed files with 45 additions and 44 deletions

View file

@ -55,11 +55,11 @@ run() {
latest=$($get http://ftpmirror.gnu.org/parallel | latest=$($get http://ftpmirror.gnu.org/parallel |
perl -ne '/.*(parallel-\d{8})/ and print $1."\n"' | perl -ne '/.*(parallel-\d{8})/ and print $1."\n"' |
perl -e 'print ((reverse sort <>)[0])') perl -e 'print ((reverse sort <>)[0])')
if test \! -e $latest.tar.bz2; then if test \! -e "$latest".tar.bz2; then
# Source tar does not exist # Source tar does not exist
rm -f $latest.tar.bz2 $latest.tar.bz2.sig rm -f "$latest".tar.bz2 "$latest".tar.bz2.sig
$get http://ftpmirror.gnu.org/parallel/$latest.tar.bz2 > $latest.tar.bz2 $get http://ftpmirror.gnu.org/parallel/"$latest".tar.bz2 > "$latest".tar.bz2
$get http://ftpmirror.gnu.org/parallel/$latest.tar.bz2.sig > $latest.tar.bz2.sig $get http://ftpmirror.gnu.org/parallel/"$latest".tar.bz2.sig > "$latest".tar.bz2.sig
fi fi
fetch_keys() { fetch_keys() {
@ -74,10 +74,10 @@ run() {
else else
keyserver1=keys.gnupg.net keyserver1=keys.gnupg.net
keyserver2=pool.sks-keyservers.net keyserver2=pool.sks-keyservers.net
if gpg --keyserver $keyserver1 --recv-key 0xFFFFFFF1 || if gpg --keyserver "$keyserver1" --recv-key 0xFFFFFFF1 ||
gpg --keyserver $keyserver2 --recv-key 0xFFFFFFF1 ; then gpg --keyserver "$keyserver2" --recv-key 0xFFFFFFF1 ; then
if gpg --keyserver $keyserver1 --recv-key 0x88888888 || if gpg --keyserver "$keyserver1" --recv-key 0x88888888 ||
gpg --keyserver $keyserver2 --recv-key 0x88888888; then gpg --keyserver "$keyserver2" --recv-key 0x88888888; then
# OK # OK
return 0 return 0
else else
@ -93,19 +93,19 @@ run() {
fi fi
else else
# GnuPG not installed # GnuPG not installed
echo echo
echo "GnuPG (gpg) is not installed so the signature cannot be checked." echo "GnuPG (gpg) is not installed so the signature cannot be checked."
return 1 return 1
fi fi
} }
# Check signature - in case ftpmirror.gnu.org is compromised # Check signature - in case ftpmirror.gnu.org is compromised
if fetch_keys; then if fetch_keys; then
if gpg --with-fingerprint $latest.tar.bz2.sig 2>&1 | if gpg --with-fingerprint "$latest".tar.bz2.sig 2>&1 |
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 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
# Source code signed by Ole Tange <ole@tange.dk> # Source code signed by Ole Tange <ole@tange.dk>
# KeyID FFFFFFF1/88888888 # KeyID FFFFFFF1/88888888
true true
else else
# GnuPG signature failed # GnuPG signature failed
echo echo
@ -114,57 +114,57 @@ run() {
echo echo
echo "See http://git.savannah.gnu.org/cgit/parallel.git/tree/README for other installation methods." echo "See http://git.savannah.gnu.org/cgit/parallel.git/tree/README for other installation methods."
exit 1 exit 1
fi fi
else else
# GnuPG not installed or public keys not downloaded # GnuPG not installed or public keys not downloaded
echo "This means that if the code has been changed by criminals, you will not discover that!" echo "This means that if the code has been changed by criminals, you will not discover that!"
echo echo
echo "Continue anyway? (y/n)" echo "Continue anyway? (y/n)"
read YN </dev/tty read YN </dev/tty
if test "$YN" = "n"; then if test "$YN" = "n"; then
# Stop # Stop
exit 2 exit 2
else else
# Continue # Continue
true true
fi fi
fi fi
bzip2 -dc $latest.tar.bz2 | tar xf - bzip2 -dc "$latest".tar.bz2 | tar xf -
cd $latest || exit 2 cd "$latest" || exit 2
if ./configure && make && make install; then if ./configure && make && make install; then
echo echo
echo GNU $latest installed globally echo "GNU $latest installed globally"
else else
if ./configure --prefix=$HOME && make && make install; then if ./configure --prefix="$HOME" && make && make install; then
echo echo
echo GNU $latest installed in $HOME/bin echo "GNU $latest installed in $HOME/bin"
else else
mkdir -p $HOME/bin/; mkdir -p "$HOME"/bin/;
chmod 755 src/*; chmod 755 src/*;
cp src/parallel src/env_parallel* src/sem src/sql src/niceload src/parcat $HOME/bin; cp src/parallel src/env_parallel* src/sem src/sql src/niceload src/parcat "$HOME"/bin;
echo echo
echo GNU $latest copied to $HOME/bin echo "GNU $latest copied to $HOME/bin"
fi fi
# Is $HOME/bin already in $PATH? # Is $HOME/bin already in $PATH?
if echo $PATH | grep $HOME/bin >/dev/null; then if echo "$PATH" | grep "$HOME"/bin >/dev/null; then
# $HOME/bin is already in $PATH # $HOME/bin is already in $PATH
true true
else else
# Add $HOME/bin to $PATH for both bash and csh # Add $HOME/bin to $PATH for both bash and csh
echo 'PATH=$PATH:$HOME/bin' >> $HOME/.bashrc echo 'PATH=$PATH:$HOME/bin' >> "$HOME"/.bashrc
echo 'setenv PATH ${PATH}:${HOME}/bin' >> $HOME/.cshrc echo 'setenv PATH ${PATH}:${HOME}/bin' >> "$HOME"/.cshrc
fi fi
# Is $HOME/share/man already in $MANPATH? # Is $HOME/share/man already in $MANPATH?
if echo $MANPATH | grep $HOME/share/man >/dev/null; then if echo "$MANPATH" | grep "$HOME"/share/man >/dev/null; then
# $HOME/share/man is already in $MANPATH # $HOME/share/man is already in $MANPATH
true true
else else
# Add $HOME/share/man to $MANPATH for both bash and csh # Add $HOME/share/man to $MANPATH for both bash and csh
echo 'MANPATH=$MANPATH:$HOME/share/man' >> $HOME/.bashrc echo 'export MANPATH=$MANPATH:$HOME/share/man' >> "$HOME"/.bashrc
echo 'setenv MANPATH ${MANPATH}:${HOME}/share/man' >> $HOME/.cshrc echo 'setenv MANPATH ${MANPATH}:${HOME}/share/man' >> "$HOME"/.cshrc
fi fi
fi fi
} }

View file

@ -25,7 +25,7 @@ https://zenodo.org/deposit/new
(*) Software (*) Software
(Reserve DOI) (Reserve DOI)
GNU Parallel 20xxxx22 ('Xxxx') GNU Parallel 20xxxx22 ('Xxxx')
Ole Tange Tange, Ole
https://orcid.org/0000-0002-6345-1437 https://orcid.org/0000-0002-6345-1437
Description Description
GNU Parallel is a general parallelizer to run multiple serial command line programs in parallel without changing them. GNU Parallel is a general parallelizer to run multiple serial command line programs in parallel without changing them.
@ -134,6 +134,7 @@ export YYYYMMDD=${YYYYMMDD:0:6}23
echo $YYYYMMDD echo $YYYYMMDD
perl -i -pe "/version/ and s/20\d\d\d\d\d\d/$YYYYMMDD/" src/parallel perl -i -pe "/version/ and s/20\d\d\d\d\d\d/$YYYYMMDD/" src/parallel
perl -i -pe "/version/ and s/20\d\d\d\d\d\d/$YYYYMMDD/" src/sql perl -i -pe "/version/ and s/20\d\d\d\d\d\d/$YYYYMMDD/" src/sql
perl -i -pe "/version/ and s/20\d\d\d\d\d\d/$YYYYMMDD/" src/env_parallel*
perl -i -pe "/version/ and s/20\d\d\d\d\d\d/$YYYYMMDD/" src/parsort perl -i -pe "/version/ and s/20\d\d\d\d\d\d/$YYYYMMDD/" src/parsort
perl -i -pe "/version/ and s/20\d\d\d\d\d\d/$YYYYMMDD/" src/niceload perl -i -pe "/version/ and s/20\d\d\d\d\d\d/$YYYYMMDD/" src/niceload

View file

@ -382,7 +382,7 @@ _parset_main() {
return 255 return 255
fi fi
if [ "$_parset_NAME" = "--version" ] ; then if [ "$_parset_NAME" = "--version" ] ; then
echo "parset 20201022 (GNU parallel `parallel --minversion 1`)" echo "parset 20201023 (GNU parallel `parallel --minversion 1`)"
echo "Copyright (C) 2007-2020 Ole Tange, http://ole.tange.dk and Free Software" echo "Copyright (C) 2007-2020 Ole Tange, http://ole.tange.dk and Free Software"
echo "Foundation, Inc." echo "Foundation, Inc."
echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>" echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>"

View file

@ -384,7 +384,7 @@ _parset_main() {
return 255 return 255
fi fi
if [ "$_parset_NAME" = "--version" ] ; then if [ "$_parset_NAME" = "--version" ] ; then
echo "parset 20201022 (GNU parallel `parallel --minversion 1`)" echo "parset 20201023 (GNU parallel `parallel --minversion 1`)"
echo "Copyright (C) 2007-2020 Ole Tange, http://ole.tange.dk and Free Software" echo "Copyright (C) 2007-2020 Ole Tange, http://ole.tange.dk and Free Software"
echo "Foundation, Inc." echo "Foundation, Inc."
echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>" echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>"

View file

@ -382,7 +382,7 @@ _parset_main() {
return 255 return 255
fi fi
if [ "$_parset_NAME" = "--version" ] ; then if [ "$_parset_NAME" = "--version" ] ; then
echo "parset 20201022 (GNU parallel `parallel --minversion 1`)" echo "parset 20201023 (GNU parallel `parallel --minversion 1`)"
echo "Copyright (C) 2007-2020 Ole Tange, http://ole.tange.dk and Free Software" echo "Copyright (C) 2007-2020 Ole Tange, http://ole.tange.dk and Free Software"
echo "Foundation, Inc." echo "Foundation, Inc."
echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>" echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>"

View file

@ -365,7 +365,7 @@ _parset_main() {
return 255 return 255
fi fi
if [ "$_parset_NAME" = "--version" ] ; then if [ "$_parset_NAME" = "--version" ] ; then
echo "parset 20201022 (GNU parallel `parallel --minversion 1`)" echo "parset 20201023 (GNU parallel `parallel --minversion 1`)"
echo "Copyright (C) 2007-2020 Ole Tange, http://ole.tange.dk and Free Software" echo "Copyright (C) 2007-2020 Ole Tange, http://ole.tange.dk and Free Software"
echo "Foundation, Inc." echo "Foundation, Inc."
echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>" echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>"

View file

@ -368,7 +368,7 @@ _parset_main() {
return 255 return 255
fi fi
if [ "$_parset_NAME" = "--version" ] ; then if [ "$_parset_NAME" = "--version" ] ; then
echo "parset 20201022 (GNU parallel `parallel --minversion 1`)" echo "parset 20201023 (GNU parallel `parallel --minversion 1`)"
echo "Copyright (C) 2007-2020 Ole Tange, http://ole.tange.dk and Free Software" echo "Copyright (C) 2007-2020 Ole Tange, http://ole.tange.dk and Free Software"
echo "Foundation, Inc." echo "Foundation, Inc."
echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>" echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>"

View file

@ -382,7 +382,7 @@ _parset_main() {
return 255 return 255
fi fi
if [ "$_parset_NAME" = "--version" ] ; then if [ "$_parset_NAME" = "--version" ] ; then
echo "parset 20201022 (GNU parallel `parallel --minversion 1`)" echo "parset 20201023 (GNU parallel `parallel --minversion 1`)"
echo "Copyright (C) 2007-2020 Ole Tange, http://ole.tange.dk and Free Software" echo "Copyright (C) 2007-2020 Ole Tange, http://ole.tange.dk and Free Software"
echo "Foundation, Inc." echo "Foundation, Inc."
echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>" echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>"

View file

@ -83,7 +83,7 @@ else
# Make a tmpfile for the variable definitions + alias # Make a tmpfile for the variable definitions + alias
set _tMpaLLfILe=`_tempfile` set _tMpaLLfILe=`_tempfile`
foreach _vARnAmE ($_vARnAmES); foreach _vARnAmE ($_vARnAmES);
# These 3 lines break in csh version 20201022-3 # These 3 lines break in csh version 20201023-3
# if not defined: next # if not defined: next
eval if'(! $?'$_vARnAmE') continue' eval if'(! $?'$_vARnAmE') continue'
# if $#myvar <= 1 echo scalar_myvar=$var # if $#myvar <= 1 echo scalar_myvar=$var

View file

@ -359,7 +359,7 @@ _parset_main() {
return 255 return 255
fi fi
if [ "$_parset_NAME" = "--version" ] ; then if [ "$_parset_NAME" = "--version" ] ; then
echo "parset 20201022 (GNU parallel `parallel --minversion 1`)" echo "parset 20201023 (GNU parallel `parallel --minversion 1`)"
echo "Copyright (C) 2007-2020 Ole Tange, http://ole.tange.dk and Free Software" echo "Copyright (C) 2007-2020 Ole Tange, http://ole.tange.dk and Free Software"
echo "Foundation, Inc." echo "Foundation, Inc."
echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>" echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>"

View file

@ -23,7 +23,7 @@
use strict; use strict;
use Getopt::Long; use Getopt::Long;
$Global::progname="niceload"; $Global::progname="niceload";
$Global::version = 20201022; $Global::version = 20201023;
Getopt::Long::Configure("bundling","require_order"); Getopt::Long::Configure("bundling","require_order");
get_options_from_array(\@ARGV) || die_usage(); get_options_from_array(\@ARGV) || die_usage();
if($opt::version) { if($opt::version) {

View file

@ -2164,7 +2164,7 @@ sub check_invalid_option_combinations() {
sub init_globals() { sub init_globals() {
# Defaults: # Defaults:
$Global::version = 20201022; $Global::version = 20201023;
$Global::progname = 'parallel'; $Global::progname = 'parallel';
$::name = "GNU Parallel"; $::name = "GNU Parallel";
$Global::infinity = 2**31; $Global::infinity = 2**31;

View file

@ -118,7 +118,7 @@ GetOptions(
"help" => \$opt::dummy, "help" => \$opt::dummy,
) || exit(255); ) || exit(255);
$Global::progname = ($0 =~ m:(^|/)([^/]+)$:)[1]; $Global::progname = ($0 =~ m:(^|/)([^/]+)$:)[1];
$Global::version = 20201022; $Global::version = 20201023;
if($opt::version) { version(); exit 0; } if($opt::version) { version(); exit 0; }
@Global::sortoptions = @ARGV_before[0..($#ARGV_before-$#ARGV-1)]; @Global::sortoptions = @ARGV_before[0..($#ARGV_before-$#ARGV-1)];
#if($opt::zero_terminated) { $/ = "\0"; } #if($opt::zero_terminated) { $/ = "\0"; }

View file

@ -574,7 +574,7 @@ $Global::Initfile && unlink $Global::Initfile;
exit ($err); exit ($err);
sub parse_options { sub parse_options {
$Global::version = 20201022; $Global::version = 20201023;
$Global::progname = 'sql'; $Global::progname = 'sql';
# This must be done first as this may exec myself # This must be done first as this may exec myself