+# -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*-
+# vim: set filetype=sh sw=3 sts=3 expandtab autoindent:
+
+getconf CHROOT "`which chroot`"
+
+function backend_chroot_init () {
+ # Is the changeroot command available?
+ [ -x "$CHROOT" ]
+}
+
+function backend_chroot_host_available () {
+ if [ -d "$1" ]; then
+ # The root exists and is a directory, everything ok
+ return 0
+ else
+ if [ ! -e "$1" ]; then
+ # The root does not exist?
+ eval "$2=\"No such file or directory: '\$1'\""
+ else
+ # The root exists, so is not a directory
+ eval "$2=\"Not a directory: '\$1'\""
+ fi
+ return 1
+ fi
+}
+
+function backend_chroot_host_root () {
+ # The host part is the root, but strip any trailing slashes
+ echo "$1" | sed 's/\/*$//'
+}
+
+function backend_chroot_run () {
+ # Run the command using the chroot command
+ "$CHROOT" "$root" "$@"
+}
+
+function backend_chroot_interpolate_vars () {
+ echo ""
+}
+
+function backend_chroot_interpolate_value () {
+}