[buildd-tools-devel] Schroot error

shawn wilson ag4ve.us at gmail.com
Sat Oct 12 08:59:44 UTC 2013


This works fine in a bash script [1] but is failing for some reason in
a schroot setup script [2] and I'm not understanding the debug output
[3], ie why is common-data being sourced after my read line (54 in the
setup.d/19basefs). Also see [4] my test input - t.data for t.sh [1]
and base/test for the schroot script [2]. My config is at the bottom
[5].

PS - sorry, I see I'm most of the activity of this list for the past
week. However, y'all have been great help (and no other forum is of
much help here).

#### 1 t.sh

#!/bin/bas -

set -o nounset                              # Treat unset variables as an error

infile="./t.data"

echo "["
cat $infile
echo "]"
while  read -r line; do
    echo "line [$line]"

    IFS=: read -rd '' path user group mod <<< "$line"

    echo "path [$path]"

    if echo "$path" | egrep -q '^(#|$)' ; then
    echo "here"
        continue
    fi

    if echo "$path" | grep -q '^/'; then
        echo "make_path: " "foo$path" "$user" "$group" "$path"
    else
        echo "Not copying file with relative path: $path"
    fi
done < "$infile"

#### 2 setup.d/19basefs

#!/bin/sh
# Copyright © 2005-2007  Roger Leigh <rleigh at debian.org>
#
# schroot is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# schroot is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see
# <http://www.gnu.org/licenses/>.
#
#####################################################################

set -e
set -x

. "$SETUP_DATA_DIR/common-data"
. "$SETUP_DATA_DIR/common-functions"
. "$SETUP_DATA_DIR/common-config"

if [ "$VERBOSE" = "verbose" ]; then
  CP_VERBOSE="--verbose"
fi

if [ -n "$BASEFS" ]; then
    SETUP_BASEFS="$BASEFS"
fi

if [ -n "${SETUP_BASEFS}" ]; then
    SETUP_BASEFS="${SYSCONF_DIR}/${SETUP_BASEFS}"
fi

# Copy directories and creates empty files
make_path()
{
    echo "in make_path()"
}

# This is destructive so I don't think we want to do this on recover
# || [ $STAGE = "setup-recover" ]
if [ $STAGE = "setup-start" ]; then

    if [ -n "$SETUP_BASEFS" ]; then
        if [ -f "$SETUP_BASEFS" ]; then
            while read -r line; do
                echo "line [$line]"

                IFS=: read -rd '' path user group mod <<< "$line"

                echo "path [$path]"

                if echo "$path" | egrep -q '^(#|$)' ; then
                    continue
                fi

                if echo "$path" | grep -q '^/'; then
                    make_path "${CHROOT_PATH}$path" "$user" "$group" "$path"
                else
                    warn "Not copying file with relative path: $path"
                fi
            done < "$SETUP_BASEFS"
        else
            fatal "basefs file '$SETUP_BASEFS' does not exist"
        fi
    fi

fi

#### 3 schroot output

 % schroot -c test -- ls /
E: 19basefs: + . /usr/share/schroot/setup/common-data
E: 19basefs: ++ STAGE=setup-start
E: 19basefs: ++ STATUS=ok
E: 19basefs: ++ case "$HOST_OS" in
E: 19basefs: ++ :
E: 19basefs: ++ DEVTYPE=-b
E: 19basefs: + . /usr/share/schroot/setup/common-functions
E: 19basefs: + . /usr/share/schroot/setup/common-config
E: 19basefs: ++ '[' -n default/config ']'
E: 19basefs: ++ SETUP_CONFIG=/etc/schroot/default/config
E: 19basefs: ++ '[' -f /etc/schroot/default/config ']'
E: 19basefs: ++ '[' -n '' ']'
E: 19basefs: ++ '[' -n default/fstab ']'
E: 19basefs: ++ SETUP_FSTAB=/etc/schroot/default/fstab
E: 19basefs: ++ '[' -n copy/test ']'
E: 19basefs: ++ SETUP_COPYFILES=/etc/schroot/copy/test
E: 19basefs: ++ '[' -n default/nssdatabases ']'
E: 19basefs: ++ SETUP_NSSDATABASES=/etc/schroot/default/nssdatabases
E: 19basefs: ++ '[' -n '' ']'
E: 19basefs: ++ '[' -n '' ']'
E: 19basefs: ++ '[' -n '' ']'
E: 19basefs: + '[' normal = verbose ']'
E: 19basefs: + '[' -n '' ']'
E: 19basefs: + '[' -n base/test ']'
E: 19basefs: + SETUP_BASEFS=/etc/schroot/base/test
E: 19basefs: + '[' setup-start = setup-start ']'
E: 19basefs: + '[' -n /etc/schroot/base/test ']'
E: 19basefs: + '[' -f /etc/schroot/base/test ']'
E: 19basefs: + read -r line
E: 19basefs: + echo 'line [/testroot:root:root:+777]'
I: 19basefs: line [/testroot:root:root:+777]
E: 19basefs: + IFS=:
E: 19basefs: + read -rd '' path user group mod
E: 19basefs: + . /usr/share/schroot/setup/common-data
E: 19basefs: ++ STAGE=setup-stop
E: 19basefs: ++ STATUS=fail
E: 19basefs: ++ case "$HOST_OS" in
E: 19basefs: ++ :
E: 19basefs: ++ DEVTYPE=-b
E: 19basefs: + . /usr/share/schroot/setup/common-functions
E: 19basefs: + . /usr/share/schroot/setup/common-config
E: 19basefs: ++ '[' -n default/config ']'
E: 19basefs: ++ SETUP_CONFIG=/etc/schroot/default/config
E: 19basefs: ++ '[' -f /etc/schroot/default/config ']'
E: 19basefs: ++ '[' -n '' ']'
E: 19basefs: ++ '[' -n default/fstab ']'
E: 19basefs: ++ SETUP_FSTAB=/etc/schroot/default/fstab
E: 19basefs: ++ '[' -n copy/test ']'
E: 19basefs: ++ SETUP_COPYFILES=/etc/schroot/copy/test
E: 19basefs: ++ '[' -n default/nssdatabases ']'
E: 19basefs: ++ SETUP_NSSDATABASES=/etc/schroot/default/nssdatabases
E: 19basefs: ++ '[' -n '' ']'
E: 19basefs: ++ '[' -n '' ']'
E: 19basefs: ++ '[' -n '' ']'
E: 19basefs: + '[' normal = verbose ']'
E: 19basefs: + '[' -n '' ']'
E: 19basefs: + '[' -n base/test ']'
E: 19basefs: + SETUP_BASEFS=/etc/schroot/base/test
E: 19basefs: + '[' setup-stop = setup-start ']'
E: test-99148a0b-67e7-41f9-92e2-81006c888486: Chroot setup failed:
stage=setup-start

#### 4 base/test (t.data)

/testroot:root:root:+777

#### 5 schroot.conf

[test]
type=directory
description=Test
users=swilson
directory=/opt/schroot/test
profile=default
setup.basefs=base/test
setup.copyfiles=copy/test



More information about the Buildd-tools-devel mailing list