Fixed chroot environment to be more closed to the one expected by the books.

Need be full tested.
This commit is contained in:
Manuel Canales Esparcia 2007-02-17 02:08:46 +00:00
parent b7ea8ff0fc
commit 1330ebc253
8 changed files with 36 additions and 41 deletions

View file

@ -86,7 +86,16 @@
</xsl:variable>
<!-- Creating dirs and files -->
<exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
<xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
<xsl:choose>
<xsl:when test="@id='ch-chroot-changingowner' or
@id='ch-chroot-creatingdirs' or
@id='ch-chroot-createfiles'">
<xsl:text>#!/tools/bin/bash&#xA;set +h&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="not(@id='ch-system-stripping')">
<xsl:text>set -e</xsl:text>
</xsl:if>

View file

@ -795,22 +795,9 @@ mk_CROSS: mk_SETUP
mk_SUDO: mk_CROSS
@sudo make SUDO
@touch \$@
#
# The convoluted piece of code below is necessary to provide 'make' with a valid shell in the
# chroot environment. (Unless someone knows a different way)
# Manually create the /bin directory and provide link to the /tools dir.
# Also change the original symlink creation to include (f)orce to prevent failure due to
# pre-existing links.
#---------------CHROOT JAIL
mk_SYSTOOLS: mk_SUDO
@if [ ! -e \$(MOUNT_PT)/bin ]; then \\
mkdir \$(MOUNT_PT)/bin; \\
cd \$(MOUNT_PT)/bin && \\
ln -svf /tools/bin/bash bash; ln -sf bash sh; \\
sudo chown -R 0:0 \$(MOUNT_PT)/bin; \\
fi;
@sudo sed -e 's|^ln -sv |ln -svf |' -i \$(CMDSDIR)/chroot/*-createfiles
@\$(call echo_CHROOT_request)
@\$(call echo_PHASE, CHROOT JAIL )
@( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make CHROOT_JAIL")

View file

@ -83,7 +83,15 @@
</xsl:variable>
<!-- Creating dirs and files -->
<exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
<xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
<xsl:choose>
<xsl:when test="@id='ch-system-creatingdirs' or
@id='ch-system-createfiles'">
<xsl:text>#!/tools/bin/bash&#xA;set +h&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="not(@id='ch-tools-stripping') and
not(@id='ch-system-strippingagain')">
<xsl:text>set -e&#xA;</xsl:text>

View file

@ -560,19 +560,12 @@ mk_SUDO: mk_LUSER
@touch \$@
mk_CHROOT: mk_SUDO
@if [ ! -e \$(MOUNT_PT)/bin ]; then \\
mkdir \$(MOUNT_PT)/bin && \\
cd \$(MOUNT_PT)/bin && \\
ln -sf /tools/bin/bash bash; ln -sf bash sh && \\
sudo chown -R 0:0 \$(MOUNT_PT)/bin; \\
fi;
@if [ ! -e \$(MOUNT_PT)/dev ]; then \\
mkdir \$(MOUNT_PT)/dev && \\
sudo mknod -m 666 \$(MOUNT_PT)/dev/null c 1 3 && \\
sudo mknod -m 600 \$(MOUNT_PT)/dev/console c 5 1 && \\
sudo chown -R 0:0 \$(MOUNT_PT)/dev;
fi;
@sudo sed -e 's|^ln -.. |ln -svf |' -i \$(CMDSDIR)/chapter06/*-createfiles
@\$(call echo_CHROOT_request)
@( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make CHROOT")
@touch \$@

View file

@ -79,7 +79,15 @@
</xsl:variable>
<!-- Creating dirs and files -->
<exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
<xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
<xsl:choose>
<xsl:when test="@id='ch-system-creatingdirs' or
@id='ch-system-createfiles'">
<xsl:text>#!/tools/bin/bash&#xA;set +h&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="not(@id='ch-tools-stripping') and
not(@id='ch-system-strippingagain')">
<xsl:text>set -e&#xA;</xsl:text>

View file

@ -435,22 +435,9 @@ mk_LUSER: mk_SETUP
mk_SUDO: mk_LUSER
@sudo make SUDO
touch \$@
#
# The convoluted piece of code below is necessary to provide 'make' with a valid shell in the
# chroot environment. (Unless someone knows a different way)
# Manually create the /bin directory and provide link to the /tools dir.
# Also change the original symlink creation to include (f)orce to prevent failure due to
# pre-existing links.
#
@touch \$@
mk_CHROOT: mk_SUDO
@if [ ! -e \$(MOUNT_PT)/bin ]; then \\
mkdir \$(MOUNT_PT)/bin; \\
cd \$(MOUNT_PT)/bin && \\
ln -sf /tools/bin/bash bash; ln -sf bash sh; \\
sudo chown -R 0:0 \$(MOUNT_PT)/bin; \\
fi;
@sudo sed -e 's|^ln -sv |ln -svf |' -i \$(CMDSDIR)/chapter06/*-createfiles
@\$(call echo_CHROOT_request)
@( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make CHROOT")
@touch \$@

View file

@ -14,7 +14,11 @@ wrt_Makefile_header() { #
#
# Generated on `date "+%F %X %Z"`
SHELL = /bin/bash
ifeq (\$(shell [ -x /bin/bash ] && echo /bin/bash),/bin/bash)
SHELL = /bin/bash
else
SHELL = /tools/bin/bash
endif
SRC = /sources
MOUNT_PT = $BUILDDIR
@ -104,7 +108,7 @@ cat << EOF
$i: $PREV
@\$(call echo_message, Building)
@./progress_bar.sh \$@ \$\$PPID &
@\$(SHELL) progress_bar.sh \$@ \$\$PPID &
@echo "\$(nl_)\`date\`\$(nl_)" >logs/\$@
@\$(PRT_DU) >>logs/\$@
EOF

1
common/progress_bar.sh Executable file → Normal file
View file

@ -1,4 +1,3 @@
#!/bin/bash
# $Id$