diff --git a/sysutils/Makefile b/sysutils/Makefile index 9c297db14235..88d00ae74f14 100644 --- a/sysutils/Makefile +++ b/sysutils/Makefile @@ -169,6 +169,7 @@ SUBDIR += freesbie SUBDIR += fsbackup SUBDIR += ftrace + SUBDIR += fusefs-kmod SUBDIR += fusefs-libs SUBDIR += fvcool SUBDIR += gag diff --git a/sysutils/fusefs-kmod/Makefile b/sysutils/fusefs-kmod/Makefile new file mode 100644 index 000000000000..bdf406eb167f --- /dev/null +++ b/sysutils/fusefs-kmod/Makefile @@ -0,0 +1,62 @@ +# New ports collection makefile for: fusefs-kmod +# Date created: 08 October 2005 +# Whom: Anish Mistry +# +# $FreeBSD$ +# + +PORTNAME= fusefs +PORTVERSION= 0.2.19.6 +CATEGORIES= sysutils +MASTER_SITES= http://fuse4bsd.creo.hu/downloads/ \ + http://am-productions.biz/docs/ +PKGNAMESUFFIX= -kmod +DISTNAME= fuse4bsd-0.2.20pre6 +EXTRACT_SUFX= .tar.bz2 + +MAINTAINER= amistry@am-productions.biz +COMMENT= Kernel module for fuse + +BUILD_DEPENDS= ${LOCALBASE}/include/fuse/fuse_kernel.h:${PORTSDIR}/sysutils/fusefs-libs + +OPTIONS= AUTOSETUP "Automatic global config file setup" off +MAKE_ENV+= BINDIR=${PREFIX}/sbin MANDIR=${PREFIX}/man/man +MAN8= mount_fusefs.8 +KMODDIR= ${PREFIX}/modules +MAKE_ARGS= KMODDIR=${KMODDIR} +SRC_BASE?= /usr/src +STARTUP= fuse.sh +SETUP= setup.sh +MODULE_PATH= `sysctl -n kern.module_path`;${KMODDIR} + +.include + +.if ( ${OSVERSION} >= 600000 && ${OSVERSION} < 600034 ) || ( ${OSVERSION} >= 700000 && ${OSVERSION} < 700002 ) +MAKE_ARGS+= -DUSE_OLD_CLONEHANDLER_API +.endif + +.if ${OSVERSION} < 600000 +IGNORE= requires FreeBSD 6 or above. Please consider porting it to 5.x or even 4.x +.endif + +.if !exists(${SRC_BASE}/sys/Makefile) +IGNORE= requires the Kernel source to be installed. Set SRC_BASE if it is not in /usr/src +.endif + +pre-install: + ${MKDIR} ${KMODDIR} + +post-install: + ${INSTALL_SCRIPT} ${FILESDIR}/${STARTUP} ${PREFIX}/etc/rc.d/ +.if (defined(WITH_AUTOSETUP) && !defined(BATCH) && !defined(PACKAGE_BUILDING)) \ + || (defined(WITH_AUTOSETUP) && defined(BATCH) && !defined(PACKAGE_BUILDING)) + @${SED} -e 's|@@PREFIX@@|${PREFIX}|g' \ + ${FILESDIR}/${SETUP} > ${WRKDIR}/${SETUP} + @${ECHO} "Modifying global startup config files and loading module..."; + ${SH} ${WRKDIR}/${SETUP} +.else + @${SED} -e "s|%%PREFIX%%|${PREFIX}|g" \ + -e "s|%%MODULE_PATH%%|${MODULE_PATH}|g" ${PKGMESSAGE} +.endif + +.include diff --git a/sysutils/fusefs-kmod/distinfo b/sysutils/fusefs-kmod/distinfo new file mode 100644 index 000000000000..829b020af345 --- /dev/null +++ b/sysutils/fusefs-kmod/distinfo @@ -0,0 +1,2 @@ +MD5 (fuse4bsd-0.2.20pre6.tar.bz2) = e2c48e940b1fdcb669add847e42011c0 +SIZE (fuse4bsd-0.2.20pre6.tar.bz2) = 71336 diff --git a/sysutils/fusefs-kmod/files/fuse.sh b/sysutils/fusefs-kmod/files/fuse.sh new file mode 100644 index 000000000000..0668d59f7178 --- /dev/null +++ b/sysutils/fusefs-kmod/files/fuse.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# $FreeBSD$ + +# PROVIDE: fusefs +# REQUIRE: sysctl +# KEYWORD: FreeBSD shutdown + +[ -z "${fusefs_enable}" ] && fusefs_enable="NO" + +kmod=fuse.ko +name=fusefs + +. /etc/rc.subr + +rcvar=`set_rcvar` + +start_cmd="fusefs_start" +stop_cmd="fusefs_stop" + +load_rc_config $name + +fusefs_start() +{ + echo "Loading ${name}" + kldload $kmod +} + +fusefs_stop() +{ + echo "Unloading ${name}" + kldunload $kmod +} + +run_rc_command $* diff --git a/sysutils/fusefs-kmod/files/patch-fuse_module_Makefile b/sysutils/fusefs-kmod/files/patch-fuse_module_Makefile new file mode 100644 index 000000000000..d467cfe48593 --- /dev/null +++ b/sysutils/fusefs-kmod/files/patch-fuse_module_Makefile @@ -0,0 +1,18 @@ +--- fuse_module/Makefile.orig Sun Oct 16 09:01:26 2005 ++++ fuse_module/Makefile Tue Oct 18 11:58:20 2005 +@@ -35,12 +35,11 @@ + + fuse.ko: fuse_kernel.h vnode_if.h vnode_if_typedef.h vnode_if_newproto.h + +-fuse_kernel.h: fuse_kernel.h.orig +- cp fuse_kernel.h.orig fuse_kernel.h +- patch fuse_kernel.h < kernel-header.diff ++fuse_kernel.h: ++ cp ${LOCALBASE}/include/fuse/fuse_kernel.h fuse_kernel.h + + fuse_opnames.c: +- awk -f ../tools/genopnames.awk fuse_kernel.h.orig > fuse_opnames.c ++ awk -f ../tools/genopnames.awk fuse_kernel.h > fuse_opnames.c + + vnode_if.h: + awk -f /sys/tools/vnode_if.awk /sys/kern/vnode_if.src -h diff --git a/sysutils/fusefs-kmod/files/setup.sh b/sysutils/fusefs-kmod/files/setup.sh new file mode 100644 index 000000000000..922eb708fed7 --- /dev/null +++ b/sysutils/fusefs-kmod/files/setup.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# +# Automatically setup the loading of the module without polluting /boot/modules +SYSCTL_CONFIG=/etc/sysctl.conf +LOADER_CONFIG=/etc/rc.conf + +sysctl kern.module_path | grep "[:space:;=]@@PREFIX@@/modules[;]\?\b" > /dev/null 2>&1; RESULT=$? +if [ ${RESULT} -eq 1 ]; then + MODULE_PATH="`sysctl -n kern.module_path`;@@PREFIX@@/modules" + sysctl "kern.module_path=${MODULE_PATH}" +else + MODULE_PATH=`sysctl -n kern.module_path` +fi + +grep "kern\.module_path" ${SYSCTL_CONFIG} > /dev/null 2>&1; RESULT=$? +if [ ${RESULT} -eq 0 ]; then + # Variable present + grep "kern\.module_path" ${SYSCTL_CONFIG} | grep "[:space:;=]@@PREFIX@@/modules[;]\?\b" ${SYSCTL_CONFIG} > /dev/null 2>&1; RESULT=$? + if [ ${RESULT} -eq 1 ]; then + # Not present in variable, so add + ESC_PREFIX=`echo '@@PREFIX@@' | sed -e 's/\//\\\\\//g'` + sed -i .orig -e 's/kern\.module_path[:space:]*=[:space:]*["]*\([[:alnum:][:space:]\.,;\/_-]*\)["]*/kern\.module_path="\1;'${ESC_PREFIX}'\/modules"/g' ${SYSCTL_CONFIG} + fi +else + # Not present. + echo kern.module_path="${MODULE_PATH}" >> ${SYSCTL_CONFIG} +fi + + +kldstat -n fuse > /dev/null 2>&1; RESULT=$? +if [ ${RESULT} -eq 0 ]; then + kldunload -n fuse > /dev/null 2>&1; RESULT=$? + if [ ${RESULT} -ne 0 ]; then + echo 'NOTICE: Failed to unload the Fuse module!' + echo 'NOTICE: Is fuse.ko in use?' + fi +fi + +grep fusefs_enable ${LOADER_CONFIG} > /dev/null 2>&1; RESULT=$? +if [ ${RESULT} -eq 0 ]; then + # Present, we should leave it alone +# sed -e s/fusefs_enable.*/fuse_load=\"YES\"/g -i.orig ${LOADER_CONFIG} +else + # Not present. First time install, so lets start it up + echo 'fusefs_enable="YES"' >> ${LOADER_CONFIG} +fi + +@@PREFIX@@/etc/rc.d/fuse.sh start > /dev/null 2>&1 ; RESULT=$? +if [ ${RESULT} -ne 0 ]; then + echo 'NOTICE: Failed to load the Fuse module!' + echo 'NOTICE: Unload and load Fuse module manually, or reboot.' +fi diff --git a/sysutils/fusefs-kmod/pkg-descr b/sysutils/fusefs-kmod/pkg-descr new file mode 100644 index 000000000000..08ad9cd0dcc4 --- /dev/null +++ b/sysutils/fusefs-kmod/pkg-descr @@ -0,0 +1,3 @@ +Kernel module for fusefs based filesystems. + +WWW: http://wikitest.freebsd.org/moin.cgi/FuseFilesystem diff --git a/sysutils/fusefs-kmod/pkg-message b/sysutils/fusefs-kmod/pkg-message new file mode 100644 index 000000000000..6a58112a016e --- /dev/null +++ b/sysutils/fusefs-kmod/pkg-message @@ -0,0 +1,10 @@ +In order to automatically load the fuse module on startup, you need to +set the following settings: + + - Set the module path in /etc/sysctl.conf: + kern.module_path=%%MODULE_PATH%% + + - Add fusefs_enable="YES" to your /etc/rc.conf + +%%PREFIX%%/etc/rc.d/fuse.sh start will load the module for the first time +after the installation. diff --git a/sysutils/fusefs-kmod/pkg-plist b/sysutils/fusefs-kmod/pkg-plist new file mode 100644 index 000000000000..90921a7379b7 --- /dev/null +++ b/sysutils/fusefs-kmod/pkg-plist @@ -0,0 +1,6 @@ +etc/rc.d/fuse.sh +modules/fuse.ko +sbin/mount_fusefs +sbin/mount_fusefs_safe +@unexec kldxref %D/modules +@unexec rmdir %D/modules 2>/dev/null || true