diff options
Diffstat (limited to 'system/zfs-on-linux')
-rw-r--r-- | system/zfs-on-linux/README | 17 | ||||
-rw-r--r-- | system/zfs-on-linux/doinst.sh | 29 | ||||
-rw-r--r-- | system/zfs-on-linux/rc.zfs | 126 | ||||
-rw-r--r-- | system/zfs-on-linux/slack-desc | 19 | ||||
-rw-r--r-- | system/zfs-on-linux/zfs-on-linux.SlackBuild | 126 | ||||
-rw-r--r-- | system/zfs-on-linux/zfs-on-linux.info | 10 |
6 files changed, 327 insertions, 0 deletions
diff --git a/system/zfs-on-linux/README b/system/zfs-on-linux/README new file mode 100644 index 0000000000000..8c15815da6482 --- /dev/null +++ b/system/zfs-on-linux/README @@ -0,0 +1,17 @@ +ZFS is a modern filesystem originally developed for SOLARIS. +It provides many functionalities such as snapshots, data compression, +data recovery and many more. + +For more information about ZFS on linux, visit http://zfsonlinux.org + +You'll need the kernel source code to be able to compile this. +This package is kernel dependent, so you'll need to recompile it +for every new kernel you choose to run. + +If you don't have a /usr/src/linux symlink pointing to your real +kernel directory (the script looks for it there by default), specify +your kernel source destination by + + LINUXPATH=<path to your kernel source> ./zfs-on-linux.SlackBuild + +NOTE: you better run this on x86_64 systems. diff --git a/system/zfs-on-linux/doinst.sh b/system/zfs-on-linux/doinst.sh new file mode 100644 index 0000000000000..abc7164225735 --- /dev/null +++ b/system/zfs-on-linux/doinst.sh @@ -0,0 +1,29 @@ +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.new + +if [ -x /sbin/depmod ]; then + chroot . /sbin/depmod -a >/dev/null 2>&1 +fi diff --git a/system/zfs-on-linux/rc.zfs b/system/zfs-on-linux/rc.zfs new file mode 100644 index 0000000000000..a42922b1244ed --- /dev/null +++ b/system/zfs-on-linux/rc.zfs @@ -0,0 +1,126 @@ +#!/bin/bash +# +# zfs This script will mount/umount the zfs filesystems. +# +# chkconfig: 2345 01 99 +# description: This script will mount/umount the zfs filesystems during +# system boot/shutdown. Configuration of which filesystems +# should be mounted is handled by the zfs 'mountpoint' and +# 'canmount' properties. See the zfs(8) man page for details. +# It is also responsible for all userspace zfs services. +# +### BEGIN INIT INFO +# Provides: zfs +# Required-Start: $local_fs +# Required-Stop: $local_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Should-Stop: +# Short-Description: Mount/umount the zfs filesystems +# Description: ZFS is an advanced filesystem designed to simplify managing +# and protecting your data. This service mounts the ZFS +# filesystems and starts all related zfs services. +### END INIT INFO + +# Source function library. +. /etc/rc.d/init.d/functions + +LOCKFILE=/var/lock/zfs/zfs +ZFS="/sbin/zfs" +ZPOOL="/sbin/zpool" +ZPOOL_CACHE="/etc/zfs/zpool.cache" + +# Source zfs configuration. +[ -r '/etc/default/zfs' ] && . /etc/default/zfs + +[ -x "$ZPOOL" ] || exit 1 +[ -x "$ZFS" ] || exit 2 + +start() +{ + [ -f "$LOCKFILE" ] && return 3 + + # Requires selinux policy which has not been written. + if [ -r "/selinux/enforce" ] && + [ "$(cat /selinux/enforce)" = "1" ]; then + + echo "SELinux ZFS policy required" + return 4 + fi + + # Delay until all required block devices are present. + udevadm settle + + # Load the zfs module stack + /sbin/modprobe zfs + + # Ensure / exists in /etc/mtab, if not update mtab accordingly. + # This should be handled by rc.sysinit but lets be paranoid. + awk '$2 == "/" { exit 1 }' /etc/mtab + RETVAL=$? + if [ "$RETVAL" -eq 0 ]; then + /bin/mount -f / + fi + + # Import all pools described by the cache file, and then mount + # all filesystem based on their properties. + if [ -f "$ZPOOL_CACHE" ] ; then + echo "Importing ZFS pools" + "$ZPOOL" import -fc "$ZPOOL_CACHE" -aN 2>/dev/null + + echo "Mounting ZFS filesystems" + "$ZFS" mount -a + + echo "Exporting ZFS filesystems" + "$ZFS" share -a + fi + + touch "$LOCKFILE" +} + +stop() +{ + [ ! -f "$LOCKFILE" ] && return 3 + + echo "Unmounting ZFS filesystems" + "$ZFS" umount -a + + rm -f "$LOCKFILE" +} + +status() +{ + [ ! -f "$LOCKFILE" ] && return 3 + + "$ZPOOL" status && echo "" && "$ZPOOL" list +} + +case "$1" in + start) + start + RETVAL=$? + ;; + stop) + stop + RETVAL=$? + ;; + status) + status + RETVAL=$? + ;; + restart) + stop + start + ;; + condrestart) + if [ -f "$LOCKFILE" ]; then + stop + start + fi + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart}" + ;; +esac + +exit $RETVAL diff --git a/system/zfs-on-linux/slack-desc b/system/zfs-on-linux/slack-desc new file mode 100644 index 0000000000000..741bc227deb5b --- /dev/null +++ b/system/zfs-on-linux/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 ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +zfs-on-linux: zfs-on-linux +zfs-on-linux: +zfs-on-linux: ZFS is a modern filesystem originaly developed for SOLARIS. +zfs-on-linux: It provides many functionalities such as snapshots, data +zfs-on-linux: compression, data recovery and many more. +zfs-on-linux: +zfs-on-linux: homepage: http://zfsonlinux.org +zfs-on-linux: +zfs-on-linux: +zfs-on-linux: +zfs-on-linux: diff --git a/system/zfs-on-linux/zfs-on-linux.SlackBuild b/system/zfs-on-linux/zfs-on-linux.SlackBuild new file mode 100644 index 0000000000000..2dc9b6b6868b7 --- /dev/null +++ b/system/zfs-on-linux/zfs-on-linux.SlackBuild @@ -0,0 +1,126 @@ +#!/bin/sh + +# Slackware build script for zfs-on-linux + +# Copyright 2013 Petr Hejl - Czech Republic +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Modified by the SlackBuilds.org project + +PRGNAM=zfs-on-linux +SRCNAM=zfs +VERSION=${VERSION:-0.6.2} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i486 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +KERN=$(uname -r) + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -fr $SRCNAM-$VERSION +tar xvf $CWD/$SRCNAM-$VERSION.tar.gz +cd $SRCNAM-$VERSION +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +if [ -z $LINUXPATH ]; then + LINUXPATH=/usr/src/linux +fi + +CFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --localstatedir=/var \ + --sysconfdir=/etc \ + --libdir=/lib$LIBDIRSUFFIX \ + --bindir=/usr/bin \ + --sbindir=/sbin \ + --includedir=/usr/include \ + --mandir=/usr/man \ + --docdir=/usr/doc/$PRGNAM-$VERSION \ + --with-linux=$LINUXPATH \ + --with-linux-obj=$LINUXPATH \ + --with-udevdir=/lib/udev \ + --enable-static=no \ + --build=$ARCH-slackware-linux + +make +make install DESTDIR=$PKG + +# no such thing here +rm -fr $PKG/usr/lib/dracut + +mkdir -p $PKG/etc/rc.d/init.d +rm -fr $PKG/etc/init.d +install -m 0755 -D $CWD/rc.zfs $PKG/etc/rc.d/rc.zfs.new +ln -s ../rc.zfs $PKG/etc/rc.d/init.d/zfs + +# create the lock directory +mkdir -p $PKG/var/lock/zfs + +find $PKG/usr/man -type f -exec gzip -9 {} \; +for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a \ + AUTHORS COPYRIGHT DISCLAIMER OPENSOLARIS.LICENSE README.markdown \ + $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-${VERSION}_${KERN}-$ARCH-$BUILD$TAG.${PKGTYPE:-txz} diff --git a/system/zfs-on-linux/zfs-on-linux.info b/system/zfs-on-linux/zfs-on-linux.info new file mode 100644 index 0000000000000..24a56aad3de13 --- /dev/null +++ b/system/zfs-on-linux/zfs-on-linux.info @@ -0,0 +1,10 @@ +PRGNAM="zfs-on-linux" +VERSION="0.6.2" +HOMEPAGE="http://zfsonlinux.org" +DOWNLOAD="http://archive.zfsonlinux.org/downloads/zfsonlinux/zfs/zfs-0.6.2.tar.gz" +MD5SUM="0b183b0abdd5be287046ad9ce4f899fd" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="spl-solaris" +MAINTAINER="Petr Hejl" +EMAIL="silenost01@seznam.cz"
\ No newline at end of file |