Skip to content

Commit

Permalink
Add init script
Browse files Browse the repository at this point in the history
  • Loading branch information
szmi committed Oct 1, 2006
1 parent 0740785 commit 4003dfa
Show file tree
Hide file tree
Showing 13 changed files with 108 additions and 6 deletions.
10 changes: 10 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
2006-10-01 Miklos Szeredi <[email protected]>

* Add init script to insert fuse module and mount the control
filesystem. The script is installed as /etc/init.d/fuse and on
debian based systems (where update-rc.d is available) symlinks
from /etc/rc*.d/ are also installed.

* Include '#define FUSE_USE_VERSION=XX' into examples so they
become more self contained.

2006-09-30 Miklos Szeredi <[email protected]>

* API changes:
Expand Down
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ What is new in 2.6

- Building module for Linux kernels earlier than 2.6.9 not supported

- Allow block device based filesystems to support swap files

What is new in 2.5

- Merge library part of FreeBSD port
Expand Down
7 changes: 5 additions & 2 deletions configure.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT(fuse, 2.6.0-rc1)
AC_INIT(fuse, 2.6.0-rc2)
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(include/config.h)
Expand All @@ -21,7 +21,6 @@ esac
if test "$ac_env_CFLAGS_set" != set; then
CFLAGS="-Wall -W -g -O2"
fi
CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DFUSE_USE_VERSION=26"

AC_ARG_ENABLE(kernel-module,
[ --enable-kernel-module Compile kernel module ])
Expand Down Expand Up @@ -77,6 +76,10 @@ if test -z "$UDEV_RULES_PATH"; then
UDEV_RULES_PATH=/etc/udev/rules.d
fi
AC_SUBST(UDEV_RULES_PATH)
if test -z "$INIT_D_PATH"; then
INIT_D_PATH=/etc/init.d
fi
AC_SUBST(INIT_D_PATH)

AC_SUBST(subdirs2)

Expand Down
2 changes: 1 addition & 1 deletion example/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in

AM_CPPFLAGS = -I$(top_srcdir)/include
AM_CPPFLAGS = -I$(top_srcdir)/include -D_FILE_OFFSET_BITS=64 -D_REENTRANT
noinst_PROGRAMS = fusexmp fusexmp_fh null hello hello_ll

LDADD = ../lib/libfuse.la -lpthread
Expand Down
4 changes: 4 additions & 0 deletions example/fusexmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
This program can be distributed under the terms of the GNU GPL.
See the file COPYING.
gcc -Wall `pkg-config fuse --cflags --libs` fusexmp.c -o fusexmp
*/

#define FUSE_USE_VERSION 26

#include <config.h>

#ifdef linux
Expand Down
4 changes: 4 additions & 0 deletions example/fusexmp_fh.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
This program can be distributed under the terms of the GNU GPL.
See the file COPYING.
gcc -Wall `pkg-config fuse --cflags --libs` fusexmp_fh.c -o fusexmp_fh
*/

#define FUSE_USE_VERSION 26

#include <config.h>

#define _GNU_SOURCE
Expand Down
4 changes: 4 additions & 0 deletions example/hello.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
This program can be distributed under the terms of the GNU GPL.
See the file COPYING.
gcc -Wall `pkg-config fuse --cflags --libs` hello.c -o hello
*/

#define FUSE_USE_VERSION 26

#include <fuse.h>
#include <stdio.h>
#include <string.h>
Expand Down
4 changes: 4 additions & 0 deletions example/hello_ll.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
This program can be distributed under the terms of the GNU GPL.
See the file COPYING.
gcc -Wall `pkg-config fuse --cflags --libs` hello_ll.c -o hello_ll
*/

#define FUSE_USE_VERSION 26

#include <fuse_lowlevel.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down
4 changes: 4 additions & 0 deletions example/null.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
This program can be distributed under the terms of the GNU GPL.
See the file COPYING.
gcc -Wall `pkg-config fuse --cflags --libs` null.c -o null
*/

#define FUSE_USE_VERSION 26

