first
This commit is contained in:
commit
757ca483f0
115 changed files with 13170 additions and 0 deletions
30
overlay/Gentoo/usr/local/bin/gentoo_curl_urls.sh
Normal file
30
overlay/Gentoo/usr/local/bin/gentoo_curl_urls.sh
Normal file
|
@ -0,0 +1,30 @@
|
|||
#!/bin/sh
|
||||
# -*- mode: sh; tab-width: 8; coding: utf-8-unix -*-
|
||||
# filter - arguments are to wget - quoted?
|
||||
|
||||
ROOTDIR=/mnt/i
|
||||
ROLE=base
|
||||
|
||||
LARGS="-X -P $ROOTDIR/net/Http "
|
||||
RARGS="--retry 1"
|
||||
|
||||
grep ^http | \
|
||||
sed -e 's@http://@https://@g' \
|
||||
-e 's@^\(https://distfiles.gentoo.org/distfiles/[a-f0-9][a-f0-9]/[^ ]*\) \(https*://[^ ]*\) @\2 \1@' \
|
||||
-e 's@^\(https://distfiles.gentoo.org/distfiles/[^ ]*\) \(https*://[^ ]*\) @\2 \1@' \
|
||||
-e 's@^\(https://dev.gentoo.org/~sam/distfiles/[^ ]*\) \(https*://[^ ]*\) @\2 \1@' \
|
||||
| \
|
||||
sed -e 's@ftp://[^ ]*@@' \
|
||||
-e 's@^https://distfiles.gentoo.org/distfiles/[^ ]* https://pypi.python.org/@https://pypi.python.org/@' \
|
||||
-e 's@https*://distfiles.gentoo.org@https://gentoo.osuosl.org@g' \
|
||||
-e 's@https*://gentoo.osuosl.org@https://mirror.leaseweb.com/gentoo@g' \
|
||||
-e 's@https*://download.sourceforge.net@https://download.sourceforge.net@g' | \
|
||||
while read urls ; do
|
||||
url=`echo $urls|sed -e 's@ .*@@'`
|
||||
base=`basename "$url"`
|
||||
[ -e /usr/portage/distfiles/$base ] && echo distfiles/$base && continue
|
||||
for url in $urls ; do
|
||||
/usr/local/bin/scurl.bash $LARGS -- $RARGS $url || continue
|
||||
break
|
||||
done
|
||||
done
|
90
overlay/Gentoo/usr/local/bin/gentoo_scurl_urls.sh
Executable file
90
overlay/Gentoo/usr/local/bin/gentoo_scurl_urls.sh
Executable file
|
@ -0,0 +1,90 @@
|
|||
#!/bin/bash
|
||||
# -*- mode: sh; tab-width: 8; coding: utf-8-unix -*-
|
||||
# filter - arguments are to wget - quoted?
|
||||
|
||||
prog=$( basename $0 .bash )
|
||||
prog=ScurlU
|
||||
ROOTDIR=/mnt/i/net/Http
|
||||
ROLE=base
|
||||
CACHE=/usr/portage/distfiles
|
||||
[ -z "$SCURL_BG" ] && SCURL_BG=0
|
||||
SSL_VER=2
|
||||
|
||||
. /usr/local/bin/proxy_curl_lib.bash
|
||||
. /usr/local/bin/usr_local_tput.bash
|
||||
|
||||
route | grep -q ^def || { ERROR not connected ; exit -1 ; }
|
||||
|
||||
FETCHCOMMAND='/usr/local/bin/scurl.bash --force-directories --directory-prefix "\${DISTDIR}" -- "\${URI}"'
|
||||
|
||||
# RARGS="--retry 1 --connect-timeout 10"
|
||||
RARGS=" -S $SSL_VER"
|
||||
if [ "$#" -eq 0 ] ; then
|
||||
LARGS="--force-directories --directory-prefix $ROOTDIR"
|
||||
else
|
||||
LARGS="$@"
|
||||
fi
|
||||
cp /dev/null /tmp/$prog$$.urls
|
||||
|
||||
# //www.simplesystems.org/users/bfriesen/public-key.txt no https:
|
||||
# https://opencoder.net/WayneDavison.key cloudflare 403
|
||||
# https://www.simplesystems.org/users/bfriesen/public-key.txt 503
|
||||
# https://tiswww.case.edu/php/chet/gpgkey.asc 500 timeout
|
||||
# https://botan.randombit.net/pgpkey.txt no tls1.3
|
||||
# https://sourceware.org/elfutils/ftp/gpgkey-1AA44BE649DE760A.gpg no tls1.3
|
||||
# https://gnutls.org/gnutls-release-keyring.gpg no tls1.3
|
||||
|
||||
declare -A IPS
|
||||
retval=0
|
||||
# NOT 1.3 -e 's@^https://distfiles.gentoo.org/distfiles/[^ ]* https://pypi.python.org/@https://pypi.python.org/@'
|
||||
grep ^http | \
|
||||
sed -e 's@ftp://[^ ]*@@' \
|
||||
-e 's/http:/https:/' \
|
||||
-e 's@^https://distfiles.gentoo.org/distfiles/openpgp-keys-[^ ]*.asc @@' \
|
||||
-e 's@https*://distfiles.gentoo.org@https://gentoo.osuosl.org@g' \
|
||||
-e 's@https://gentoo.osuosl.org@https://mirror.leaseweb.com/gentoo@g' \
|
||||
| \
|
||||
while read urls ; do
|
||||
url=`echo $urls|sed -e 's@ .*@@'`
|
||||
base=`basename "$url"`
|
||||
[ -e $CACHE/$base ] && echo $CACHE/$base && continue
|
||||
base=`echo $url | sed -e 's@ .*@@' -e 's@https*://@@'`
|
||||
[ -e $ROOTDIR/"$base" ] && echo $ROOTDIR/"$base" && continue
|
||||
for url in $urls ; do
|
||||
url=`sed -e 's@http://@https://@g' <<< $url`
|
||||
domain=`sed -e 's@^https*://@@' -e 's@/.*@@' <<< $url`
|
||||
a=`proxy_ami_nottlsv3 $domain`
|
||||
ar=$?
|
||||
[ $ar -eq 0 -a "$a" = True ] && \
|
||||
WARN $prog proxy_ami_nottlsv3 $domain $url && continue
|
||||
if [ -z "${IPS[$domain]}" ] ; then
|
||||
ip=`tor-resolve $domain`
|
||||
ir=$?
|
||||
[ $ir -eq 0 ] && IPS[$domain]=$ip
|
||||
else
|
||||
ip="${IPS[$domain]}"
|
||||
ir=0
|
||||
fi
|
||||
if [ $ir -eq 0 -a -n "$ip" ] ; then
|
||||
a=`proxy_ami_cloudflared $ip`
|
||||
[ $? -eq 0 -a "$a" = True ] && \
|
||||
WARN $prog $url Cloudflared $ip && \
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ "$SCURL_BG" = 1 ] ; then
|
||||
/usr/local/bin/scurl.bash $LARGS -- $RARGS $url &
|
||||
INFO $prog /usr/local/bin/scurl.bash $LARGS -- $RARGS $url
|
||||
else
|
||||
/usr/local/bin/scurl.bash $LARGS -- $RARGS $url || {
|
||||
retval=$?
|
||||
WARN $prog retval=$retval /usr/local/bin/scurl.bash $LARGS -- $RARGS $url
|
||||
continue
|
||||
}
|
||||
fi
|
||||
|
||||
break
|
||||
done
|
||||
done
|
||||
|
||||
exit $retval
|
26
overlay/Gentoo/usr/local/bin/gentoo_wget_urls.sh
Executable file
26
overlay/Gentoo/usr/local/bin/gentoo_wget_urls.sh
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh
|
||||
# filter - arguments are to wget - quoted?
|
||||
|
||||
ROOTDIR=/mnt/i
|
||||
ROLE=base
|
||||
if [ "$#" -eq 0 ] ; then
|
||||
WARGS="-xc -P $ROOTDIR/net/Http --tries=1"
|
||||
else
|
||||
WARGS="$@"
|
||||
fi
|
||||
# NOT 1.3 -e 's@^https://distfiles.gentoo.org/distfiles/[^ ]* https://pypi.python.org/@https://pypi.python.org/@'
|
||||
grep ^http | \
|
||||
sed -e 's@^\(https://distfiles.gentoo.org/distfiles/[a-f0-9][a-f0-9]/[^ ]*\) \(https*://[^ ]*\) @\2 \1@' | \
|
||||
sed -e 's@ftp://[^ ]*@@' -e 's/http:/https:/' \
|
||||
-e 's@https*://distfiles.gentoo.org@https://gentoo.osuosl.org@g' \
|
||||
-e 's@https*://gentoo.osuosl.org@https://mirror.leaseweb.com/gentoo@g' \
|
||||
-e 's@https*://download.sourceforge.net@https://download.sourceforge.net@g' | \
|
||||
while read urls ; do
|
||||
url=`echo $urls|sed -e 's@ .*@@'`
|
||||
base=`basename "$url"`
|
||||
[ -e /usr/portage/distfiles/$base ] && echo distfiles/$base && continue
|
||||
for url in $urls ; do
|
||||
wget --restrict-file-names=windows --no-verbose $WARGS $url || continue
|
||||
break
|
||||
done
|
||||
done
|
52
overlay/Gentoo/usr/local/bin/str_replace
Executable file
52
overlay/Gentoo/usr/local/bin/str_replace
Executable file
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
|
||||
my $numarg = $#ARGV + 1;
|
||||
if ($numarg < 2) {
|
||||
print "Usage: str_replace Search Replace File\nOr: STDIN str_replace Search Replace\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $find=$ARGV[0];
|
||||
my $replace=$ARGV[1];
|
||||
my $file;
|
||||
my $contents;
|
||||
my $found=0;
|
||||
my $fh;
|
||||
|
||||
if(defined $ARGV[2]){
|
||||
$file=$ARGV[2];
|
||||
open($fh, '<', $file) or die "Cannot open the file '$file'";
|
||||
{
|
||||
local $/;
|
||||
$contents = <$fh>;
|
||||
}
|
||||
close($fh);
|
||||
}
|
||||
else{
|
||||
{
|
||||
local $/;
|
||||
$contents = <STDIN>;
|
||||
}
|
||||
}
|
||||
my $pos = index($contents, $find);
|
||||
while ( $pos > -1 ) {
|
||||
if(substr( $contents, $pos, length( $find ), $replace )){$found =$found+1;}
|
||||
$pos = index( $contents, $find, $pos + length( $replace ));
|
||||
}
|
||||
|
||||
if(!defined $ARGV[2]){
|
||||
print $contents;
|
||||
exit;
|
||||
}
|
||||
|
||||
if($found==0) {print "Nothing replaced\n";}
|
||||
else{ print "$found occurrences of '$find' have been replaced with '$replace'\n";}
|
||||
|
||||
|
||||
open($fh, '>', $file);
|
||||
print $fh $contents;
|
||||
close $fh;
|
Loading…
Add table
Add a link
Reference in a new issue