Skip to content

Instantly share code, notes, and snippets.

Created June 24, 2012 00:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/2980803 to your computer and use it in GitHub Desktop.
Save anonymous/2980803 to your computer and use it in GitHub Desktop.
changes.patch
diff -Naur zfs/PKGBUILD zfs.new/PKGBUILD
--- zfs/PKGBUILD 2012-06-23 13:36:36.000000000 -0400
+++ zfs.new/PKGBUILD 2012-06-23 16:09:19.890161072 -0400
@@ -1,33 +1,39 @@
+# Maintainer: Kyle Fuller <inbox@kylefuller.co.uk>
+# Contributor: Jonathan Vasquez <jvasquez1011@gmail.com>
+
pkgname=zfs
pkgver=0.6.0_rc9
pkgrel=1
arch=('i686' 'x86_64')
pkgdesc="Native ZFS for Linux"
url="http://zfsonlinux.org/"
-depends=('util-linux' "spl=$pkgver-$pkgrel")
+depends=('util-linux' "spl=${pkgver}-${pkgrel}")
makedepends=('linux-headers')
+
source=(http://github.com/downloads/zfsonlinux/zfs/zfs-${pkgver//_/-}.tar.gz
preempt.patch
zfs.initcpio.hook
zfs.initcpio.install)
+
md5sums=('f41082bd7073198cabf37e6e54359a07'
'9a5dc8b83c6b523fd2bd0be842278e2c'
- 'ca13cbbfa056847aa5a3a1479b43a066'
- 'af4deb337da54312591dbbc9b6a9380e')
+ 'e41fe7004a9b64c2af825e6b1663e8c8'
+ '8f93649b8eaab7bb9873aaae551ea1cb')
+
license=('CDDL')
install=zfs.install
build() {
- cd "$srcdir/$pkgname-${pkgver//_/-}"
- patch -p1 -i $srcdir/preempt.patch
+ cd "${srcdir}/${pkgname}-${pkgver//_/-}"
+ patch -p1 -i ${srcdir}/preempt.patch
./autogen.sh
./configure --prefix=/usr --sysconfdir=/etc
make
}
package() {
- cd "$srcdir/$pkgname-${pkgver//_/-}"
- make DESTDIR="$pkgdir" install
- install -D -m644 zfs.initcpio.hook "$pkgdir"/lib/initcpio/hooks/zfs
- install -D -m644 zfs.initcpio.install "$pkgdir"/lib/initcpio/install/zfs
+ cd "${srcdir}/${pkgname}-${pkgver//_/-}"
+ make DESTDIR="${pkgdir}" install
+ install -D -m644 ../zfs.initcpio.hook "${pkgdir}"/lib/initcpio/hooks/zfs
+ install -D -m644 ../zfs.initcpio.install "${pkgdir}"/lib/initcpio/install/zfs
}
diff -Naur zfs/zfs.initcpio.hook zfs.new/zfs.initcpio.hook
--- zfs/zfs.initcpio.hook 2012-03-27 18:15:17.000000000 -0400
+++ zfs.new/zfs.initcpio.hook 2012-06-23 16:07:51.345461747 -0400
@@ -1,14 +1,17 @@
ZPOOL_FORCE=""
-zfs_get_bootfs () {
+zfs_get_bootfs() {
ZFS_DATASET=`/usr/sbin/zpool list -H -o bootfs | sed 'q'`
if [ "$?" != "0" ] || [ "$ZFS_DATASET" = "" ] || [ "$ZFS_DATASET" = "no pools available" ] ; then
return 1
fi
}
-zfs_mount_handler () {
+zfs_mount_handler() {
local node=$1
+
+ # If ZFS_DATASET was set to bootfs in the kernel parameters
+ # then try to import the entire pool.
if [ "$ZFS_DATASET" = "bootfs" ] ; then
if ! zfs_get_bootfs ; then
# Lets import everything and try again
@@ -21,16 +24,19 @@
fi
local pool="${ZFS_DATASET%%/*}"
- if ! "/usr/sbin/zpool" list -H $pool > /dev/null ; then
- echo "ZFS: Importing pool $pool."
-
+
+ # Try to list the $pool, if any errors, hide them.
+ if ! "/usr/sbin/zpool" list -H $pool 2> /dev/null ; then
+ # Try to import the pool without mounting any of the datasets
if ! "/usr/sbin/zpool" import -N $pool $ZPOOL_FORCE ; then
- echo "ZFS: Unable to import pool $pool."
+ echo "ZFS: Unable to import pool: $pool."
return 1
fi
fi
local mountpoint=$("/usr/sbin/zfs" get -H -o value mountpoint $ZFS_DATASET)
+
+ # Check to see if the mountpoint is legacy
if [ "$mountpoint" = "legacy" ] ; then
mount -t zfs "$ZFS_DATASET" "$node"
else
@@ -38,7 +44,7 @@
fi
}
-run_hook ()
+run_hook()
{
input="$(cat /proc/cmdline)"
for i in $input; do
@@ -66,7 +72,8 @@
esac
done
- if [ ! -f "/etc/hostid" ] ; then
- echo "ZFS: No hostid found on kernel command line or /etc/hostid. ZFS pools may not import correctly."
- fi
+ # This is not necessary, most of the time the pool mounts fine without the hostid info
+ #if [ ! -f "/etc/hostid" ] ; then
+ #echo "ZFS: No hostid found on kernel command line or /etc/hostid. ZFS pools may not import correctly."
+ #fi
}
diff -Naur zfs/zfs.initcpio.install zfs.new/zfs.initcpio.install
--- zfs/zfs.initcpio.install 2012-03-27 18:18:18.000000000 -0400
+++ zfs.new/zfs.initcpio.install 2012-06-23 16:08:16.512512982 -0400
@@ -1,20 +1,20 @@
build() {
- MODULES=" zfs zcommon znvpair zavl zunicode spl zlib_deflate" # zlib_inflate
+ MODULES="zfs zcommon znvpair zavl zunicode spl zlib_deflate" # zlib_inflate
BINARIES=""
FILES=""
SCRIPT="zfs"
- add_file "/lib/udev/rules.d/60-zpool.rules"
- add_file "/lib/udev/rules.d/60-zvol.rules"
- add_file "/lib/udev/rules.d/90-zfs.rules"
+ add_file "/usr/lib/udev/rules.d/60-zpool.rules"
+ add_file "/usr/lib/udev/rules.d/60-zvol.rules"
+ add_file "/usr/lib/udev/rules.d/90-zfs.rules"
add_file "/etc/zfs/zdev.conf"
- add_file "/etc/zfs/zpool.cache"
+ [ -f "/etc/zfs/zpool.cache" ] && add_file "/etc/zfs/zpool.cache"
[ -f "/etc/hostid" ] && add_file "/etc/hostid"
add_binary "/usr/sbin/zfs"
add_binary "/usr/sbin/zpool"
add_binary "/usr/bin/zpool_layout"
- add_binary "/lib/udev/zpool_id"
- add_binary "/lib/udev/zvol_id"
- add_binary "/usr/sbin/mount.zfs"
+ add_binary "/usr/lib/udev/zpool_id"
+ add_binary "/usr/lib/udev/zvol_id"
+ add_binary "/sbin/mount.zfs"
add_binary "/usr/bin/hostid"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment