10seconds_install: If gpg missing: Read from </dev/tty. FreeBSD uses fetch.

This commit is contained in:
Ole Tange 2013-09-28 18:53:37 +02:00
parent 7ffba8f544
commit 7d4dc890a5
3 changed files with 16 additions and 5 deletions

View file

@ -14,12 +14,23 @@
# If that fails, it does a personal installation. # If that fails, it does a personal installation.
# If that fails, it copies to $HOME/bin # If that fails, it copies to $HOME/bin
# Download and run the script directly by:
# (wget -O - pi.dk/3 || curl pi.dk/3/ || fetch -o - http://pi.dk/3) | bash
# tail on openindiana must be /usr/xpg4/bin/tail # tail on openindiana must be /usr/xpg4/bin/tail
TAIL=$(echo | tail -n 1 2>/dev/null && echo tail || (echo | /usr/xpg4/bin/tail -n 1 && echo /usr/xpg4/bin/tail)) TAIL=$(echo | tail -n 1 2>/dev/null && echo tail || (echo | /usr/xpg4/bin/tail -n 1 && echo /usr/xpg4/bin/tail))
# grep on openindiana must be /usr/xpg4/bin/grep # grep on openindiana must be /usr/xpg4/bin/grep
GREP=$(echo | grep -vE . 2>/dev/null && echo grep || (echo | /usr/xpg4/bin/grep -vE . && echo /usr/xpg4/bin/grep)) GREP=$(echo | grep -vE . 2>/dev/null && echo grep || (echo | /usr/xpg4/bin/grep -vE . && echo /usr/xpg4/bin/grep))
# wget is not default on MacOS, so try curl # FreeBSD prefers 'fetch', MacOS prefers 'curl', Linux prefers 'wget'
GET=$(curl -h >/dev/null && echo curl -L || echo wget -qO -) GET=$(
(fetch -o /dev/null file:///bin/sh && echo fetch -o -) ||
(curl -h >/dev/null && echo curl -L) ||
(wget -h >/dev/null && echo wget -qO -) ||
echo 'No wget, curl, fetch: Please inform parallel@gnu.org what you use for downloading URLs' >&2
)
if test "$GET" = ""; then
exit 1
fi
LATEST=$($GET http://ftpmirror.gnu.org/parallel | perl -ne '/(parallel-\d{8})/ and print $1."\n"' | sort | $TAIL -n1) LATEST=$($GET http://ftpmirror.gnu.org/parallel | perl -ne '/(parallel-\d{8})/ and print $1."\n"' | sort | $TAIL -n1)
if test \! -d $LATEST/src/; then if test \! -d $LATEST/src/; then
@ -54,7 +65,7 @@ else
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 read YN </dev/tty
if test "$YN" = "n"; then if test "$YN" = "n"; then
# Stop # Stop
exit 2 exit 2

2
README
View file

@ -30,7 +30,7 @@ The 10 seconds installation will try do to a full installation; if
that fails, a personal installation; if that fails, a minimal that fails, a personal installation; if that fails, a minimal
installation. installation.
(wget -O - pi.dk/3 || curl pi.dk/3/) | bash (wget -O - pi.dk/3 || curl pi.dk/3/ || fetch -o - http://pi.dk/3) | bash
This will literally install faster than reading the rest of this This will literally install faster than reading the rest of this
document. document.

View file

@ -790,7 +790,7 @@ sub get_options_from_array {
sub parse_options { sub parse_options {
# Returns: N/A # Returns: N/A
# Defaults: # Defaults:
$Global::version = 20130922; $Global::version = 20130927;
$Global::progname = 'parallel'; $Global::progname = 'parallel';
$Global::infinity = 2**31; $Global::infinity = 2**31;
$Global::debug = 0; $Global::debug = 0;