+Provide mount.captive(8) for "mount -t captive-ntfs ..." invocation syntax.
authorshort <>
Fri, 29 Aug 2003 11:19:06 +0000 (11:19 +0000)
committershort <>
Fri, 29 Aug 2003 11:19:06 +0000 (11:19 +0000)
captive.spec.in
configure.in
debian/lufs.files
debian/rules
src/client/lufs/Makefile.am
src/client/lufs/mount.captive.in [new file with mode: 0755]

index b01c138..14483d5 100644 (file)
@@ -95,6 +95,8 @@ CFLAGS="-O2"
                --with-sandbox-setuid=@PACKAGE@ \
                --with-sandbox-setgid=@PACKAGE@ \
                --with-sandbox-chroot=%{_var}/lib/@PACKAGE@ \
+               --with-sbin-mountdir=/sbin \
+               --with-sbin-mount-fs=ntfs:fastfat:cdfs:ext2fsd \
                --disable-gtk-doc
 make
 
@@ -126,6 +128,8 @@ rm -rf $RPM_BUILD_ROOT
 %defattr(-,root,root)
 %{_libdir}/liblufs-@PACKAGE@fs-@VERSION@.so
 %{_libdir}/liblufs-@PACKAGE@fs.so
+/sbin/mount.@PACKAGE@
+/sbin/mount.@PACKAGE@-*
 
 # %files devel
 # %defattr(-,root,root)
index c302d1c..5008643 100644 (file)
@@ -63,6 +63,18 @@ if test "$USE_MAINTAINER_MODE" = "yes";then
 dnl Some Makefiles use additional tests etc.
 AM_CONDITIONAL(MAINTAINER_MODE,[test "$USE_MAINTAINER_MODE" = "yes"])
 
+
+AC_ARG_WITH(sbin-mountdir,
+               [  --with-sbin-mountdir=dir      mount(8) 'mount.captive' directory (def.=/sbin)],,
+               [ with_sbin_mountdir="/sbin" ])
+AM_CONDITIONAL(WITH_SBIN_MOUNT,[test "$with_sbin_mount" != "no"])
+AC_SUBST(with_sbin_mountdir)
+
+AC_ARG_WITH(sbin-mount-fs,
+               [  --with-sbin-mount-fs=fs1:fs2  sbin-mount pre-installed symlinks (def.=ntfs:fastfat:cdfs:ext2fsd)],,
+               [ with_sbin_mount_fs="ntfs:fastfat:cdfs:ext2fsd" ])
+AC_SUBST(with_sbin_mount_fs)
+
 AC_ARG_WITH(sandbox-setuid,
                [  --with-sandbox-setuid=user    non-privileged user  for captive-sandbox-server (def.=captive)],
                [ CAPTIVE_SANDBOX_SETUID="$withval" ],[ CAPTIVE_SANDBOX_SETUID="captive" ])
@@ -139,7 +151,7 @@ dnl popt
 AC_CHECK_LIB(popt,poptParseArgvString,[POPT_LIBS="-lpopt"],[AC_MSG_ERROR([Captive requires popt library.])])
 AC_SUBST(POPT_LIBS)
 
-AC_ARG_WITH(readline,  [  --with-readline=[no/yes/auto]        cmdline client w/line editing [default=auto]],,with_readline=auto)
+AC_ARG_WITH(readline,  [  --with-readline=[no/yes/auto]        cmdline client with line editing (def.=auto)],,with_readline=auto)
 AC_CHECK_HEADERS(readline/history.h)
 dnl Check for libraries, if needed by configuration options.
 if test "$with_readline" != "no"
@@ -246,10 +258,12 @@ AC_SUBST(LIBS)
 
 dnl "Makefile" output files MUST have pathnames incl./excl. "./" prefix as specified!
 AC_OUTPUT([
-captive.spec
-Makefile
-./macros/Makefile
+./captive.spec
+./src/client/gnomevfs/captive.conf
+./src/client/lufs/mount.captive
 ./po/Makefile.in
+./Makefile
+./macros/Makefile
 ./src/Makefile
 ./src/libcaptive/Makefile
 ./src/libcaptive/include/Makefile
@@ -307,7 +321,6 @@ Makefile
 ./src/TraceFS/Makefile
 ./doc/Makefile
 ./doc/apiref/Makefile
-./src/client/gnomevfs/captive.conf
 ])
 
 dnl FIXME: Why is "po/POTFILES" being substituted?
index 3bc5365..5f42a84 100644 (file)
@@ -1,2 +1,4 @@
 /usr/lib/liblufs-captivefs-0.9cvs.so
 /usr/lib/liblufs-captivefs.so
+/sbin/mount.captive
+/sbin/mount.captive-*
index a9d46bc..ad2edc8 100755 (executable)
@@ -43,6 +43,8 @@ config.status: configure
                --with-sandbox-setuid=captive \
                --with-sandbox-setgid=captive \
                --with-sandbox-chroot=/var/lib/captive \
+               --with-sbin-mountdir=/sbin \
+               --with-sbin-mount-fs=ntfs:fastfat:cdfs:ext2fsd \
                --disable-gtk-doc
 
 build-arch:  config.status build-arch-stamp
