>From c41fe8f639bfab53e6569f3046e6337fced62ce8 Mon Sep 17 00:00:00 2001 From: Karol Lewandowski <[email protected]> Date: Mon, 31 Jan 2011 13:12:38 +0100 Subject: [PATCH 3/3] Fix: Allow sb2-config-debian to be called recursively
When configuring new target using sb2-init, sb2-config-debian calls sb2 several times. sb2, by default, also calls sb2-upgrade-config which is needed to perform some final configuration. Thus, call to sb2-upgrade-config is suppressed right now (using "sb2 -u") in sb2-config-debian as it would cause infinite loop. However, target environment isn't really ready before the call to sb2-upgrade-config. Calling sb2 with such an environment caues it to fail and leaves sb2 session files in /tmp/sb2-$USER*. This commit adds necessary recursion check to allow calling us twice, as needed, in early configuration stage. Change-Id: Id3551e30270eaa07a1994faf4cb30ff3d604418a --- utils/sb2-config-debian | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/utils/sb2-config-debian b/utils/sb2-config-debian index 0d09cdb..62d2b2f 100755 --- a/utils/sb2-config-debian +++ b/utils/sb2-config-debian @@ -81,6 +81,11 @@ fi SBOX_CONFIG_DIR=~/.scratchbox2/$TARGET/sb2.config.d +if [ -f $SBOX_CONFIG_DIR/debian.conf -a ! -s $SBOX_CONFIG_DIR/debian.conf ]; then + # sb2-upgrade-config called us when creating initial environment + exit 0 +fi + if [ -f $SBOX_CONFIG_DIR/gcc.config.sh ]; then # configured with a cross-compiler; # get ARCH from the primary gcc config file @@ -149,13 +154,17 @@ esac if [ ! -f $SBOX_CONFIG_DIR/debian.conf ]; then # first time here (maybe upgrading the configuration); # debian.conf does not exist. Create a temporary - # file, otherwise "sb2 -u" will fail to run because + # file, otherwise "sb2" will fail to run because # this config file is mandatory now. - echo "# temporary debian.conf" >$SBOX_CONFIG_DIR/debian.conf + # + # Create empty config file to allow us detect loops - + # "sb2-upgrade-config" needs to be called to upgrade ld*.conf + # files but it will also try to execute us again... + : >$SBOX_CONFIG_DIR/debian.conf fi # test if dpkg-architecture exists and can be executed -DPKG_ARCHITECTURE_FULLPATH=$(sb2 -u -t $TARGET -m devel which dpkg-architecture) +DPKG_ARCHITECTURE_FULLPATH=$(sb2 -t $TARGET -m devel which dpkg-architecture) if [ $? != 0 ]; then # Can't locate or run dpkg-architecture. Set the values here. # FIXME: I'm still not sure if these settings are sane, -- 1.7.0.4
_______________________________________________ Scratchbox-devel mailing list [email protected] http://lists.scratchbox.org/cgi-bin/mailman/listinfo/scratchbox-devel
