--- /dev/null
+dnl as-ac-expand.m4 0.2.0
+dnl autostars m4 macro for expanding directories using configure's prefix
+dnl thomas@apestaart.org
+dnl
+
+dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR)
+dnl example
+dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
+dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local
+
+AC_DEFUN([AS_AC_EXPAND],
+[
+ EXP_VAR=[$1]
+ FROM_VAR=[$2]
+
+ dnl first expand prefix and exec_prefix if necessary
+ prefix_save=$prefix
+ exec_prefix_save=$exec_prefix
+
+ dnl if no prefix given, then use /usr/local, the default prefix
+ if test "x$prefix" = "xNONE"; then
+ prefix="$ac_default_prefix"
+ fi
+ dnl if no exec_prefix given, then use prefix
+ if test "x$exec_prefix" = "xNONE"; then
+ exec_prefix=$prefix
+ fi
+
+ full_var="$FROM_VAR"
+ dnl loop until it doesn't change anymore
+ while true; do
+ new_full_var="`eval echo $full_var`"
+ if test "x$new_full_var" = "x$full_var"; then break; fi
+ full_var=$new_full_var
+ done
+
+ dnl clean up
+ full_var=$new_full_var
+ AC_SUBST([$1], "$full_var")
+
+ dnl restore prefix and exec_prefix
+ prefix=$prefix_save
+ exec_prefix=$exec_prefix_save
+])
\ No newline at end of file
AC_CHECK_PROG(SETCAP, setcap, yes, no)
AC_CHECK_PROG(DOCBOOK, docbook2man, yes, no)
AM_CONDITIONAL(ENABLE_DOCBOOK, test x$DOCBOOK = xyes)
-PKG_PROG_PKG_CONFIG
+AS_AC_EXPAND(BINDIR, $bindir)
+AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
+AS_AC_EXPAND(LOCALSTATEDIR, $localstatedir)
AC_CHECK_HEADERS([linux/netlink.h linux/genetlink.h], [], AC_MSG_ERROR([netlink headers not found]),
[#include <linux/types.h>
INITTAB="/etc/inittab"
HOSTNAME="/etc/hostname"
FSTAB="/etc/fstab"
-CACHE="/var/cache/lxc/debian"
+CACHE="@LOCALSTATEDIR@/cache/lxc/debian"
create() {
# create the container object
-lxc-create -n $NAME -f $CONFFILE
+@BINDIR@/lxc-create -n $NAME -f $CONFFILE
# remove the configuration files
NAME=$_NAME_
fi
- lxc-destroy -n $NAME
+ @BINDIR@/lxc-destroy -n $NAME
RETVAL=$?
if [ ! $RETVAL -eq 0 ]; then
echo "Failed to destroyed '$NAME'"
fi
echo -n "Purging the download cache..."
- # I don't use here the variable, just to be sure
- # nobody touching the CACHE variable will lead to
- # remove the real rootfs '/'.
- rm -rf /var/cache/lxc/debian/* && echo "Done." || exit 1
+ rm --preserve-root --one-file-system -rf $CACHE && echo "Done." || exit 1
exit 0
) 200>/var/lock/subsys/lxc
EOF
fi
- lxc-create -n $NAME -f $CONFFILE
+ @BINDIR@/lxc-create -n $NAME -f $CONFFILE
rm -f $MNTFILE
rm -f $CONFFILE
rm -rf $ROOTFS
fi
- lxc-destroy -n $NAME
+ @BINDIR@/lxc-destroy -n $NAME
}
help() {
#!/bin/bash
-prefix=@prefix@
-lxcpath=@localstatedir@/lxc
+lxcpath=@LOCALSTATEDIR@/lxc
if [ ! -r $lxcpath ]; then
exit 0
#!/bin/bash
# set -ex
-prefix=@prefix@
-lxcpath=@localstatedir@/lxc
+lxcpath=@LOCALSTATEDIR@/lxc
exec=""
if [ ! -r $lxcpath ]; then
done
if [ -z "$exec" ]; then
- exec @bindir@/lxc-unshare -m -- @bindir@/lxc-netstat -n $name --exec $*
+ exec @BINDIR@/lxc-unshare -m -- @BINDIR@/lxc-netstat -n $name --exec $*
fi
if [ -z "$name" ]; then
#!/bin/bash
# set -ex
-prefix=@prefix@
-lxcpath=@localstatedir@/lxc
+lxcpath=@LOCALSTATEDIR@/lxc
if [ ! -r $lxcpath ]; then
exit 0