diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2012-02-06 15:45:45 +0000 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-02-06 18:07:57 +0000 |
commit | 3c9ef0e9780443d28a078c49bab80cb13e5608ae (patch) | |
tree | 165ddb51565b5530e559ecf34497618c762bb331 | |
parent | 590d8c3c3732c603cfb1d2180190a02df528e5ed (diff) | |
download | libguestfs-3c9ef0e9780443d28a078c49bab80cb13e5608ae.tar.gz libguestfs-3c9ef0e9780443d28a078c49bab80cb13e5608ae.tar.xz libguestfs-3c9ef0e9780443d28a078c49bab80cb13e5608ae.zip |
build: Choose a virtual directory for the daemon which is not a symlink.
Check /sbin, /usr/sbin, /bin and /usr/bin to ensure that neither the
directory nor the parent (eg. /usr) is a symlink, and use this
directory for the virtual directory used to store guestfsd in the
appliance.
-rw-r--r-- | appliance/Makefile.am | 9 | ||||
-rw-r--r-- | configure.ac | 22 |
2 files changed, 27 insertions, 4 deletions
diff --git a/appliance/Makefile.am b/appliance/Makefile.am index 99896be3..09a5d00d 100644 --- a/appliance/Makefile.am +++ b/appliance/Makefile.am @@ -67,10 +67,11 @@ stamp-supermin: make.sh packagelist excludelist supermin.d/daemon.img: ../daemon/guestfsd mkdir -p supermin.d rm -f $@ $@-t - mkdir sbin - cd sbin && ln ../../daemon/guestfsd - echo -e "sbin\nsbin/guestfsd" | cpio --quiet -o -H newc > $@-t - rm -r sbin + rm -rf tmp + mkdir -p tmp$(DAEMON_SUPERMIN_DIR) + ln ../daemon/guestfsd tmp$(DAEMON_SUPERMIN_DIR)/guestfsd + ( cd tmp && find | cpio --quiet -o -H newc ) > $@-t + rm -rf tmp mv $@-t $@ supermin.d/init.img: init diff --git a/configure.ac b/configure.ac index 5caca328..8dcf2d06 100644 --- a/configure.ac +++ b/configure.ac @@ -278,6 +278,28 @@ if test "x$enable_daemon" = "xyes"; then AC_DEFINE([VALGRIND_DAEMON],[1],[Define to 1 to run the daemon under valgrind]) AC_DEFINE_UNQUOTED([VALGRIND_LOG_PATH],["$(pwd)"],[Path to save valgrind log files]) fi + + dnl Which directory should we put the daemon in? NOTE: This + dnl is the "virtual" directory inside the appliance, not the + dnl install directory for libguestfs live. Since Fedora 17 + dnl /sbin is a symlink to /usr/sbin. We have to put the + dnl daemon into a real (non-symlink) directory. + dirs="/sbin /usr/sbin /bin /usr/bin" + AC_MSG_CHECKING([which of $dirs is a real directory]) + for dir in $dirs; do + parent=`dirname $dir` + if test ! -L $parent && test -d $parent \ + && test ! -L $dir && test -d $dir + then + DAEMON_SUPERMIN_DIR=$dir + break + fi + done + if test "x$DAEMON_SUPERMIN_DIR" = "x"; then + AC_MSG_ERROR([non-symlink binary directory not found]) + fi + AC_MSG_RESULT([$DAEMON_SUPERMIN_DIR]) + AC_SUBST([DAEMON_SUPERMIN_DIR]) fi AM_CONDITIONAL([INSTALL_DAEMON],[test "x$enable_install_daemon" = "xyes"]) AM_CONDITIONAL([VALGRIND_DAEMON],[test "x$enable_valgrind_daemon" = "xyes"]) |