diff options
-rw-r--r-- | system/zfs-fuse/README | 10 | ||||
-rw-r--r-- | system/zfs-fuse/doinst.sh | 24 | ||||
-rw-r--r-- | system/zfs-fuse/rc.zfs-fuse | 152 | ||||
-rw-r--r-- | system/zfs-fuse/slack-desc | 19 | ||||
-rw-r--r-- | system/zfs-fuse/zfs-fuse.SlackBuild | 55 | ||||
-rw-r--r-- | system/zfs-fuse/zfs-fuse.info | 10 |
6 files changed, 270 insertions, 0 deletions
diff --git a/system/zfs-fuse/README b/system/zfs-fuse/README new file mode 100644 index 0000000000000..1a8ed7f027149 --- /dev/null +++ b/system/zfs-fuse/README @@ -0,0 +1,10 @@ +ZFS on FUSE/Linux + +This project is a port of the ZFS filesystem to FUSE/Linux, done as part +of the Google Summer of Code 2006 initiative. + +Currently ZFS-FUSE is configured to use up to 128 MB of RAM, but it can +grow larger with some usage patterns. It's recommended to have a machine +with at least 1 GB of RAM. + +This requires scons. diff --git a/system/zfs-fuse/doinst.sh b/system/zfs-fuse/doinst.sh new file mode 100644 index 0000000000000..c298908b52cbc --- /dev/null +++ b/system/zfs-fuse/doinst.sh @@ -0,0 +1,24 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} +preserve_perms() { + NEW="$1" + OLD="$(dirname ${NEW})/$(basename ${NEW} .new)" + if [ -e ${OLD} ]; then + cp -a ${OLD} ${NEW}.incoming + cat ${NEW} > ${NEW}.incoming + mv ${NEW}.incoming ${NEW} + fi + config ${NEW} +} +preserve_perms etc/rc.d/rc.zfs-fuse.new + diff --git a/system/zfs-fuse/rc.zfs-fuse b/system/zfs-fuse/rc.zfs-fuse new file mode 100644 index 0000000000000..a574c62c2fae0 --- /dev/null +++ b/system/zfs-fuse/rc.zfs-fuse @@ -0,0 +1,152 @@ +#! /bin/sh + +# chkconfig: 12345 13 87 +# description: Starts and stops the ZFS file systems +# author: Manuel Amador (Rudd-O) + +PIDFILE=/var/run/zfs-fuse.pid +LOCKFILE=/var/lock/zfs/zfs_lock + +# Source function library. +. /etc/init.d/functions + +# Source cmdline opts +OPTIONS= +[ -f /etc/sysconfig/zfs-fuse ] && . /etc/sysconfig/zfs-fuse + +export PATH=/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin +unset LANG +ulimit -v unlimited +ulimit -c unlimited +ulimit -l unlimited + +do_start() { + PID=$(cat "$PIDFILE" 2> /dev/null) + if [ "$PID" != "" ] + then + if kill -0 $PID 2> /dev/null + then + echo -n "ZFS-FUSE is already running" + failure + exit 3 + else + # pid file is stale, we clean up shit + action "Cleaning up stale ZFS-FUSE PID files" rm -f "$PIDFILE" + fi + fi + + export DAEMON_COREFILE_LIMIT=unlimited + action "Starting ZFS-FUSE process" daemon --pidfile $PIDFILE zfs-fuse -p "$PIDFILE" $OPTIONS + ES_TO_REPORT=$? + if [ 0 != $ES_TO_REPORT ] ; then + exit $ES_TO_REPORT + fi + + for a in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + do + PID=$(cat "$PIDFILE" 2> /dev/null) + [ "$PID" != "" ] && break + sleep 1 + done + + if [ "$PID" = "" ] + then + echo -n "ZFS-FUSE did not start or create $PIDFILE" + failure + exit 3 + fi + + action "Immunizing ZFS-FUSE against OOM kills and sendsigs signals" true + echo -17 > "/proc/$PID/oom_adj" + ES_TO_REPORT=$? + if [ 0 != $ES_TO_REPORT ] ; then + exit $ES_TO_REPORT + fi + + sleep 1 + action "Mounting ZFS filesystems" zfs mount -a + ES_TO_REPORT=$? + if [ 0 != $ES_TO_REPORT ] ; then + exit $ES_TO_REPORT + fi + +} + +do_stop () { + PID=$(cat "$PIDFILE" 2> /dev/null) + if [ "$PID" = "" ] ; then + # no pid file, we exit + exit 0 + elif kill -0 $PID 2> /dev/null; then + # pid file and killable, we continue + true + else + # pid file is stale, we clean up shit + action "Cleaning up stale ZFS-FUSE PID files" rm -f "$PIDFILE" + exit 0 + fi + + action "Syncing disks" sync + + action "Unmounting ZFS filesystems" zfs unmount -a + ES_TO_REPORT=$? + if [ 0 != $ES_TO_REPORT ] ; then + exit $ES_TO_REPORT + fi + + action "Terminating ZFS-FUSE process gracefully" kill -TERM $PID + + for a in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + do + kill -0 $PID 2> /dev/null + [ "$?" != "0" ] && break + sleep 1 + done + + if kill -0 $PID 2> /dev/null + then + echo -n "ZFS-FUSE refused to die after 15 seconds" + failure + exit 3 + else + rm -f "$PIDFILE" + fi + + action "Syncing disks again" sync +} + +case "$1" in + start) + do_start + ;; + stop) + do_stop + ;; + status) + PID=$(cat "$PIDFILE" 2> /dev/null) + if [ "$PID" = "" ] ; then + echo "ZFS-FUSE is not running" + exit 3 + else + if kill -0 $PID + then + echo "ZFS-FUSE is running, pid $PID" + zpool status + exit 0 + else + echo "ZFS-FUSE died, PID files stale" + exit 3 + fi + fi + ;; + restart|reload|force-reload) + echo "Error: argument '$1' not supported" >&2 + exit 3 + ;; + *) + echo "Usage: $0 start|stop|status" >&2 + exit 3 + ;; +esac + +: diff --git a/system/zfs-fuse/slack-desc b/system/zfs-fuse/slack-desc new file mode 100644 index 0000000000000..03eceefe1b378 --- /dev/null +++ b/system/zfs-fuse/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +zfs-fuse: zfs-fuse (Z File System over Fuse) +zfs-fuse: +zfs-fuse: ZFS is the most advanced file system ever invented. This project +zfs-fuse: makes it possible to create, mount, use and manage ZFS file +zfs-fuse: systems under Linux, bringing the uncontested reliability and +zfs-fuse: large feature set of ZFS to the Linux world. +zfs-fuse: +zfs-fuse: +zfs-fuse: +zfs-fuse: +zfs-fuse: diff --git a/system/zfs-fuse/zfs-fuse.SlackBuild b/system/zfs-fuse/zfs-fuse.SlackBuild new file mode 100644 index 0000000000000..98d6698e20acf --- /dev/null +++ b/system/zfs-fuse/zfs-fuse.SlackBuild @@ -0,0 +1,55 @@ +#!/bin/sh + +# Slackware build script for ZFS-Fuse +# Steven King revision date 2010/01/17 + +PRGNAM=zfs-fuse +VERSION=0.6.0 +ARCH=${ARCH:-i486} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +rm -rf $TMP/$PRGNAM-$VERSION +cd $TMP +tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2 +cd $PRGNAM-$VERSION +chown -R root:root . +chmod -R u+w,go+r-w,a-s . + +cd src + scons + scons install install_dir=$PKG/usr/sbin +cd .. + +# Install init script +mkdir -p $PKG/etc/rc.d +cat $CWD/rc.zfs-fuse > $PKG/etc/rc.d/rc.zfs-fuse.new + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a \ + BUGS HACKING LICENSE TESTING CHANGES INSTALL README* STATUS TODO \ + $PKG/usr/doc/$PRGNAM-$VERSION +find $PKG/usr/doc/$PRGNAM-$VERSION -type f -exec chmod 644 {} \; +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/usr/man/man8 +cp doc/*.8.gz $PKG/usr/man/man8 + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/system/zfs-fuse/zfs-fuse.info b/system/zfs-fuse/zfs-fuse.info new file mode 100644 index 0000000000000..b98e688cc426c --- /dev/null +++ b/system/zfs-fuse/zfs-fuse.info @@ -0,0 +1,10 @@ +PRGNAM="zfs-fuse" +VERSION="0.6.0" +HOMEPAGE="http://zfs-fuse.net" +DOWNLOAD="http://zfs-fuse.net/releases/0.6.0/zfs-fuse-0.6.0.tar.bz2" +MD5SUM="c0e1d0d3406f7a1ac203708e5ecdc6dd" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +MAINTAINER="Steven King" +EMAIL="kingrst@gmail.com" +APPROVED="rworkman" |