|
Line
Link Here
|
| 0 |
-- bootstrap-bash_orig.sh |
0 |
++ bootstrap-bash.sh |
|
Lines 10-16
Link Here
|
| 10 |
|
10 |
|
| 11 |
if [ -z "$1" ] ; then |
11 |
if [ -z "$1" ] ; then |
| 12 |
echo "usage: ${0} <location>" > /dev/stderr |
12 |
echo "usage: ${0} <location>" > /dev/stderr |
| 13 |
exit -1 |
13 |
exit 255 |
| 14 |
fi |
14 |
fi |
| 15 |
|
15 |
|
| 16 |
mkdir -p "$1" |
16 |
mkdir -p "$1" |
|
Lines 20-25
Link Here
|
| 20 |
|
20 |
|
| 21 |
GENTOO_MIRRORS=${GENTOO_MIRRORS:="http://distfiles.gentoo.org/distfiles"} |
21 |
GENTOO_MIRRORS=${GENTOO_MIRRORS:="http://distfiles.gentoo.org/distfiles"} |
| 22 |
|
22 |
|
|
|
23 |
command_exists() { |
| 24 |
check_cmd="$1" |
| 25 |
command -v $check_cmd >/dev/null 2>&1 |
| 26 |
} |
| 27 |
|
| 28 |
same_file() { |
| 29 |
file1="$1" |
| 30 |
file2="$2" |
| 31 |
|
| 32 |
if [ "$(stat -c '%i%d' "$file1" "$file2" | sort -u | wc -l)" -eq 1 ]; then |
| 33 |
return 0 |
| 34 |
else |
| 35 |
return 1 |
| 36 |
fi |
| 37 |
} |
| 38 |
|
| 23 |
if [ ! -e bash-4.2.tar.gz ] ; then |
39 |
if [ ! -e bash-4.2.tar.gz ] ; then |
| 24 |
eerror() { echo "!!! $*" 1>&2; } |
40 |
eerror() { echo "!!! $*" 1>&2; } |
| 25 |
einfo() { echo "* $*"; } |
41 |
einfo() { echo "* $*"; } |
|
Lines 27-44
Link Here
|
| 27 |
if [ -z ${FETCH_COMMAND} ] ; then |
43 |
if [ -z ${FETCH_COMMAND} ] ; then |
| 28 |
# Try to find a download manager, we only deal with wget, |
44 |
# Try to find a download manager, we only deal with wget, |
| 29 |
# curl, FreeBSD's fetch and ftp. |
45 |
# curl, FreeBSD's fetch and ftp. |
| 30 |
if [ x$(type -t wget) == "xfile" ] ; then |
46 |
if command_exists wget; then |
| 31 |
FETCH_COMMAND="wget" |
47 |
FETCH_COMMAND="wget" |
| 32 |
[ $(wget -h) == *"--no-check-certificate"* ] && FETCH_COMMAND+=" --no-check-certificate" |
48 |
case "$(wget -h 2>&1)" in |
| 33 |
elif [ x$(type -t curl) == "xfile" ] ; then |
49 |
*"--no-check-certificate"*) |
|
|
50 |
FETCH_COMMAND="$FETCH_COMMAND --no-check-certificate" |
| 51 |
;; |
| 52 |
esac |
| 53 |
elif command_exists curl; then |
| 34 |
einfo "WARNING: curl doesn't fail when downloading fails, please check its output carefully!" |
54 |
einfo "WARNING: curl doesn't fail when downloading fails, please check its output carefully!" |
| 35 |
FETCH_COMMAND="curl -f -L -O" |
55 |
FETCH_COMMAND="curl -f -L -O" |
| 36 |
elif [ x$(type -t fetch) == "xfile" ] ; then |
56 |
elif command_exists fetch; then |
| 37 |
FETCH_COMMAND="fetch" |
57 |
FETCH_COMMAND="fetch" |
| 38 |
elif [ x$(type -t ftp) == "xfile" ] && |
58 |
elif command_exists ftp; then |
| 39 |
[ ${CHOST} != *-cygwin* || ! $(type -P ftp) -ef $(cygpath -S)/ftp ] ; then |
|
|
| 40 |
FETCH_COMMAND="ftp" |
59 |
FETCH_COMMAND="ftp" |
| 41 |
else |
60 |
case "${CHOST}" in |
|
|
61 |
*-cygwin*) |
| 62 |
if same_file "$(command -v ftp)" "$(cygpath -S)/ftp"; then |
| 63 |
FETCH_COMMAND='' |
| 64 |
fi |
| 65 |
;; |
| 66 |
esac |
| 67 |
fi |
| 68 |
if [ -z ${FETCH_COMMAND} ]; then |
| 42 |
eerror "no suitable download manager found (need wget, curl, fetch or ftp)" |
69 |
eerror "no suitable download manager found (need wget, curl, fetch or ftp)" |
| 43 |
eerror "could not download ${1##*/}" |
70 |
eerror "could not download ${1##*/}" |
| 44 |
eerror "download the file manually, and put it in ${PWD}" |
71 |
eerror "download the file manually, and put it in ${PWD}" |