commit:     02451cdd8614f1072096608c49ae7796a6363819
Author:     Benda Xu <heroxbd <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 27 02:38:20 2020 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Mon Jan 27 02:53:04 2020 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=02451cdd

s/bootstrap-prefix.sh: fake rsync to install linux-headers.

  linux-headers starts to use rsync to do the installation.  Replace
  it with a shell script to call cp instead.

Closes: https://bugs.gentoo.org/699718
Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>

 scripts/bootstrap-prefix.sh | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh
index 0669107fb5..3bb523071c 100755
--- a/scripts/bootstrap-prefix.sh
+++ b/scripts/bootstrap-prefix.sh
@@ -1858,6 +1858,24 @@ bootstrap_stage3() {
                                > "${ROOT}"/usr/bin/perl
                        chmod +x "${ROOT}"/usr/bin/perl
                fi
+
+               # Need rsync to for linux-headers installation
+               if [[ ! -x "${ROOT}"/usr/bin/rsync ]]; then
+                       cat > "${ROOT}"/usr/bin/rsync <<-EOF
+               #!${ROOT}/bin/bash
+               while (( \$# > 0 )); do
+               case \$1 in
+               -*) shift; continue ;;
+               *) break ;;
+               esac
+               done
+               dst="\$2"/\$(basename \$1)
+               mkdir -p "\${dst}"
+               cp -rv \$1/* "\${dst}"/
+               EOF
+                       chmod +x "${ROOT}"/usr/bin/rsync
+               fi
+
                # Tell dynamic loader the path of libgcc_s.so of stage2
                if [[ ! -f "${ROOT}"/etc/ld.so.conf.d/stage2.conf ]]; then
                        mkdir -p "${ROOT}"/etc/ld.so.conf.d
@@ -1877,6 +1895,8 @@ bootstrap_stage3() {
                with_stack_emerge_pkgs --nodeps "${pkgs[@]}" || return 1
                grep -q 'apiversion=9999' "${ROOT}"/usr/bin/perl && \
                        rm "${ROOT}"/usr/bin/perl
+               grep -q 'esac' "${ROOT}"/usr/bin/rsync && \
+                       rm "${ROOT}"/usr/bin/rsync
 
                pkgs=(
                        sys-devel/binutils-config

Reply via email to