index fd9f9a7..5ff308e 100644 (file)
@@ -36,3 +36,21 @@ if HAVE_LUFS_INCLUDES
 liblufs_captivefs_la_cond=liblufs-captivefs.la
 endif
 lib_LTLIBRARIES+=$(liblufs_captivefs_la_cond)
+
+if HAVE_LUFS_INCLUDES
+if WITH_SBIN_MOUNT
+sbin_mount_captive_cond=mount.captive
+install-exec-hook:
+       $(mkinstalldirs) $(DESTDIR)$(with_sbin_mountdir)
+       IFS=:; \
+       with_sbin_mount_fs="$(with_sbin_mount_fs)"; \
+       for fs in $$with_sbin_mount_fs; do \
+               if test $$fs != no; then \
+                       $(RM) $(DESTDIR)$(with_sbin_mountdir)/mount.captive-$$fs; \
+                       $(LN_S) mount.captive $(DESTDIR)$(with_sbin_mountdir)/mount.captive-$$fs; \
+               fi; \
+               done
+
+endif
+endif
+with_sbin_mount_SCRIPTS=$(sbin_mount_captive_cond)
diff --git a/src/client/lufs/mount.captive.in b/src/client/lufs/mount.captive.in
new file mode 100755 (executable)
index 0000000..4850e0f
--- /dev/null
@@ -0,0 +1,75 @@
+#! /usr/bin/perl -w
+# 
+# $Id$
+# External mount command for mount(8) to interface lufsmount(1)
+# Copyright (C) 2003 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# This program 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; exactly version 2 of June 1991 is required
+# 
+# This program 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, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+use strict;
+use Carp qw(cluck confess);
+use Getopt::Long;
+# Do not use any non-core Perl modules here.
+# Be perl-5.0 compatible (is it needed if we require Linux kernel >= 2.4 ?)
+
+
+my $vardir='@localstatedir@/lib/captive';
+$vardir=~s#\$\Q{prefix}\E#'@prefix@';#ge;
+$vardir="/var/lib/captive" if $vardir=~/^@/;
+my $lufsmount_bin='@bindir@/lufsmount';
+$lufsmount_bin=~s#\$\Q{exec_prefix}\E#'@exec_prefix@';#ge;
+$lufsmount_bin=~s#\$\Q{prefix}\E#'@prefix@';#ge;
+$lufsmount_bin="/usr/bin/lufsmount" if $lufsmount_bin=~/^@/;
+my $captive_sandbox_server_bin='@sbindir@/captive-sandbox-server';
+$captive_sandbox_server_bin=~s#\$\Q{exec_prefix}\E#'@exec_prefix@';#ge;
+$captive_sandbox_server_bin=~s#\$\Q{prefix}\E#'@prefix@';#ge;
+$captive_sandbox_server_bin="/usr/sbin/captive-sandbox-server" if $captive_sandbox_server_bin=~/^@/;
+
+
+my $fsname=($0=~m#([^/]*)$#)[0] or die "Cannot detetect my basename from: $0";
+$fsname=~s/^mount[.]captive-// or die "Cannot detect captive filesystem module from my name: $fsname";
+my $image=shift @ARGV or die "Missing argv[1]: device or image pathname";
+-r $image or die "Image pathname not readable: $image";
+my $dir=shift @ARGV or die "Missing argv[2]: mount point directory";
+-d $dir or die "Mount point directory not a valid directory: $dir";
+shift @ARGV if my $nomtab =$ARGV[0] && $ARGV[0] eq "-n";
+shift @ARGV if my $verbose=$ARGV[0] && $ARGV[0] eq "-v";
+my $oo="";
+do { shift @ARGV; $oo=shift @ARGV; } if $ARGV[0] && $ARGV[0] eq "-o";
+die "Excessive arguments: @ARGV" if @ARGV;
+
+my $filesystem=$vardir."/".$fsname.".sys";
+-r $filesystem or die "W32 filesystem .sys module not readable: $filesystem";
+my $ntoskrnl=$vardir."/ntoskrnl.exe";
+-r $ntoskrnl or die "W32 ntoskrnl.exe not readable: $ntoskrnl";
+
+# Double-dashes are generally optional here.
+$oo=""
+               .($fsname eq "cdfs" ? "--cdrom,--ro," : "--disk,--rw,")
+               ."--load-module=$ntoskrnl,--filesystem=$filesystem,"
+               ."--sandbox-server=$captive_sandbox_server_bin,"
+               ."--bug-pathname=$vardir/bug-%FT%T.captivebug.xml.gz,"
+               ."mntent.mnt_fsname=$image,mntent.mnt_type=captive-$fsname,"    # Double-dashes forbidden.
+               ."image=$image,"
+               .$oo;
+
+warn "$0: '-n' not supported - ignored" if $nomtab;
+
+# Use "'$oo'" to permit another expansion by bash(1) during lufsmnt(8) execution.
+my @argv=($lufsmount_bin,"captivefs://",$dir,"-o","'$oo'");
+
+print STDERR "$0: @argv\n" if $verbose;
+exec $lufsmount_bin @argv;
+die "Failed to execute: @argv";