init
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,76 @@
|
||||
#!/bin/sh
|
||||
# sh is buggy on RS/6000 AIX 3.2. Replace above line with #!/bin/ksh
|
||||
|
||||
# Bzcmp/diff wrapped for bzip2,
|
||||
# adapted from zdiff by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
|
||||
|
||||
# Bzcmp and bzdiff are used to invoke the cmp or the diff pro-
|
||||
# gram on compressed files. All options specified are passed
|
||||
# directly to cmp or diff. If only 1 file is specified, then
|
||||
# the files compared are file1 and an uncompressed file1.gz.
|
||||
# If two files are specified, then they are uncompressed (if
|
||||
# necessary) and fed to cmp or diff. The exit status from cmp
|
||||
# or diff is preserved.
|
||||
|
||||
PATH="/usr/bin:/bin:$PATH"; export PATH
|
||||
prog=`echo $0 | sed 's|.*/||'`
|
||||
case "$prog" in
|
||||
*cmp) comp=${CMP-cmp} ;;
|
||||
*) comp=${DIFF-diff} ;;
|
||||
esac
|
||||
|
||||
OPTIONS=
|
||||
FILES=
|
||||
for ARG
|
||||
do
|
||||
case "$ARG" in
|
||||
-*) OPTIONS="$OPTIONS $ARG";;
|
||||
*) if test -f "$ARG"; then
|
||||
FILES="$FILES $ARG"
|
||||
else
|
||||
echo "${prog}: $ARG not found or not a regular file"
|
||||
exit 1
|
||||
fi ;;
|
||||
esac
|
||||
done
|
||||
if test -z "$FILES"; then
|
||||
echo "Usage: $prog [${comp}_options] file [file]"
|
||||
exit 1
|
||||
fi
|
||||
set $FILES
|
||||
if test $# -eq 1; then
|
||||
FILE=`echo "$1" | sed 's/.bz2$//'`
|
||||
bzip2 -cd "$FILE.bz2" | $comp $OPTIONS - "$FILE"
|
||||
STAT="$?"
|
||||
|
||||
elif test $# -eq 2; then
|
||||
case "$1" in
|
||||
*.bz2)
|
||||
case "$2" in
|
||||
*.bz2)
|
||||
F=`echo "$2" | sed 's|.*/||;s|.bz2$||'`
|
||||
tmp=`mktemp "${TMPDIR:-/tmp}"/bzdiff.XXXXXXXXXX` || {
|
||||
echo 'cannot create a temporary file' >&2
|
||||
exit 1
|
||||
}
|
||||
bzip2 -cdfq "$2" > "$tmp"
|
||||
bzip2 -cdfq "$1" | $comp $OPTIONS - "$tmp"
|
||||
STAT="$?"
|
||||
/bin/rm -f "$tmp";;
|
||||
|
||||
*) bzip2 -cdfq "$1" | $comp $OPTIONS - "$2"
|
||||
STAT="$?";;
|
||||
esac;;
|
||||
*) case "$2" in
|
||||
*.bz2)
|
||||
bzip2 -cdfq "$2" | $comp $OPTIONS "$1" -
|
||||
STAT="$?";;
|
||||
*) $comp $OPTIONS "$1" "$2"
|
||||
STAT="$?";;
|
||||
esac;;
|
||||
esac
|
||||
else
|
||||
echo "Usage: $prog [${comp}_options] file [file]"
|
||||
exit 1
|
||||
fi
|
||||
exit "$STAT"
|
||||
@@ -0,0 +1,76 @@
|
||||
#!/bin/sh
|
||||
# sh is buggy on RS/6000 AIX 3.2. Replace above line with #!/bin/ksh
|
||||
|
||||
# Bzcmp/diff wrapped for bzip2,
|
||||
# adapted from zdiff by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
|
||||
|
||||
# Bzcmp and bzdiff are used to invoke the cmp or the diff pro-
|
||||
# gram on compressed files. All options specified are passed
|
||||
# directly to cmp or diff. If only 1 file is specified, then
|
||||
# the files compared are file1 and an uncompressed file1.gz.
|
||||
# If two files are specified, then they are uncompressed (if
|
||||
# necessary) and fed to cmp or diff. The exit status from cmp
|
||||
# or diff is preserved.
|
||||
|
||||
PATH="/usr/bin:/bin:$PATH"; export PATH
|
||||
prog=`echo $0 | sed 's|.*/||'`
|
||||
case "$prog" in
|
||||
*cmp) comp=${CMP-cmp} ;;
|
||||
*) comp=${DIFF-diff} ;;
|
||||
esac
|
||||
|
||||
OPTIONS=
|
||||
FILES=
|
||||
for ARG
|
||||
do
|
||||
case "$ARG" in
|
||||
-*) OPTIONS="$OPTIONS $ARG";;
|
||||
*) if test -f "$ARG"; then
|
||||
FILES="$FILES $ARG"
|
||||
else
|
||||
echo "${prog}: $ARG not found or not a regular file"
|
||||
exit 1
|
||||
fi ;;
|
||||
esac
|
||||
done
|
||||
if test -z "$FILES"; then
|
||||
echo "Usage: $prog [${comp}_options] file [file]"
|
||||
exit 1
|
||||
fi
|
||||
set $FILES
|
||||
if test $# -eq 1; then
|
||||
FILE=`echo "$1" | sed 's/.bz2$//'`
|
||||
bzip2 -cd "$FILE.bz2" | $comp $OPTIONS - "$FILE"
|
||||
STAT="$?"
|
||||
|
||||
elif test $# -eq 2; then
|
||||
case "$1" in
|
||||
*.bz2)
|
||||
case "$2" in
|
||||
*.bz2)
|
||||
F=`echo "$2" | sed 's|.*/||;s|.bz2$||'`
|
||||
tmp=`mktemp "${TMPDIR:-/tmp}"/bzdiff.XXXXXXXXXX` || {
|
||||
echo 'cannot create a temporary file' >&2
|
||||
exit 1
|
||||
}
|
||||
bzip2 -cdfq "$2" > "$tmp"
|
||||
bzip2 -cdfq "$1" | $comp $OPTIONS - "$tmp"
|
||||
STAT="$?"
|
||||
/bin/rm -f "$tmp";;
|
||||
|
||||
*) bzip2 -cdfq "$1" | $comp $OPTIONS - "$2"
|
||||
STAT="$?";;
|
||||
esac;;
|
||||
*) case "$2" in
|
||||
*.bz2)
|
||||
bzip2 -cdfq "$2" | $comp $OPTIONS "$1" -
|
||||
STAT="$?";;
|
||||
*) $comp $OPTIONS "$1" "$2"
|
||||
STAT="$?";;
|
||||
esac;;
|
||||
esac
|
||||
else
|
||||
echo "Usage: $prog [${comp}_options] file [file]"
|
||||
exit 1
|
||||
fi
|
||||
exit "$STAT"
|
||||
@@ -0,0 +1,85 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Bzgrep wrapped for bzip2,
|
||||
# adapted from zgrep by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
|
||||
## zgrep notice:
|
||||
## zgrep -- a wrapper around a grep program that decompresses files as needed
|
||||
## Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca>
|
||||
|
||||
PATH="/usr/bin:$PATH"; export PATH
|
||||
|
||||
prog=`echo $0 | sed 's|.*/||'`
|
||||
case "$prog" in
|
||||
*egrep) grep=${EGREP-egrep} ;;
|
||||
*fgrep) grep=${FGREP-fgrep} ;;
|
||||
*) grep=${GREP-grep} ;;
|
||||
esac
|
||||
pat=""
|
||||
while test $# -ne 0; do
|
||||
case "$1" in
|
||||
-e | -f) opt="$opt $1"; shift; pat="$1"
|
||||
if test "$grep" = grep; then # grep is buggy with -e on SVR4
|
||||
grep=egrep
|
||||
fi;;
|
||||
-A | -B) opt="$opt $1 $2"; shift;;
|
||||
-*) opt="$opt $1";;
|
||||
*) if test -z "$pat"; then
|
||||
pat="$1"
|
||||
else
|
||||
break;
|
||||
fi;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$pat"; then
|
||||
echo "grep through bzip2 files"
|
||||
echo "usage: $prog [grep_options] pattern [files]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
list=0
|
||||
silent=0
|
||||
op=`echo "$opt" | sed -e 's/ //g' -e 's/-//g'`
|
||||
case "$op" in
|
||||
*l*) list=1
|
||||
esac
|
||||
case "$op" in
|
||||
*h*) silent=1
|
||||
esac
|
||||
|
||||
if test $# -eq 0; then
|
||||
bzip2 -cdfq | $grep $opt "$pat"
|
||||
exit $?
|
||||
fi
|
||||
|
||||
res=0
|
||||
for i do
|
||||
if test -f "$i"; then :; else if test -f "$i.bz2"; then i="$i.bz2"; fi; fi
|
||||
if test $list -eq 1; then
|
||||
bzip2 -cdfq "$i" | $grep $opt "$pat" 2>&1 > /dev/null && echo $i
|
||||
r=$?
|
||||
elif test $# -eq 1 -o $silent -eq 1; then
|
||||
bzip2 -cdfq "$i" | $grep $opt "$pat"
|
||||
r=$?
|
||||
else
|
||||
j=$(echo "$i" | sed 's/\\/&&/g;s/|/\\&/g;s/&/\\&/g')
|
||||
j=`printf "%s" "$j" | tr '\n' ' '`
|
||||
# A trick adapted from
|
||||
# https://groups.google.com/forum/#!original/comp.unix.shell/x1345iu10eg/Nn1n-1r1uU0J
|
||||
# that has the same effect as the following bash code:
|
||||
# bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|"
|
||||
# r=${PIPESTATUS[1]}
|
||||
exec 3>&1
|
||||
eval `
|
||||
exec 4>&1 >&3 3>&-
|
||||
{
|
||||
bzip2 -cdfq "$i" 4>&-
|
||||
} | {
|
||||
$grep $opt "$pat" 4>&-; echo "r=$?;" >&4
|
||||
} | sed "s|^|${j}:|"
|
||||
`
|
||||
fi
|
||||
test "$r" -ne 0 && res="$r"
|
||||
done
|
||||
exit $res
|
||||
@@ -0,0 +1,85 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Bzgrep wrapped for bzip2,
|
||||
# adapted from zgrep by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
|
||||
## zgrep notice:
|
||||
## zgrep -- a wrapper around a grep program that decompresses files as needed
|
||||
## Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca>
|
||||
|
||||
PATH="/usr/bin:$PATH"; export PATH
|
||||
|
||||
prog=`echo $0 | sed 's|.*/||'`
|
||||
case "$prog" in
|
||||
*egrep) grep=${EGREP-egrep} ;;
|
||||
*fgrep) grep=${FGREP-fgrep} ;;
|
||||
*) grep=${GREP-grep} ;;
|
||||
esac
|
||||
pat=""
|
||||
while test $# -ne 0; do
|
||||
case "$1" in
|
||||
-e | -f) opt="$opt $1"; shift; pat="$1"
|
||||
if test "$grep" = grep; then # grep is buggy with -e on SVR4
|
||||
grep=egrep
|
||||
fi;;
|
||||
-A | -B) opt="$opt $1 $2"; shift;;
|
||||
-*) opt="$opt $1";;
|
||||
*) if test -z "$pat"; then
|
||||
pat="$1"
|
||||
else
|
||||
break;
|
||||
fi;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$pat"; then
|
||||
echo "grep through bzip2 files"
|
||||
echo "usage: $prog [grep_options] pattern [files]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
list=0
|
||||
silent=0
|
||||
op=`echo "$opt" | sed -e 's/ //g' -e 's/-//g'`
|
||||
case "$op" in
|
||||
*l*) list=1
|
||||
esac
|
||||
case "$op" in
|
||||
*h*) silent=1
|
||||
esac
|
||||
|
||||
if test $# -eq 0; then
|
||||
bzip2 -cdfq | $grep $opt "$pat"
|
||||
exit $?
|
||||
fi
|
||||
|
||||
res=0
|
||||
for i do
|
||||
if test -f "$i"; then :; else if test -f "$i.bz2"; then i="$i.bz2"; fi; fi
|
||||
if test $list -eq 1; then
|
||||
bzip2 -cdfq "$i" | $grep $opt "$pat" 2>&1 > /dev/null && echo $i
|
||||
r=$?
|
||||
elif test $# -eq 1 -o $silent -eq 1; then
|
||||
bzip2 -cdfq "$i" | $grep $opt "$pat"
|
||||
r=$?
|
||||
else
|
||||
j=$(echo "$i" | sed 's/\\/&&/g;s/|/\\&/g;s/&/\\&/g')
|
||||
j=`printf "%s" "$j" | tr '\n' ' '`
|
||||
# A trick adapted from
|
||||
# https://groups.google.com/forum/#!original/comp.unix.shell/x1345iu10eg/Nn1n-1r1uU0J
|
||||
# that has the same effect as the following bash code:
|
||||
# bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|"
|
||||
# r=${PIPESTATUS[1]}
|
||||
exec 3>&1
|
||||
eval `
|
||||
exec 4>&1 >&3 3>&-
|
||||
{
|
||||
bzip2 -cdfq "$i" 4>&-
|
||||
} | {
|
||||
$grep $opt "$pat" 4>&-; echo "r=$?;" >&4
|
||||
} | sed "s|^|${j}:|"
|
||||
`
|
||||
fi
|
||||
test "$r" -ne 0 && res="$r"
|
||||
done
|
||||
exit $res
|
||||
@@ -0,0 +1,85 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Bzgrep wrapped for bzip2,
|
||||
# adapted from zgrep by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
|
||||
## zgrep notice:
|
||||
## zgrep -- a wrapper around a grep program that decompresses files as needed
|
||||
## Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca>
|
||||
|
||||
PATH="/usr/bin:$PATH"; export PATH
|
||||
|
||||
prog=`echo $0 | sed 's|.*/||'`
|
||||
case "$prog" in
|
||||
*egrep) grep=${EGREP-egrep} ;;
|
||||
*fgrep) grep=${FGREP-fgrep} ;;
|
||||
*) grep=${GREP-grep} ;;
|
||||
esac
|
||||
pat=""
|
||||
while test $# -ne 0; do
|
||||
case "$1" in
|
||||
-e | -f) opt="$opt $1"; shift; pat="$1"
|
||||
if test "$grep" = grep; then # grep is buggy with -e on SVR4
|
||||
grep=egrep
|
||||
fi;;
|
||||
-A | -B) opt="$opt $1 $2"; shift;;
|
||||
-*) opt="$opt $1";;
|
||||
*) if test -z "$pat"; then
|
||||
pat="$1"
|
||||
else
|
||||
break;
|
||||
fi;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$pat"; then
|
||||
echo "grep through bzip2 files"
|
||||
echo "usage: $prog [grep_options] pattern [files]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
list=0
|
||||
silent=0
|
||||
op=`echo "$opt" | sed -e 's/ //g' -e 's/-//g'`
|
||||
case "$op" in
|
||||
*l*) list=1
|
||||
esac
|
||||
case "$op" in
|
||||
*h*) silent=1
|
||||
esac
|
||||
|
||||
if test $# -eq 0; then
|
||||
bzip2 -cdfq | $grep $opt "$pat"
|
||||
exit $?
|
||||
fi
|
||||
|
||||
res=0
|
||||
for i do
|
||||
if test -f "$i"; then :; else if test -f "$i.bz2"; then i="$i.bz2"; fi; fi
|
||||
if test $list -eq 1; then
|
||||
bzip2 -cdfq "$i" | $grep $opt "$pat" 2>&1 > /dev/null && echo $i
|
||||
r=$?
|
||||
elif test $# -eq 1 -o $silent -eq 1; then
|
||||
bzip2 -cdfq "$i" | $grep $opt "$pat"
|
||||
r=$?
|
||||
else
|
||||
j=$(echo "$i" | sed 's/\\/&&/g;s/|/\\&/g;s/&/\\&/g')
|
||||
j=`printf "%s" "$j" | tr '\n' ' '`
|
||||
# A trick adapted from
|
||||
# https://groups.google.com/forum/#!original/comp.unix.shell/x1345iu10eg/Nn1n-1r1uU0J
|
||||
# that has the same effect as the following bash code:
|
||||
# bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|"
|
||||
# r=${PIPESTATUS[1]}
|
||||
exec 3>&1
|
||||
eval `
|
||||
exec 4>&1 >&3 3>&-
|
||||
{
|
||||
bzip2 -cdfq "$i" 4>&-
|
||||
} | {
|
||||
$grep $opt "$pat" 4>&-; echo "r=$?;" >&4
|
||||
} | sed "s|^|${j}:|"
|
||||
`
|
||||
fi
|
||||
test "$r" -ne 0 && res="$r"
|
||||
done
|
||||
exit $res
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,61 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Bzmore wrapped for bzip2,
|
||||
# adapted from zmore by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
|
||||
|
||||
PATH="/usr/bin:$PATH"; export PATH
|
||||
|
||||
prog=`echo $0 | sed 's|.*/||'`
|
||||
case "$prog" in
|
||||
*less) more=less ;;
|
||||
*) more=more ;;
|
||||
esac
|
||||
|
||||
if test "`echo -n a`" = "-n a"; then
|
||||
# looks like a SysV system:
|
||||
n1=''; n2='\c'
|
||||
else
|
||||
n1='-n'; n2=''
|
||||
fi
|
||||
oldtty=`stty -g 2>/dev/null`
|
||||
if stty -cbreak 2>/dev/null; then
|
||||
cb='cbreak'; ncb='-cbreak'
|
||||
else
|
||||
# 'stty min 1' resets eof to ^a on both SunOS and SysV!
|
||||
cb='min 1 -icanon'; ncb='icanon eof ^d'
|
||||
fi
|
||||
if test $? -eq 0 && test -n "$oldtty"; then
|
||||
trap 'stty $oldtty 2>/dev/null; exit' 0 INT QUIT TRAP USR1 PIPE TERM
|
||||
else
|
||||
trap 'stty $ncb echo 2>/dev/null; exit' 0 INT QUIT TRAP USR1 PIPE TERM
|
||||
fi
|
||||
|
||||
if test $# = 0; then
|
||||
if test -t 0; then
|
||||
echo usage: $prog files...
|
||||
else
|
||||
bzip2 -cdfq | eval $more
|
||||
fi
|
||||
else
|
||||
FIRST=1
|
||||
for FILE
|
||||
do
|
||||
if test $FIRST -eq 0; then
|
||||
echo $n1 "--More--(Next file: $FILE)$n2"
|
||||
stty $cb -echo 2>/dev/null
|
||||
ANS=`dd bs=1 count=1 2>/dev/null`
|
||||
stty $ncb echo 2>/dev/null
|
||||
echo " "
|
||||
if test "$ANS" = 'e' || test "$ANS" = 'q'; then
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
if test "$ANS" != 's'; then
|
||||
echo "------> $FILE <------"
|
||||
bzip2 -cdfq "$FILE" | eval $more
|
||||
fi
|
||||
if test -t; then
|
||||
FIRST=0
|
||||
fi
|
||||
done
|
||||
fi
|
||||
@@ -0,0 +1,61 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Bzmore wrapped for bzip2,
|
||||
# adapted from zmore by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
|
||||
|
||||
PATH="/usr/bin:$PATH"; export PATH
|
||||
|
||||
prog=`echo $0 | sed 's|.*/||'`
|
||||
case "$prog" in
|
||||
*less) more=less ;;
|
||||
*) more=more ;;
|
||||
esac
|
||||
|
||||
if test "`echo -n a`" = "-n a"; then
|
||||
# looks like a SysV system:
|
||||
n1=''; n2='\c'
|
||||
else
|
||||
n1='-n'; n2=''
|
||||
fi
|
||||
oldtty=`stty -g 2>/dev/null`
|
||||
if stty -cbreak 2>/dev/null; then
|
||||
cb='cbreak'; ncb='-cbreak'
|
||||
else
|
||||
# 'stty min 1' resets eof to ^a on both SunOS and SysV!
|
||||
cb='min 1 -icanon'; ncb='icanon eof ^d'
|
||||
fi
|
||||
if test $? -eq 0 && test -n "$oldtty"; then
|
||||
trap 'stty $oldtty 2>/dev/null; exit' 0 INT QUIT TRAP USR1 PIPE TERM
|
||||
else
|
||||
trap 'stty $ncb echo 2>/dev/null; exit' 0 INT QUIT TRAP USR1 PIPE TERM
|
||||
fi
|
||||
|
||||
if test $# = 0; then
|
||||
if test -t 0; then
|
||||
echo usage: $prog files...
|
||||
else
|
||||
bzip2 -cdfq | eval $more
|
||||
fi
|
||||
else
|
||||
FIRST=1
|
||||
for FILE
|
||||
do
|
||||
if test $FIRST -eq 0; then
|
||||
echo $n1 "--More--(Next file: $FILE)$n2"
|
||||
stty $cb -echo 2>/dev/null
|
||||
ANS=`dd bs=1 count=1 2>/dev/null`
|
||||
stty $ncb echo 2>/dev/null
|
||||
echo " "
|
||||
if test "$ANS" = 'e' || test "$ANS" = 'q'; then
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
if test "$ANS" != 's'; then
|
||||
echo "------> $FILE <------"
|
||||
bzip2 -cdfq "$FILE" | eval $more
|
||||
fi
|
||||
if test -t; then
|
||||
FIRST=0
|
||||
fi
|
||||
done
|
||||
fi
|
||||
@@ -0,0 +1,252 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
# WARNING: do not edit!
|
||||
# Generated by Makefile from ../openssl-3.2.3/tools/c_rehash.in
|
||||
# Copyright 1999-2022 The OpenSSL Project Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
# this file except in compliance with the License. You can obtain a copy
|
||||
# in the file LICENSE in the source distribution or at
|
||||
# https://www.openssl.org/source/license.html
|
||||
|
||||
# Perl c_rehash script, scan all files in a directory
|
||||
# and add symbolic links to their hash values.
|
||||
|
||||
my $dir = "etc/ssl";
|
||||
my $prefix = "/mingw64";
|
||||
|
||||
my $errorcount = 0;
|
||||
my $openssl = $ENV{OPENSSL} || "openssl";
|
||||
my $pwd;
|
||||
my $x509hash = "-subject_hash";
|
||||
my $crlhash = "-hash";
|
||||
my $verbose = 0;
|
||||
my $symlink_exists=eval {symlink("",""); 1};
|
||||
my $removelinks = 1;
|
||||
|
||||
## Parse flags.
|
||||
while ( $ARGV[0] =~ /^-/ ) {
|
||||
my $flag = shift @ARGV;
|
||||
last if ( $flag eq '--');
|
||||
if ( $flag eq '-old') {
|
||||
$x509hash = "-subject_hash_old";
|
||||
$crlhash = "-hash_old";
|
||||
} elsif ( $flag eq '-h' || $flag eq '-help' ) {
|
||||
help();
|
||||
} elsif ( $flag eq '-n' ) {
|
||||
$removelinks = 0;
|
||||
} elsif ( $flag eq '-v' ) {
|
||||
$verbose++;
|
||||
}
|
||||
else {
|
||||
print STDERR "Usage error; try -h.\n";
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
|
||||
sub help {
|
||||
print "Usage: c_rehash [-old] [-h] [-help] [-v] [dirs...]\n";
|
||||
print " -old use old-style digest\n";
|
||||
print " -h or -help print this help text\n";
|
||||
print " -v print files removed and linked\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
eval "require Cwd";
|
||||
if (defined(&Cwd::getcwd)) {
|
||||
$pwd=Cwd::getcwd();
|
||||
} else {
|
||||
$pwd=`pwd`;
|
||||
chomp($pwd);
|
||||
}
|
||||
|
||||
# DOS/Win32 or Unix delimiter? Prefix our installdir, then search.
|
||||
my $path_delim = ($pwd =~ /^[a-z]\:/i) ? ';' : ':';
|
||||
$ENV{PATH} = "$prefix/bin" . ($ENV{PATH} ? $path_delim . $ENV{PATH} : "");
|
||||
|
||||
if (! -x $openssl) {
|
||||
my $found = 0;
|
||||
foreach (split /$path_delim/, $ENV{PATH}) {
|
||||
if (-x "$_/$openssl") {
|
||||
$found = 1;
|
||||
$openssl = "$_/$openssl";
|
||||
last;
|
||||
}
|
||||
}
|
||||
if ($found == 0) {
|
||||
print STDERR "c_rehash: rehashing skipped ('openssl' program not available)\n";
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (@ARGV) {
|
||||
@dirlist = @ARGV;
|
||||
} elsif ($ENV{SSL_CERT_DIR}) {
|
||||
@dirlist = split /$path_delim/, $ENV{SSL_CERT_DIR};
|
||||
} else {
|
||||
$dirlist[0] = "$dir/certs";
|
||||
}
|
||||
|
||||
if (-d $dirlist[0]) {
|
||||
chdir $dirlist[0];
|
||||
$openssl="$pwd/$openssl" if (!-x $openssl);
|
||||
chdir $pwd;
|
||||
}
|
||||
|
||||
foreach (@dirlist) {
|
||||
if (-d $_ ) {
|
||||
if ( -w $_) {
|
||||
hash_dir($_);
|
||||
} else {
|
||||
print "Skipping $_, can't write\n";
|
||||
$errorcount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
exit($errorcount);
|
||||
|
||||
sub copy_file {
|
||||
my ($src_fname, $dst_fname) = @_;
|
||||
|
||||
if (open(my $in, "<", $src_fname)) {
|
||||
if (open(my $out, ">", $dst_fname)) {
|
||||
print $out $_ while (<$in>);
|
||||
close $out;
|
||||
} else {
|
||||
warn "Cannot open $dst_fname for write, $!";
|
||||
}
|
||||
close $in;
|
||||
} else {
|
||||
warn "Cannot open $src_fname for read, $!";
|
||||
}
|
||||
}
|
||||
|
||||
sub hash_dir {
|
||||
my $dir = shift;
|
||||
my %hashlist;
|
||||
|
||||
print "Doing $dir\n";
|
||||
|
||||
if (!chdir $dir) {
|
||||
print STDERR "WARNING: Cannot chdir to '$dir', $!\n";
|
||||
return;
|
||||
}
|
||||
|
||||
opendir(DIR, ".") || print STDERR "WARNING: Cannot opendir '.', $!\n";
|
||||
my @flist = sort readdir(DIR);
|
||||
closedir DIR;
|
||||
if ( $removelinks ) {
|
||||
# Delete any existing symbolic links
|
||||
foreach (grep {/^[\da-f]+\.r{0,1}\d+$/} @flist) {
|
||||
if (-l $_) {
|
||||
print "unlink $_\n" if $verbose;
|
||||
unlink $_ || warn "Can't unlink $_, $!\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
FILE: foreach $fname (grep {/\.(pem|crt|cer|crl)$/} @flist) {
|
||||
# Check to see if certificates and/or CRLs present.
|
||||
my ($cert, $crl) = check_file($fname);
|
||||
if (!$cert && !$crl) {
|
||||
print STDERR "WARNING: $fname does not contain a certificate or CRL: skipping\n";
|
||||
next;
|
||||
}
|
||||
link_hash_cert($fname) if ($cert);
|
||||
link_hash_crl($fname) if ($crl);
|
||||
}
|
||||
|
||||
chdir $pwd;
|
||||
}
|
||||
|
||||
sub check_file {
|
||||
my ($is_cert, $is_crl) = (0,0);
|
||||
my $fname = $_[0];
|
||||
|
||||
open(my $in, "<", $fname);
|
||||
while(<$in>) {
|
||||
if (/^-----BEGIN (.*)-----/) {
|
||||
my $hdr = $1;
|
||||
if ($hdr =~ /^(X509 |TRUSTED |)CERTIFICATE$/) {
|
||||
$is_cert = 1;
|
||||
last if ($is_crl);
|
||||
} elsif ($hdr eq "X509 CRL") {
|
||||
$is_crl = 1;
|
||||
last if ($is_cert);
|
||||
}
|
||||
}
|
||||
}
|
||||
close $in;
|
||||
return ($is_cert, $is_crl);
|
||||
}
|
||||
|
||||
sub compute_hash {
|
||||
my $fh;
|
||||
if ( $^O eq "VMS" ) {
|
||||
# VMS uses the open through shell
|
||||
# The file names are safe there and list form is unsupported
|
||||
if (!open($fh, "-|", join(' ', @_))) {
|
||||
print STDERR "Cannot compute hash on '$fname'\n";
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!open($fh, "-|", @_)) {
|
||||
print STDERR "Cannot compute hash on '$fname'\n";
|
||||
return;
|
||||
}
|
||||
}
|
||||
return (<$fh>, <$fh>);
|
||||
}
|
||||
|
||||
# Link a certificate to its subject name hash value, each hash is of
|
||||
# the form <hash>.<n> where n is an integer. If the hash value already exists
|
||||
# then we need to up the value of n, unless its a duplicate in which
|
||||
# case we skip the link. We check for duplicates by comparing the
|
||||
# certificate fingerprints
|
||||
|
||||
sub link_hash_cert {
|
||||
link_hash($_[0], 'cert');
|
||||
}
|
||||
|
||||
# Same as above except for a CRL. CRL links are of the form <hash>.r<n>
|
||||
|
||||
sub link_hash_crl {
|
||||
link_hash($_[0], 'crl');
|
||||
}
|
||||
|
||||
sub link_hash {
|
||||
my ($fname, $type) = @_;
|
||||
my $is_cert = $type eq 'cert';
|
||||
|
||||
my ($hash, $fprint) = compute_hash($openssl,
|
||||
$is_cert ? "x509" : "crl",
|
||||
$is_cert ? $x509hash : $crlhash,
|
||||
"-fingerprint", "-noout",
|
||||
"-in", $fname);
|
||||
chomp $hash;
|
||||
$hash =~ s/^.*=// if !$is_cert;
|
||||
chomp $fprint;
|
||||
return if !$hash;
|
||||
$fprint =~ s/^.*=//;
|
||||
$fprint =~ tr/://d;
|
||||
my $suffix = 0;
|
||||
# Search for an unused hash filename
|
||||
my $crlmark = $is_cert ? "" : "r";
|
||||
while(exists $hashlist{"$hash.$crlmark$suffix"}) {
|
||||
# Hash matches: if fingerprint matches its a duplicate cert
|
||||
if ($hashlist{"$hash.$crlmark$suffix"} eq $fprint) {
|
||||
my $what = $is_cert ? 'certificate' : 'CRL';
|
||||
print STDERR "WARNING: Skipping duplicate $what $fname\n";
|
||||
return;
|
||||
}
|
||||
$suffix++;
|
||||
}
|
||||
$hash .= ".$crlmark$suffix";
|
||||
if ($symlink_exists) {
|
||||
print "link $fname -> $hash\n" if $verbose;
|
||||
symlink $fname, $hash || warn "Can't symlink, $!";
|
||||
} else {
|
||||
print "copy $fname -> $hash\n" if $verbose;
|
||||
copy_file($fname, $hash);
|
||||
}
|
||||
$hashlist{$hash} = $fprint;
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,135 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Copyright (C) 2003, 2005-2007, 2011, 2018-2023 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# Find a way to echo strings without interpreting backslash.
|
||||
if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then
|
||||
echo='echo'
|
||||
else
|
||||
if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then
|
||||
echo='printf %s\n'
|
||||
else
|
||||
echo_func () {
|
||||
cat <<EOT
|
||||
$*
|
||||
EOT
|
||||
}
|
||||
echo='echo_func'
|
||||
fi
|
||||
fi
|
||||
|
||||
# This script is primarily a shell function library. In order for
|
||||
# ". gettext.sh" to find it, we install it in $PREFIX/bin (that is usually
|
||||
# contained in $PATH), rather than in some other location such as
|
||||
# $PREFIX/share/sh-scripts or $PREFIX/share/gettext. In order to not violate
|
||||
# the Filesystem Hierarchy Standard when doing so, this script is executable.
|
||||
# Therefore it needs to support the standard --help and --version.
|
||||
if test -z "${ZSH_VERSION+set}"; then
|
||||
# zsh is not POSIX compliant: By default, while ". gettext.sh" is executed,
|
||||
# it sets $0 to "gettext.sh", defeating the purpose of this test. But
|
||||
# fortunately we know that when running under zsh, this script is always
|
||||
# being sourced, not executed, because hardly anyone is crazy enough to
|
||||
# install zsh as /bin/sh.
|
||||
case "$0" in
|
||||
gettext.sh | */gettext.sh | *\\gettext.sh)
|
||||
progname=$0
|
||||
package=gettext-runtime
|
||||
version=0.22.5
|
||||
# func_usage
|
||||
# outputs to stdout the --help usage message.
|
||||
func_usage ()
|
||||
{
|
||||
echo "GNU gettext shell script function library version $version"
|
||||
echo "Usage: . gettext.sh"
|
||||
}
|
||||
# func_version
|
||||
# outputs to stdout the --version message.
|
||||
func_version ()
|
||||
{
|
||||
echo "$progname (GNU $package) $version"
|
||||
echo "Copyright (C) 2003-2023 Free Software Foundation, Inc.
|
||||
License GPLv2+: GNU GPL version 2 or later <https://gnu.org/licenses/gpl.html>
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law."
|
||||
echo "Written by" "Bruno Haible"
|
||||
}
|
||||
if test $# = 1; then
|
||||
case "$1" in
|
||||
--help | --hel | --he | --h )
|
||||
func_usage; exit 0 ;;
|
||||
--version | --versio | --versi | --vers | --ver | --ve | --v )
|
||||
func_version; exit 0 ;;
|
||||
esac
|
||||
fi
|
||||
func_usage 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# eval_gettext MSGID
|
||||
# looks up the translation of MSGID and substitutes shell variables in the
|
||||
# result.
|
||||
eval_gettext () {
|
||||
gettext "$1" | (export PATH `envsubst --variables "$1"`; envsubst "$1")
|
||||
}
|
||||
|
||||
# eval_ngettext MSGID MSGID-PLURAL COUNT
|
||||
# looks up the translation of MSGID / MSGID-PLURAL for COUNT and substitutes
|
||||
# shell variables in the result.
|
||||
eval_ngettext () {
|
||||
ngettext "$1" "$2" "$3" | (export PATH `envsubst --variables "$1 $2"`; envsubst "$1 $2")
|
||||
}
|
||||
|
||||
# eval_pgettext MSGCTXT MSGID
|
||||
# looks up the translation of MSGID in the context MSGCTXT and substitutes
|
||||
# shell variables in the result.
|
||||
eval_pgettext () {
|
||||
gettext --context="$1" "$2" | (export PATH `envsubst --variables "$2"`; envsubst "$2")
|
||||
}
|
||||
|
||||
# eval_npgettext MSGCTXT MSGID MSGID-PLURAL COUNT
|
||||
# looks up the translation of MSGID / MSGID-PLURAL for COUNT in the context
|
||||
# MSGCTXT and substitutes shell variables in the result.
|
||||
eval_npgettext () {
|
||||
ngettext --context="$1" "$2" "$3" "$4" | (export PATH `envsubst --variables "$2 $3"`; envsubst "$2 $3")
|
||||
}
|
||||
|
||||
# Note: This use of envsubst is much safer than using the shell built-in 'eval'
|
||||
# would be.
|
||||
# 1) The security problem with Chinese translations that happen to use a
|
||||
# character such as \xe0\x60 is avoided.
|
||||
# 2) The security problem with malevolent translators who put in command lists
|
||||
# like "$(...)" or "`...`" is avoided.
|
||||
# 3) The translations can only refer to shell variables that are already
|
||||
# mentioned in MSGID or MSGID-PLURAL.
|
||||
#
|
||||
# Note: "export PATH" above is a dummy; this is for the case when
|
||||
# `envsubst --variables ...` returns nothing.
|
||||
#
|
||||
# Note: In eval_ngettext above, "$1 $2" means a string whose variables set is
|
||||
# the union of the variables set of "$1" and "$2".
|
||||
#
|
||||
# Note: The minimal use of backquote above ensures that trailing newlines are
|
||||
# not dropped, not from the gettext invocation and not from the value of any
|
||||
# shell variable.
|
||||
#
|
||||
# Note: Field splitting on the `envsubst --variables ...` result is desired,
|
||||
# since envsubst outputs the variables, separated by newlines. Pathname
|
||||
# wildcard expansion or tilde expansion has no effect here, since the words
|
||||
# output by "envsubst --variables ..." consist solely of alphanumeric
|
||||
# characters and underscore.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.ComponentModel.Annotations" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.1.0" newVersion="4.2.1.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,360 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Compares the currently installed Git for Windows against latest available
|
||||
# release. If versions differ, the bit matched installer is downloaded and run
|
||||
# when confirmation to do so is given.
|
||||
|
||||
|
||||
# Compare version strings
|
||||
# Prints -1, 0 or 1 to stdout
|
||||
|
||||
version_compare () {
|
||||
a="$1"
|
||||
b="$2"
|
||||
|
||||
while true
|
||||
do
|
||||
test -n "$b" || { echo 1; return; }
|
||||
test -n "$a" || { echo -1; return; }
|
||||
|
||||
# Get the first numbers (if any)
|
||||
a1="$(expr "$a" : '^\([0-9]*\)')"; a="${a#$a1}"
|
||||
b1="$(expr "$b" : '^\([0-9]*\)')"; b="${b#$b1}"
|
||||
|
||||
if test -z "$b1"
|
||||
then
|
||||
test -z "$a1" || { echo 1; return; }
|
||||
a1=0
|
||||
b1=0
|
||||
fi
|
||||
test -n "$a1" || { echo -1; return; }
|
||||
test $a1 -le $b1 || { echo 1; return; }
|
||||
test $b1 -le $a1 || { echo -1; return; }
|
||||
|
||||
# Skip non-numeric prefixes
|
||||
a1="$(expr "$a" : '^\([^0-9]\+\)')"; a="${a#$a1}"
|
||||
b1="$(expr "$b" : '^\([^0-9]\+\)')"; b="${b#$b1}"
|
||||
|
||||
case "$a1,$b1" in
|
||||
[.-]rc,[.-]rc) ;; # both are -rc versions
|
||||
[.-]rc,*) echo -1; return;;
|
||||
*,[.-]rc) echo 1; return;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
test "--test-version-compare" != "$*" || {
|
||||
test_version_compare () {
|
||||
result="$(version_compare "$1" "$2")"
|
||||
test "$3" = "$result" || {
|
||||
echo "version_compare $1 $2 returned $result instead of $3" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
result2="$(version_compare "$2" "$1")"
|
||||
test "$result2" = "$((-$3))" || {
|
||||
echo "version_compare $2 $1 returned $result2 instead of $((-$3))" >&2
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
test_version_compare 2.32.0.windows.1 2.32.1.windows.1 -1
|
||||
test_version_compare 2.32.1.windows.1 2.32.0.windows.1 1
|
||||
test_version_compare 2.32.1.vfs.0.0 2.32.0.windows.1 1
|
||||
test_version_compare 2.32.1.vfs.0.0 2.32.0.vfs.0.0 1
|
||||
test_version_compare 2.32.0.vfs.0.1 2.32.0.vfs.0.2 -1
|
||||
test_version_compare 2.32.0-rc0.windows.1 2.31.1.windows.1 1
|
||||
test_version_compare 2.32.0-rc2.windows.1 2.32.0.windows.1 -1
|
||||
test_version_compare 2.34.0.rc1.windows.1 2.33.1.windows.1 1
|
||||
test_version_compare 2.34.0.rc2.windows.1 2.34.0.windows.1 -1
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Counts how many Bash instances are running, apart from the current one (if
|
||||
# any: `git update-git-for-windows` might have been called from a CMD window,
|
||||
# in which case no Git Bash might be running at all).
|
||||
#
|
||||
# This is a little tricky, as the /usr/bin/sh process (as which `ps` reports the
|
||||
# process running this script) is an MSYS2 one, but the calling `git.exe`
|
||||
# process is a pure Win32 one. As a consequence, the former process' PPID will
|
||||
# be reported as 1 (!!!) and its PGID will refer to the latter, while the
|
||||
# latter's PGID will be identical to its PID and its PPID refers to the calling
|
||||
# Bash (or is 1, if `git.exe` was not called by an MSYS2 program).
|
||||
#
|
||||
# So we have to employ a little sed fu to parse `ps` output of the form:
|
||||
#
|
||||
# PID PPID PGID WINPID TTY UID STIME COMMAND
|
||||
# 19864 15640 19864 27996 pty0 4853009 15:58:05 /usr/bin/bash
|
||||
# 15640 1 15640 15640 ? 4853009 15:58:05 /usr/bin/mintty
|
||||
# 28128 13048 21176 28716 pty0 4853009 16:01:08 /usr/bin/ps
|
||||
# 13048 1 21176 13048 pty0 4853009 16:01:08 /usr/bin/sh
|
||||
# 21176 19864 21176 11996 pty0 4853009 16:01:08 /mingw64/bin/git
|
||||
#
|
||||
# Essentially, we are looking for the /usr/bin/sh line (in the example, PID
|
||||
# 13048), follow its PGID to the /mingw64/bin/git line (in the example, PID
|
||||
# 21176), and record the PPID of the latter as the pid of the current Bash, if
|
||||
# any. As we do not know in which order the `sh` and the `git` line appear, we
|
||||
# have to handle both orders.
|
||||
#
|
||||
# Then, we filter the `ps` output first by dropping the line with the current
|
||||
# Bash, then finally counting the remaining lines referring to a bash process.
|
||||
|
||||
count_other_bashes () {
|
||||
mypid=$$ && nl='\n *' && s=' *' && p='[1-9][0-9]*' &&
|
||||
mypid="$(ps | sed -n ":1;N;
|
||||
s/.*$nl$mypid$s$p$s\\($p\\) .*$nl\\1$s\\($p\\) .*/\\2/p;
|
||||
s/.*$nl\\($p\\)$s\\($p\\) .*$nl$mypid$s$p$s\\1 .*/\\2/p;
|
||||
b1")"
|
||||
ps |
|
||||
if test -z "$mypid"; then cat; else grep -v "^ *$mypid "; fi |
|
||||
grep ' /usr/bin/bash$' |
|
||||
wc -l
|
||||
}
|
||||
|
||||
# Write HTTP GET response to stdout and return error code. This is equivalent
|
||||
# to curl --fail, except that we output the response body to stderr in case of
|
||||
# an HTTP error status.
|
||||
http_get () {
|
||||
url=$1
|
||||
output=$(mktemp -t gfw-httpget-XXXXXXXX.txt)
|
||||
code=$(curl \
|
||||
--silent \
|
||||
--show-error \
|
||||
--output "$output" \
|
||||
--write-out '%{http_code}' \
|
||||
"$url") || return $?
|
||||
fdout=1
|
||||
ret=0
|
||||
if test "$code" -ge 400
|
||||
then
|
||||
fdout=2
|
||||
ret=22
|
||||
fi
|
||||
cat "$output" >&"$fdout"
|
||||
rm -f "$output"
|
||||
return "$ret"
|
||||
}
|
||||
|
||||
get_recently_seen() {
|
||||
if [ -f "$HOME"/.git-for-windows-updater ]; then
|
||||
git config -f "$HOME"/.git-for-windows-updater winUpdater.recentlySeenVersion
|
||||
else
|
||||
git config --global winUpdater.recentlySeenVersion
|
||||
fi
|
||||
}
|
||||
|
||||
set_recently_seen() {
|
||||
git config -f "$HOME"/.git-for-windows-updater winUpdater.recentlySeenVersion "$1"
|
||||
}
|
||||
|
||||
# The main function of this script
|
||||
|
||||
update_git_for_windows () {
|
||||
proxy=$(git config --get http.proxy)
|
||||
if test -n "$proxy"
|
||||
then
|
||||
export https_proxy="$proxy"
|
||||
echo "Using proxy server $https_proxy detected from git http.proxy" >&2
|
||||
fi
|
||||
|
||||
yn=
|
||||
use_gui=
|
||||
quiet=
|
||||
testing=
|
||||
while test $# -gt 0
|
||||
do
|
||||
case "$1" in
|
||||
-\?|--?\?|-h|--help) ;;
|
||||
-y|--yes) yn=y; shift; continue;;
|
||||
-g|--gui) use_gui=t; shift; continue;;
|
||||
--quiet) quiet=t; shift; continue;;
|
||||
--testing) testing=t; shift; continue;;
|
||||
*) echo "Unknown option: $1" >&2;;
|
||||
esac
|
||||
printf >&2 '%s\n%s\n\t%s\n\t%s\n' \
|
||||
"Usage: git update-git-for-windows [options]" \
|
||||
"Options:" \
|
||||
"-g, --gui Use GUI instead of terminal to prompt" \
|
||||
"-y, --yes Automatic yes to download and install prompt" \
|
||||
"Return code:" \
|
||||
" 0: no update available" \
|
||||
" 1: update available and user selected not to update" \
|
||||
" 2: update available and it was started"
|
||||
return 1
|
||||
done
|
||||
|
||||
case "$(uname -m)" in
|
||||
x86_64) bit=64;;
|
||||
*) bit=32;;
|
||||
esac
|
||||
|
||||
try_toast=
|
||||
test -z "$use_gui" ||
|
||||
case "$(uname -s)" in
|
||||
*-6.[23]|*-6.[23]-[1-9]*|*-10.0|*-10.0-[1-9]*)
|
||||
# Only try to show a Toast notification on Windows 8 & 10,
|
||||
# and only if we have a working wintoast.exe
|
||||
! type wintoast.exe >/dev/null 2>&1 ||
|
||||
try_toast=t
|
||||
;;
|
||||
esac
|
||||
|
||||
test -f "$0.config" &&
|
||||
fork="$(git config -f "$0.config" update.fromFork)" &&
|
||||
test -n "$fork" ||
|
||||
fork=
|
||||
|
||||
if test -n "$fork"
|
||||
then
|
||||
git_label="$(git config -f "$0.config" update.gitLabel)"
|
||||
test -n "$git_label" || git_label=Git
|
||||
|
||||
releases_url=https://api.github.com/repos/$fork/releases
|
||||
latest_tag_url=$releases_url/latest
|
||||
latest_eval='latest=${latest_tag#*\"tag_name\": \"v}; latest=${latest%%\"*}'
|
||||
else
|
||||
git_label="Git for Windows"
|
||||
releases_url=https://api.github.com/repos/git-for-windows/git/releases
|
||||
latest_tag_url=https://gitforwindows.org/latest-tag.txt
|
||||
latest_eval='latest=${latest_tag#v}'
|
||||
fi
|
||||
|
||||
latest_tag=$(http_get $latest_tag_url) ||
|
||||
case $?,"$proxy" in
|
||||
7,)
|
||||
proxy="$(proxy-lookup.exe https://gitforwindows.org)" &&
|
||||
test -n "$proxy" &&
|
||||
export https_proxy="$proxy" &&
|
||||
echo "Using proxy $https_proxy as per lookup" >&2 &&
|
||||
latest_tag=$(http_get $latest_tag_url) ||
|
||||
return
|
||||
;;
|
||||
*)
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
eval "$latest_eval"
|
||||
# Be extra careful to remove a leading 'v' from the tag.
|
||||
latest=${latest#v}
|
||||
|
||||
# Did we ask about this version already?
|
||||
if test -z "$use_recently_seen"
|
||||
then
|
||||
recently_seen="$(get_recently_seen)"
|
||||
test -n "$quiet" && test "x$recently_seen" = "x$latest" && return
|
||||
fi
|
||||
|
||||
version=$(git --version | sed "s/git version //")
|
||||
if test -d /clangarm64/bin
|
||||
then
|
||||
arch_bit=arm64
|
||||
else
|
||||
arch_bit=${bit}-bit
|
||||
fi
|
||||
|
||||
echo "$git_label $version ($arch_bit)" >&2
|
||||
if test -z "$testing" && test "$latest" = "$version"
|
||||
then
|
||||
echo "Up to date" >&2
|
||||
set_recently_seen "$latest"
|
||||
return
|
||||
fi
|
||||
if ! test -n "$testing"
|
||||
then
|
||||
# We are not testing and we don't have exact equality,
|
||||
# so do a careful comparison and look to see if the
|
||||
# latest release is strictly newer than ours.
|
||||
if test 0 -lt "$(version_compare "$version" "$latest")"
|
||||
then
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Update $latest is available" >&2
|
||||
releases=$(http_get $releases_url/latest) || return
|
||||
download=$(echo "$releases" |
|
||||
grep '"browser_download_url": "' |
|
||||
grep "$arch_bit\.exe" |
|
||||
sed -E 's/.*": "([^"]*).*/\1/')
|
||||
filename=$(echo "$download" | sed -E 's/.*\/([^\/]*)$/\1/')
|
||||
name="$(echo "$releases" | sed -n 's/^ "name": "\(.*\)",$/\1/p')"
|
||||
installer=$(mktemp -t gfw-install-XXXXXXXX.exe)
|
||||
if test -z "$yn"
|
||||
then
|
||||
other_bashes=$(count_other_bashes)
|
||||
if test $other_bashes -le 0
|
||||
then
|
||||
warn=
|
||||
elif test $other_bashes -eq 1
|
||||
then
|
||||
warn=" (killing one Git Bash)"
|
||||
else
|
||||
warn=" (killing $other_bashes Git Bash instances)"
|
||||
fi
|
||||
if test -n "$try_toast"
|
||||
then
|
||||
wintoast.exe --appname "$git_label" \
|
||||
--appid GitForWindows.Updater \
|
||||
--image /mingw$bit/share/git/git-for-windows.ico \
|
||||
--text "Download and install $name$warn?" \
|
||||
--action Yes --action No --expirems 15000
|
||||
case $? in
|
||||
0|16)
|
||||
# clicked toast, or clicked Yes: download
|
||||
;;
|
||||
1|17)
|
||||
# dismiseed, or clicked No: ignore this release
|
||||
set_recently_seen "$latest"
|
||||
return 1
|
||||
;;
|
||||
4|5|6|9|10)
|
||||
# toast not activated, failed, toasts
|
||||
# unsupported, WinToast init failed or toast
|
||||
# not launched: fall back to using GUI
|
||||
git askyesno \
|
||||
--title "Git Update Available" \
|
||||
"Download and install $name$warn?" || {
|
||||
set_recently_seen "$latest"
|
||||
return 1
|
||||
}
|
||||
;;
|
||||
*)
|
||||
# toast timed out, or hidden, or unknown
|
||||
# failure: ignore
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
elif test -n "$use_gui"
|
||||
then
|
||||
git askyesno --title "Git Update Available" \
|
||||
"Download and install $name$warn?" || {
|
||||
set_recently_seen "$latest"
|
||||
return 1
|
||||
}
|
||||
else
|
||||
read -p "Download and install $name$warn [N/y]? " \
|
||||
yn >&2
|
||||
case "$yn" in
|
||||
[Yy]*) ;;
|
||||
*)
|
||||
set_recently_seen "$latest"
|
||||
return 1;;
|
||||
esac
|
||||
fi
|
||||
else
|
||||
echo "Downloading $filename" >&2
|
||||
fi
|
||||
curl -# -L -o $installer $download || return
|
||||
start "" "$installer" //SILENT //NORESTART
|
||||
|
||||
# Kill all Bash processes (which will let MinTTY quit, too)"
|
||||
#
|
||||
# `ps` without `-W` will automatically only catch MSYS2 processes
|
||||
# that link to *this* MSYS2 runtime, i.e. no processes from other Git
|
||||
# installations (e.g. Git for Windows' SDK) will be killed.
|
||||
ps | grep ' /usr/bin/bash$' | awk '{print "kill -9 " $1 ";" }' | sh
|
||||
return 2
|
||||
}
|
||||
|
||||
update_git_for_windows "$@"
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user