examples/Makefile
handlers/Makefile
lib/Makefile
+ lib/backends/Makefile
man/Makefile
src/Makefile])
EXTRA_DIST = $(pkglib_SCRIPTS:%=%.in)
+SUBDIRS = backends
+
edit = sed \
-e "s,@CFGDIR\@,$(CFGDIR),g" \
-e "s,@BASH\@,$(BASH),g" \
# -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*-
# vim: set filetype=sh sw=3 sts=3 expandtab autoindent:
-defined_backends=()
+defined_backends=(local, chroot)
available_backends=()
function init_backends () {
--- /dev/null
+BACKENDS = local chroot
+
+pkglib_SCRIPTS = $(BACKENDS)
+
+CLEANFILES = $(BACKENDS)
+
+EXTRA_DIST = $(BACKENDS:%=%.in)
+
+edit = sed \
+ -e "s,@CFGDIR\@,$(CFGDIR),g" \
+ -e "s,@BASH\@,$(BASH),g" \
+ -e "s,@AWK\@,$(AWK),g" \
+ -e "s,@SED\@,$(SED),g" \
+ -e "s,@MKTEMP\@,$(MKTEMP),g" \
+ -e "s,@libdir\@,$(pkglibdir),g"
+
+$(BACKENDS): %: $(srcdir)/%.in
+ rm -f $@
+ $(edit) $@.in > $@
--- /dev/null
+# -*- 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 () {
+}
--- /dev/null
+# -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*-
+# vim: set filetype=sh sw=3 sts=3 expandtab autoindent:
+
+function backend_local_init () {
+ # We're always available
+ return 0
+}
+
+function backend_local_host_available () {
+ if [ -n "$1" ]; then
+ eval "$2=The local backend does not support named hosts: '\$1'"
+ return 1
+ fi
+ # The empty host (i.e., "local:") is always available
+ return 0
+}
+
+function backend_local_host_root () {
+ # We just use the entire filesystem
+ echo ""
+}
+
+function backend_local_run () {
+ # Running locally is simple, just run the command
+ "$@"
+}
+
+function backend_local_interpolate_vars () {
+ echo ""
+}
+
+function backend_local_interpolate_value () {
+}