Archivemount is a piece of glue code between libarchive

(http://people.freebsd.org/~kientzle/libarchive/) and FUSE
(http://fuse.sourceforge.net). It can be used to mount a (possibly compressed)
archive (as in .tar.gz or .tar.bz2) and use it like an ordinary filesystem.

WWW: http://www.cybernoia.de/software/archivemount/

PR:		ports/124793
Submitted by:	Evgeny Zhirnov <jirnov at gmail.com>
This commit is contained in:
Martin Wilke 2008-06-21 12:46:43 +00:00
parent 7f9f37e2b9
commit 5572fb2f44
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=215460
6 changed files with 145 additions and 0 deletions

View File

@ -29,6 +29,7 @@
SUBDIR += apcupsd
SUBDIR += apt
SUBDIR += arcconf
SUBDIR += archivemount
SUBDIR += areca-cli
SUBDIR += asapm
SUBDIR += ascpu

View File

@ -0,0 +1,35 @@
# New ports collection makefile for: archivemount
# Date created: 2008-06-20
# Whom: Evgeny Zhirnov <jirnov@gmail.com>
#
# $FreeBSD$
#
PORTNAME= archivemount
PORTVERSION= 0.5.3
CATEGORIES= sysutils
MASTER_SITES= http://www.cybernoia.de/software/archivemount/
MAINTAINER= jirnov@gmail.com
COMMENT= Mount archives with FUSE
BUILD_DEPENDS= ${LOCALBASE}/include/fuse.h:${PORTSDIR}/sysutils/fusefs-libs
RUN_DEPENDS= ${LOCALBASE}/modules/fuse.ko:${PORTSDIR}/sysutils/fusefs-kmod
PLIST_FILES= bin/archivemount
NO_INSTALL_MANPAGES= yes
USE_GMAKE= yes
USE_ICONV= yes
USE_GCC= 4.2+
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/archivemount ${PREFIX}/bin
.include <bsd.port.pre.mk>
.if ${OSVERSION} < 600000 # Inherited from fusefs-kmod
IGNORE= requires FreeBSD 6.x or above
.endif
.include <bsd.port.post.mk>

View File

@ -0,0 +1,3 @@
MD5 (archivemount-0.5.3.tar.gz) = 1a3b2901388c4854199471e67c303797
SHA256 (archivemount-0.5.3.tar.gz) = 5bcb193a753395f912bdccff6fd08018ae0fba253a97087bc717ccf87682815a
SIZE (archivemount-0.5.3.tar.gz) = 20267

View File

@ -0,0 +1,13 @@
--- Makefile.orig 2006-12-28 18:32:47.000000000 +0300
+++ Makefile 2008-06-20 20:04:50.000000000 +0400
@@ -12,8 +12,8 @@
CC = gcc
all: $(EXE)
-CFLAGS += -D_FILE_OFFSET_BITS=64
-LDFLAGS = -larchive -lfuse
+CFLAGS += -D_FILE_OFFSET_BITS=64 -I/usr/local/include/fuse
+LDFLAGS = -larchive -liconv -lfuse -pthread -L/usr/local/lib
ifeq ($(DEBUG),1)
CFLAGS += -ggdb -O0

View File

@ -0,0 +1,87 @@
--- archivemount.c.orig 2006-12-28 18:32:47.000000000 +0300
+++ archivemount.c 2008-06-20 20:31:46.000000000 +0400
@@ -19,7 +19,7 @@
#define _GNU_SOURCE 1
#endif
-#define FUSE_USE_VERSION 22
+#define FUSE_USE_VERSION 25
#define MAXBUF 4096
#include <fuse.h>
@@ -31,7 +31,9 @@
#include <fcntl.h>
#include <dirent.h>
#include <errno.h>
+#ifdef HAVE_STATFS
#include <sys/statfs.h>
+#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
@@ -42,6 +44,7 @@
#include <wchar.h>
#include <archive.h>
#include <archive_entry.h>
+#include <limits.h>
/**********/
/* macros */
@@ -433,9 +436,14 @@
strlen( P_tmpdir ) +
strlen( "_archivemount" ) +
strlen( tmppath ) + 8 );
- sprintf( *location, "%s/archivemount%s_XXXXXX", P_tmpdir, tmppath );
+ sprintf( *location, "/tmp/archivemount%s_XXXXXX", tmppath );
free( tmppath );
- if( ( fh = mkstemp( *location ) == -1 ) ) {
+
+ char bsdLocation[PATH_MAX];
+
+ strcpy(bsdLocation, *location);
+
+ if( ( fh = mkstemp(bsdLocation ) == -1 ) ) {
log( "Could not create temp file name %s: %s",
*location, strerror( errno ) );
free( *location );
@@ -1449,7 +1457,13 @@
return tmp;
}
/* create temp file */
- if( mknod( location, mode, rdev ) == -1 ) {
+ if (S_ISREG( mode )) {
+ tmp = open( location, O_CREAT | O_EXCL | O_WRONLY, mode );
+ } else if (S_ISFIFO( mode ))
+ tmp = mkfifo( location, mode );
+ else
+ tmp = mknod( location, mode, rdev );
+ if( tmp == -1 ) {
log( "Could not create temporary file %s: %s",
location, strerror( errno ) );
free( location );
@@ -1604,6 +1618,7 @@
return 0;
}
+#ifdef HAVE_STATFS
static int
ar_statfs( const char *path, struct statfs *stbuf )
{
@@ -1613,6 +1628,7 @@
return -ENOSYS;
}
+#endif
static int
ar_rename( const char *from, const char *to )
@@ -1753,7 +1769,9 @@
.open = ar_open,
.read = ar_read,
.write = ar_write,
+#ifdef HAVE_STATFS
.statfs = ar_statfs,
+#endif
.release = ar_release,
.fsync = ar_fsync,
/*

View File

@ -0,0 +1,6 @@
Archivemount is a piece of glue code between libarchive
(http://people.freebsd.org/~kientzle/libarchive/) and FUSE
(http://fuse.sourceforge.net). It can be used to mount a (possibly compressed)
archive (as in .tar.gz or .tar.bz2) and use it like an ordinary filesystem.
WWW: http://www.cybernoia.de/software/archivemount/