mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-16 19:50:19 +01:00
system/openzfs: Added (ZFS support for Linux)
Renamed from zfs-on-linux. Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
parent
428ab0a946
commit
c22cd83704
6 changed files with 340 additions and 0 deletions
10
system/openzfs/README
Normal file
10
system/openzfs/README
Normal file
|
@ -0,0 +1,10 @@
|
|||
ZFS is a modern filesystem originally developed for SOLARIS.
|
||||
It provides many functionalities such as snapshots, data compression,
|
||||
data recovery, filesystem (snapshot) sending/reveiving, and more.
|
||||
|
||||
NOTE: 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.
|
||||
|
||||
Please use KERNEL environment variable if target kernel version differs
|
||||
from that's of the build machine, e.g. `export KERNEL=5.15.74`.
|
29
system/openzfs/doinst.sh
Normal file
29
system/openzfs/doinst.sh
Normal file
|
@ -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
|
145
system/openzfs/openzfs.SlackBuild
Normal file
145
system/openzfs/openzfs.SlackBuild
Normal file
|
@ -0,0 +1,145 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Slackware build script for openzfs
|
||||
|
||||
# Copyright 2021-22 Markus Reichelt <slackbuilds@mareichelt.de>, Germany
|
||||
# Copyright 2017 Marcin Szychowski <szycha@gmail.com>, Poland
|
||||
# Copyright 2016 Kevin Paulus <goarilla@gmail.com>, Belgium
|
||||
# Copyright 2013-2014 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
|
||||
|
||||
cd $(dirname $0) ; CWD=$(pwd)
|
||||
|
||||
PRGNAM=openzfs
|
||||
SRCNAM=zfs
|
||||
VERSION=${VERSION:-2.1.6}
|
||||
BUILD=${BUILD:-1}
|
||||
TAG=${TAG:-_SBo}
|
||||
PKGTYPE=${PKGTYPE:-tgz}
|
||||
|
||||
KERNEL=${KERNEL:-"$(uname -r)"}
|
||||
PKGVER="$(printf %s "${VERSION}_${KERNEL}" | tr - _)"
|
||||
|
||||
if [ -z "$ARCH" ]; then
|
||||
case "$( uname -m )" in
|
||||
i?86) ARCH=i586 ;;
|
||||
arm*) ARCH=arm ;;
|
||||
*) ARCH=$( uname -m ) ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
|
||||
# the name of the created package would be, and then exit. This information
|
||||
# could be useful to other scripts.
|
||||
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
|
||||
echo "$PRGNAM-$PKGVER-$ARCH-$BUILD$TAG.$PKGTYPE"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
TMP=${TMP:-/tmp/SBo}
|
||||
PKG=$TMP/package-$PRGNAM
|
||||
OUTPUT=${OUTPUT:-/tmp}
|
||||
|
||||
if [ "$ARCH" = "i586" ]; then
|
||||
SLKCFLAGS="-O2 -march=i586 -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
|
||||
|
||||
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 {} \;
|
||||
|
||||
./autogen.sh
|
||||
|
||||
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="/lib/modules/${KERNEL}/source" \
|
||||
--with-linux-obj="/lib/modules/${KERNEL}/source" \
|
||||
--with-udevdir=/lib/udev \
|
||||
--enable-static=no \
|
||||
--build=$ARCH-slackware-linux
|
||||
|
||||
make
|
||||
make install DESTDIR=$PKG
|
||||
|
||||
rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la
|
||||
|
||||
# clean up leftovers
|
||||
if [ "$ARCH" = "x86_64" ]; then
|
||||
rm -fr $PKG/usr/lib
|
||||
else
|
||||
rm -fr $PKG/usr/lib/dracut
|
||||
fi
|
||||
rm -fr $PKG/usr/src
|
||||
|
||||
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
|
||||
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
||||
|
||||
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
|
||||
mkdir -p $PKG/var/lock/zfs
|
||||
|
||||
gzip -9 $PKG/usr/man/man*/*
|
||||
|
||||
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
||||
cp -a \
|
||||
AUTHORS COPYRIGHT LICENSE META README.md NEWS NOTICE CODE_OF_CONDUCT.md \
|
||||
$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-$PKGVER-$ARCH-$BUILD$TAG.$PKGTYPE
|
10
system/openzfs/openzfs.info
Normal file
10
system/openzfs/openzfs.info
Normal file
|
@ -0,0 +1,10 @@
|
|||
PRGNAM="openzfs"
|
||||
VERSION="2.1.6"
|
||||
HOMEPAGE="https://openzfs.org"
|
||||
DOWNLOAD="https://github.com/openzfs/zfs/releases/download/zfs-2.1.6/zfs-2.1.6.tar.gz"
|
||||
MD5SUM="e8583043007c9f52379e1758a78ac125"
|
||||
DOWNLOAD_x86_64=""
|
||||
MD5SUM_x86_64=""
|
||||
REQUIRES=""
|
||||
MAINTAINER="Markus Reichelt"
|
||||
EMAIL="slackbuilds@mareichelt.de"
|
127
system/openzfs/rc.zfs
Normal file
127
system/openzfs/rc.zfs
Normal file
|
@ -0,0 +1,127 @@
|
|||
#!/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"
|
||||
UDEVD="/dev/disk/by-id/"
|
||||
|
||||
# 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, and then mount
|
||||
# all filesystem based on their properties.
|
||||
echo "Importing ZFS pools"
|
||||
"$ZPOOL" import -d "$UDEVD" -f -aN 2>/dev/null
|
||||
|
||||
echo "Mounting ZFS filesystems"
|
||||
"$ZFS" mount -a
|
||||
|
||||
echo "Exporting ZFS filesystems"
|
||||
"$ZFS" share -a
|
||||
|
||||
mkdir -p $(dirname $LOCKFILE)
|
||||
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
|
||||
|
||||
# vim: set ts=4 sts=4 sw=4 expandtab textwidth=78:
|
19
system/openzfs/slack-desc
Normal file
19
system/openzfs/slack-desc
Normal file
|
@ -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------------------------------------------------------|
|
||||
openzfs: openzfs (ZFS support for Linux)
|
||||
openzfs:
|
||||
openzfs: ZFS is a combined file system and logical volume manager designed by
|
||||
openzfs: Sun Microsystems for Solaris. It features protection against data
|
||||
openzfs: corruption, support for high storage capacities, efficient data
|
||||
openzfs: compression, snapshots, copy-on-write clones, continuous integrity
|
||||
openzfs: checking and automatic repair, native encryption, block-level data
|
||||
openzfs: deduplication, ability to serialize filesystems (snapshots)
|
||||
openzfs: e.g. to send/receive them over SSH, and many, many more.
|
||||
openzfs:
|
||||
openzfs: Homepage: https://openzfs.org
|
Loading…
Reference in a new issue