[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: polystrap /lib/ld-linux.so.3: No such file or directory



On Mon, Jun 27, 2011 at 10:13:57AM +0200, Geert Stappers wrote:
> ---
>  README           |    2 +
>  polystrap-binfmt |  129 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 131 insertions(+), 0 deletions(-)
>  create mode 100755 polystrap-binfmt
> 
> diff --git a/README b/README
> index 65434d2..59e6542 100644
> --- a/README
> +++ b/README
> @@ -53,6 +53,8 @@ then used instead of the contents of the PLATFORM/packages directory:
>  
>  	-p packages
>  
> +Use the program  polystrap-binfmt  to prepare your build host
> +

The script below fixes the polystrap
 /lib/ld-linux.so.3: No such file or directory
error

>  How the script works:
>  
>   *) re-execute itself in fakeroot
> diff --git a/polystrap-binfmt b/polystrap-binfmt
> new file mode 100755
> index 0000000..0460756
> --- /dev/null
> +++ b/polystrap-binfmt
> @@ -0,0 +1,129 @@

.,$s/^> +//

#!/bin/sh
#
# polystrap-binfmt - helps preparing the build host for running polystrap
#
# Copyright (C) 2011 by Geert Stappers <stappers@stappers.nl>
#
# Polystrap-binfmt is based upon the research of Josch Schauer
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.

set -e
# set -x

if [ $( id --user ) -eq 0 ] ; then
	:
else
	echo 1>&2 E: Run this script as root
	exit 1
fi

usage() {
	echo -e "Usage: $0: [-m mirror] architecture directory\n"
}

export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
	LC_ALL=C LANGUAGE=C LANG=C

while getopts m: opt; do
	case $opt in
	m) _MIRROR="$OPTARG";;
	?) usage; exit 1;;
	esac
done
shift $(($OPTIND - 1))

[ "$#" -ne 2 ] && { echo 1>&2 "E: Two arguments required"; usage; exit 1; }

ARCH="$1"
TMPDIR="$2"

if [ -d "$TMPDIR" ] ; then
	TMPDIR="${TMPDIR}/polystrap-binfmt-$$"
	mkdir $TMPDIR
else
	echo 1>&2 "E: $TMPDIR not an existing directory"
	exit 1
fi
[ ! -d "$TMPDIR" ] && { echo 2>&1 "E: Could not create $TMPDIR"; exit 1; }

MIRROR="http://ftp.nl.debian.org/debian";
# overwrite default Debian archive by commandline option
MIRROR=${_MIRROR:-$MIRROR}

MTCNFG=$TMPDIR/multistrap.conf
cat << LastLine > $MTCNFG
# this is a temporary configuration file for multistrap
# it is created by $0
# and should also have been deleted by $0
#
[General]
arch=
directory=
cleanup=true
unpack=true
noauth=true
aptsources=Debian
bootstrap=BinfmtStuff
allowrecommends=false
addimportant=false
omitrequired=true

[BinfmtStuff]
packages=libc6 libselinux1 libacl1 man-db libstdc++6
source=$MIRROR
suite=sid
omitdebsrc=true
# l l
LastLine

[ ! -r "$MTCNFG" ] && { echo 1>&2 "E: Creation of $MTCNFG failed"; exit 1; }

# download and extract packages with binfmt stuff
multistrap -a $ARCH -d $TMPDIR/binfmtroot -f $MTCNFG
RETVAL=$?
if [ $RETVAL -ne 0 ] ; then
	echo 1>&2 E: multistrap returned a non zero value
	echo I: no clean up of temporary files done, the multistrap command was
	echo I:  multistrap -a $ARCH -d $TMPDIR/binfmtroot -f $MTCNFG
	exit 1
fi

# deduce binfmt architecture from architecture
if [ "$ARCH" = $( dpkg --print-architecture ) ]; then
	BINFMT_ARCH=$ARCH
	echo W: It is strange to $0 on a $ARCH host for a $BINFMT_ARCH target
else
        case $ARCH in
                alpha|amd64|arm|armeb|i386|m68k|mips|mipsel\
		|powerpc|ppc64|sh4|sh4eb|sparc|sparc64)
                	BINFMT_ARCH=$ARCH ;;
                armel) 	BINFMT_ARCH=arm ;;
                lpia)  	BINFMT_ARCH=i386 ;; # not yet verified FIXME
                *) echo "unknown architecture: $ARCH"; exit 1;;
        esac
fi

rm -rf                   /etc/qemu-binfmt/$BINFMT_ARCH
cp -r $TMPDIR/binfmtroot /etc/qemu-binfmt/$BINFMT_ARCH

# clean up
rm -rf $TMPDIR

# l l


Groeten
Geert Stappers
-- 
> And is there a policy on top-posting vs. bottom-posting?
Yes.


Reply to: