diff options
author | Omar Vega Ramos <ovruni@gnu.org.pe> | 2016-10-21 18:15:57 -0500 |
---|---|---|
committer | Omar Vega Ramos <ovruni@gnu.org.pe> | 2016-10-21 18:15:57 -0500 |
commit | 84ecc80200ee0ac1aebc3f1208409a6aa400cc19 (patch) | |
tree | f0909c3e73f41a94ec2fc008602ceab5ca015d42 /pcr/zfs-dkms | |
parent | 5325d6da1ab018731255b211a9be7eb332f41d6d (diff) | |
download | abslibre-84ecc80200ee0ac1aebc3f1208409a6aa400cc19.tar.gz abslibre-84ecc80200ee0ac1aebc3f1208409a6aa400cc19.tar.bz2 abslibre-84ecc80200ee0ac1aebc3f1208409a6aa400cc19.zip |
zfs-dkms-0.6.5.8-2: updating version
Diffstat (limited to 'pcr/zfs-dkms')
-rw-r--r-- | pcr/zfs-dkms/PKGBUILD | 17 | ||||
-rw-r--r-- | pcr/zfs-dkms/zfs.initcpio.hook | 97 | ||||
-rw-r--r-- | pcr/zfs-dkms/zfs.initcpio.install | 15 |
3 files changed, 75 insertions, 54 deletions
diff --git a/pcr/zfs-dkms/PKGBUILD b/pcr/zfs-dkms/PKGBUILD index bdfaf81fa..d93ac31b4 100644 --- a/pcr/zfs-dkms/PKGBUILD +++ b/pcr/zfs-dkms/PKGBUILD @@ -5,8 +5,8 @@ pkgbase="zfs-dkms" pkgname=("zfs-dkms" "zfs-utils") -pkgver=0.6.5.7 -pkgrel=1 +pkgver=0.6.5.8 +pkgrel=2 license=('CDDL') makedepends=("git" "spl-dkms=${pkgver}") arch=("i686" "x86_64") @@ -17,8 +17,8 @@ source=("git+https://github.com/zfsonlinux/zfs.git#tag=zfs-${pkgver}" "zfs.initcpio.hook") sha256sums=('SKIP' 'b60214f70ffffb62ffe489cbfabd2e069d14ed2a391fac0e36f914238394b540' - '1e20071fa61a33874505dae0f2d71bb560f43e7faaea735cbde770ea10c133df' - '250f1232c464a81cc9c8b8ee05f21d752ebeebbc8614fae1c6d0bc600e816ac1') + '17114052aa20c528f022f7f1349971aa28810e2ed2c97871226b5679a91f7e77' + '90d50df503464e8d76770488dbd491cb633ee27984d4d3a31b03f1a4e7492038') build() { cd "${srcdir}/zfs" @@ -31,7 +31,7 @@ build() { --libdir=/usr/lib \ --datadir=/usr/share \ --includedir=/usr/include \ - --with-udevdir=/lib/udev \ + --with-udevdir=/usr/lib/udev \ --libexecdir=/usr/lib/zfs \ --with-config=user make @@ -48,7 +48,8 @@ package_zfs-dkms() { cp -a ${srcdir}/zfs/. ${dkmsdir} cd "${dkmsdir}" - make clean distclean + make clean + make distclean find . -name ".git*" -print0 | xargs -0 rm -fr -- scripts/dkms.mkconf -v ${pkgver} -f dkms.conf -n zfs chmod g-w,o-w -R . @@ -66,10 +67,6 @@ package_zfs-utils() { rm -r "${pkgdir}"/usr/lib/dracut rm -r "${pkgdir}"/usr/share/initramfs-tools - # move module tree /lib -> /usr/lib - cp -r "${pkgdir}"/{lib,usr} - rm -r "${pkgdir}"/lib - install -D -m644 "${srcdir}"/zfs.initcpio.hook "${pkgdir}"/usr/lib/initcpio/hooks/zfs install -D -m644 "${srcdir}"/zfs.initcpio.install "${pkgdir}"/usr/lib/initcpio/install/zfs install -D -m644 "${srcdir}"/zfs.bash-completion-r1 "${pkgdir}"/usr/share/bash-completion/completions/zfs diff --git a/pcr/zfs-dkms/zfs.initcpio.hook b/pcr/zfs-dkms/zfs.initcpio.hook index 3a928944d..09d081f04 100644 --- a/pcr/zfs-dkms/zfs.initcpio.hook +++ b/pcr/zfs-dkms/zfs.initcpio.hook @@ -1,8 +1,14 @@ +# +# WARNING: This script is parsed by ash in busybox at boot time, not bash! +# http://linux.die.net/man/1/ash +# https://wiki.ubuntu.com/DashAsBinSh +# http://www.jpsdomain.org/public/2008-JP_bash_vs_dash.pdf +# ZPOOL_FORCE="" ZPOOL_IMPORT_FLAGS="" zfs_get_bootfs () { - for zfs_dataset in $(/usr/bin/zpool list -H -o bootfs); do + for zfs_dataset in $(zpool list -H -o bootfs); do case ${zfs_dataset} in "" | "-") # skip this line/dataset @@ -20,81 +26,94 @@ zfs_get_bootfs () { } zfs_mount_handler () { - local node=$1 - if [ "$ZFS_DATASET" = "bootfs" ] ; then + if [ "${ZFS_DATASET}" = "bootfs" ] ; then if ! zfs_get_bootfs ; then # Lets import everything and try again - /usr/bin/zpool import $ZPOOL_IMPORT_FLAGS -N -a $ZPOOL_FORCE + zpool import ${ZPOOL_IMPORT_FLAGS} -N -a ${ZPOOL_FORCE} if ! zfs_get_bootfs ; then - echo "ZFS: Cannot find bootfs." - return 1 + die "ZFS: Cannot find bootfs." fi fi fi local pool="${ZFS_DATASET%%/*}" - local rwopt_exp=${rwopt:-ro} + local rwopt_exp="${rwopt:-ro}" - if ! "/usr/bin/zpool" list -H $pool 2>&1 > /dev/null ; then - if [ "$rwopt_exp" != "rw" ]; then - msg "ZFS: Importing pool $pool readonly." - ZPOOL_IMPORT_FLAGS="$ZPOOL_IMPORT_FLAGS -o readonly=on" + if ! zpool list -H "${pool}" 2>1 > /dev/null ; then + if [ ! "${rwopt_exp}" = "rw" ]; then + msg "ZFS: Importing pool ${pool} readonly." + ZPOOL_IMPORT_FLAGS="${ZPOOL_IMPORT_FLAGS} -o readonly=on" else - msg "ZFS: Importing pool $pool." + msg "ZFS: Importing pool ${pool}." fi - if ! "/usr/bin/zpool" import $ZPOOL_IMPORT_FLAGS -N $pool $ZPOOL_FORCE ; then - echo "ZFS: Unable to import pool $pool." - return 1 + if ! zpool import ${ZPOOL_IMPORT_FLAGS} -N "${pool}" ${ZPOOL_FORCE} ; then + die "ZFS: Unable to import pool ${pool}." fi fi - local mountpoint=$("/usr/bin/zfs" get -H -o value mountpoint $ZFS_DATASET) - if [ "$mountpoint" = "legacy" ] ; then - mount -t zfs -o ${rwopt_exp} "$ZFS_DATASET" "$node" - else - mount -o zfsutil,${rwopt_exp} -t zfs "$ZFS_DATASET" "$node" - fi + local node="$1" + local tab_file="${node}/etc/fstab" + local zfs_datasets="$(zfs list -H -o name -t filesystem -r ${ZFS_DATASET})" + + # Mount the root, and any child datasets + for dataset in ${zfs_datasets}; do + mountpoint=$(zfs get -H -o value mountpoint "${dataset}") + case ${mountpoint} in + "none") + # skip this line/dataset. + ;; + "legacy") + if [ -f "${tab_file}" ]; then + if findmnt -snero source -F "${tab_file}" -S "${dataset}" > /dev/null 2>&1; then + opt=$(findmnt -snero options -F "${tab_file}" -S "${dataset}") + mnt=$(findmnt -snero target -F "${tab_file}" -S "${dataset}") + mount -t zfs -o "${opt}" "${dataset}" "${node}${mnt}" + fi + fi + ;; + *) + mount -t zfs -o "zfsutil,${rwopt_exp}" "${dataset}" "${node}${mountpoint}" + ;; + esac + done } run_hook() { - # Force import the pools, useful if the pool has not properly been exported - # using 'zpool export <pool>' - [[ $zfs_force == 1 ]] && ZPOOL_FORCE='-f' - [[ "$zfs_import_dir" != "" ]] && ZPOOL_IMPORT_FLAGS="$ZPOOL_IMPORT_FLAGS -d $zfs_import_dir" + # Force import the pools, useful if the pool has not properly been exported using 'zpool export <pool>' + [ ! "${zfs_force}" = "" ] && ZPOOL_FORCE="-f" - if [ "$root" = 'zfs' ]; then - mount_handler='zfs_mount_handler' - fi + # Add import directory to import command flags + [ ! "${zfs_import_dir}" = "" ] && ZPOOL_IMPORT_FLAGS="${ZPOOL_IMPORT_FLAGS} -d ${zfs_import_dir}" + + # Wait 15 seconds for ZFS devices to show up + [ "${zfs_wait}" = "" ] && ZFS_WAIT="15" || ZFS_WAIT="${zfs_wait}" + + [ "${root}" = "zfs" ] && mount_handler="zfs_mount_handler" - case $zfs in + case ${zfs} in "") # skip this line/dataset ;; auto|bootfs) - ZFS_DATASET='bootfs' + ZFS_DATASET="bootfs" mount_handler="zfs_mount_handler" ;; *) - ZFS_DATASET=$zfs + ZFS_DATASET="${zfs}" mount_handler="zfs_mount_handler" ;; esac - if [ ! -f "/etc/hostid" ] ; then - echo "ZFS: No hostid found on kernel command line or /etc/hostid. ZFS pools may not import correctly." - fi - - # Allow up to 10 seconds for zfs device to show up - for i in 1 2 3 4 5 6 7 8 9 10; do + # Allow up to n seconds for zfs device to show up + for i in $(seq 1 ${ZFS_WAIT}); do [ -c "/dev/zfs" ] && break sleep 1 done } - run_latehook () { - /usr/bin/zpool import -N -a $ZPOOL_FORCE + zpool import -N -a ${ZPOOL_FORCE} } # vim:set ts=4 sw=4 ft=sh et: diff --git a/pcr/zfs-dkms/zfs.initcpio.install b/pcr/zfs-dkms/zfs.initcpio.install index c128d1006..19364a386 100644 --- a/pcr/zfs-dkms/zfs.initcpio.install +++ b/pcr/zfs-dkms/zfs.initcpio.install @@ -17,6 +17,7 @@ build() { dbufstat.py \ fsck.zfs \ mount.zfs \ + seq \ zdb \ zed \ zfs \ @@ -27,14 +28,15 @@ build() { zstreamdump \ ztest \ splat \ - hostid \ /lib/udev/vdev_id \ - /lib/udev/zvol_id + /lib/udev/zvol_id \ + findmnt map add_file \ /lib/udev/rules.d/60-zvol.rules \ /lib/udev/rules.d/69-vdev.rules \ - /lib/udev/rules.d/90-zfs.rules + /lib/udev/rules.d/90-zfs.rules \ + /lib/libgcc_s.so.1 map add_dir \ /etc/zfs/zed.d @@ -42,11 +44,10 @@ build() { add_runscript # allow mount(8) to "autodetect" ZFS - echo 'zfs' >>"$BUILDROOT/etc/filesystems" + echo 'zfs' >>"${BUILDROOT}/etc/filesystems" [[ -f /etc/zfs/zpool.cache ]] && add_file "/etc/zfs/zpool.cache" [[ -f /etc/modprobe.d/zfs.conf ]] && add_file "/etc/modprobe.d/zfs.conf" - [[ -f /etc/hostid ]] && add_file "/etc/hostid" } help() { @@ -73,6 +74,10 @@ Command Line Setup: If set to 1, this will use "zpool import -f" when attempting to import pools. + To change the seconds of time to wait for ZFS devices to show up at boot: + + zfs_wait=30 + To search for devices in a directory other than "/dev": zfs_import_dir=/dev/disk/by-uuid |