#include <fuse.h>
#include <string.h>
#include <unistd.h>
Expand Down
2 changes: 1 addition & 1 deletion kernel/configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT(fuse-kernel, 2.6.0-rc1)
AC_INIT(fuse-kernel, 2.6.0-rc2)
AC_CONFIG_HEADERS([config.h])

AC_PROG_INSTALL
Expand Down
4 changes: 3 additions & 1 deletion lib/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## Process this file with automake to produce Makefile.in

AM_CPPFLAGS = -I$(top_srcdir)/include -DFUSERMOUNT_DIR=\"$(bindir)\"
AM_CPPFLAGS = -I$(top_srcdir)/include -DFUSERMOUNT_DIR=\"$(bindir)\" \
-D_FILE_OFFSET_BITS=64 -D_REENTRANT -DFUSE_USE_VERSION=26

lib_LTLIBRARIES = libfuse.la libulockmgr.la

if BSD
Expand Down
14 changes: 13 additions & 1 deletion util/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,21 @@ install-exec-hook:
mknod $(DESTDIR)/dev/fuse -m 0666 c 10 229; \
fi

EXTRA_DIST = mount.fuse udev.rules
EXTRA_DIST = mount.fuse udev.rules init_script

MOUNT_FUSE_PATH = @MOUNT_FUSE_PATH@
UDEV_RULES_PATH = @UDEV_RULES_PATH@
INIT_D_PATH = @INIT_D_PATH@

install-exec-local:
$(mkdir_p) $(DESTDIR)$(MOUNT_FUSE_PATH)
$(INSTALL_PROGRAM) $(srcdir)/mount.fuse $(DESTDIR)$(MOUNT_FUSE_PATH)/mount.fuse
$(mkdir_p) $(DESTDIR)$(INIT_D_PATH)
$(INSTALL_PROGRAM) $(srcdir)/init_script $(DESTDIR)$(INIT_D_PATH)/fuse
@if test -x /usr/sbin/update-rc.d; then \
echo "/usr/sbin/update-rc.d fuse start 34 S . start 41 0 6 ."; \
/usr/sbin/update-rc.d fuse start 34 S . start 41 0 6 .; \
fi

install-data-local:
$(mkdir_p) $(DESTDIR)$(UDEV_RULES_PATH)
Expand All @@ -32,3 +39,8 @@ install-data-local:
uninstall-local:
rm -f $(DESTDIR)$(MOUNT_FUSE_PATH)/mount.fuse
rm -f $(DESTDIR)$(UDEV_RULES_PATH)/60-fuse.rules
rm -f $(DESTDIR)$(INIT_D_PATH)/fuse
@if test -x /usr/sbin/update-rc.d; then \
echo "/usr/sbin/update-rc.d fuse remove"; \
/usr/sbin/update-rc.d fuse remove; \
fi
53 changes: 53 additions & 0 deletions util/init_script
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#! /bin/sh
#
# fuse Init script for Filesystem in Userspace
#
# Author: Miklos Szeredi <[email protected]>

set -e

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
SCRIPTNAME=/etc/init.d/fuse
DESC="FUSE"
MOUNTPOINT=/sys/fs/fuse/connections

# Gracefully exit if the package has been removed.
test -x `which fusermount` || exit 0

error()
{
echo "Error $1" >&2
exit 1
}

case "$1" in
start)
echo -n "Starting $DESC: "
if ! grep -qw fuse /proc/filesystems; then
modprobe fuse >/dev/null 2>&1 || error "loading fuse module"
fi
if grep -qw fusectl /proc/filesystems && \
! grep -qw $MOUNTPOINT /proc/mounts; then
mount -t fusectl none $MOUNTPOINT >/dev/null 2>&1 || \
error "mounting control filesystem"
fi
echo "done."
;;
stop)
echo -n "Stopping $DESC: "
if grep -qw $MOUNTPOINT /proc/mounts; then
umount $MOUNTPOINT >/dev/null 2>&1 || \
error "unmounting control filesystem"
fi
if grep -qw "^fuse" /proc/modules; then
rmmod fuse >/dev/null 2>&1 || error "unloading fuse module"
fi
echo "done."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop}" >&2
exit 1
;;
esac

exit 0

0 comments on commit 4003dfa

Please sign in to comment.