mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-12-01 18:37:55 +00:00
52 lines
1.8 KiB
Plaintext
52 lines
1.8 KiB
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
# Copyright (C) 2013 Ole Tange and Free Software Foundation, Inc.
|
||
|
#
|
||
|
# This program is free software; you can redistribute it and/or modify
|
||
|
# it under the terms of the GNU General Public License as published by
|
||
|
# the Free Software Foundation; either version 3 of the License, or
|
||
|
# (at your option) any later version.
|
||
|
#
|
||
|
# This script downloads the latest version of GNU Parallel and
|
||
|
# installs it.
|
||
|
#
|
||
|
# It first tries to install it globally.
|
||
|
# If that fails, it does a personal installation.
|
||
|
# If that fails, it does copies to $HOME/bin
|
||
|
|
||
|
LATEST=$(wget -qO- http://ftpmirror.gnu.org/parallel | perl -ne '/(parallel-\d{8})/ and print $1."\n"' | sort | tail -n1)
|
||
|
test -d $LATEST/src/ || wget http://ftpmirror.gnu.org/parallel/parallel-latest.tar.bz2 -O - | bzip2 -dc | tar xvf -
|
||
|
cd $LATEST || exit 2
|
||
|
if ./configure && make && make install; then
|
||
|
echo GNU $LATEST installed globally
|
||
|
else
|
||
|
if ./configure --prefix=$HOME && make && make install; then
|
||
|
echo GNU $LATEST installed in $HOME/bin
|
||
|
else
|
||
|
mkdir -p $HOME/bin/;
|
||
|
chmod 755 src/*;
|
||
|
cp src/parallel src/sem src/sql src/niceload $HOME/bin;
|
||
|
echo GNU $LATEST copied to $HOME/bin
|
||
|
fi
|
||
|
|
||
|
# Is $HOME/bin already in $PATH?
|
||
|
if echo $PATH | grep $HOME/bin >/dev/null; then
|
||
|
# $HOME/bin is already in $PATH
|
||
|
true
|
||
|
else
|
||
|
# Add $HOME/bin to $PATH for both bash and csh
|
||
|
echo 'PATH=$PATH:$HOME/bin' >> $HOME/.bashrc
|
||
|
echo 'setenv PATH ${PATH}:${HOME}/bin' >> $HOME/.cshrc
|
||
|
fi
|
||
|
|
||
|
# Is $HOME/share/man already in $MANPATH?
|
||
|
if echo $MANPATH | grep $HOME/share/man >/dev/null; then
|
||
|
# $HOME/share/man is already in $MANPATH
|
||
|
true
|
||
|
else
|
||
|
# Add $HOME/share/man to $MANPATH for both bash and csh
|
||
|
echo 'MANPATH=$MANPATH:$HOME/share/man' >> $HOME/.bashrc
|
||
|
echo 'setenv MANPATH ${MANPATH}:${HOME}/share/man' >> $HOME/.cshrc
|
||
|
fi
|
||
|
fi
|