1 |
commit: 766c554bcb19b062936d30a6404c082d50c6fa81 |
2 |
Author: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Apr 30 22:14:43 2011 +0000 |
4 |
Commit: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Apr 30 22:14:43 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=766c554b |
7 |
|
8 |
updates to zfs |
9 |
|
10 |
--- |
11 |
sys-devel/spl/spl-0.6.0_rc3.ebuild | 2 + |
12 |
sys-fs/zfs/files/zfs.initd | 134 ++++++++++++++++++++++++++++++++++++ |
13 |
2 files changed, 136 insertions(+), 0 deletions(-) |
14 |
|
15 |
diff --git a/sys-devel/spl/spl-0.6.0_rc3.ebuild b/sys-devel/spl/spl-0.6.0_rc3.ebuild |
16 |
index a59d99e..e680822 100644 |
17 |
--- a/sys-devel/spl/spl-0.6.0_rc3.ebuild |
18 |
+++ b/sys-devel/spl/spl-0.6.0_rc3.ebuild |
19 |
@@ -41,4 +41,6 @@ src_configure() { |
20 |
|
21 |
src_install() { |
22 |
emake DESTDIR="${D}" install || die 'emake install failed' |
23 |
+ dosym /usr/include/spl/spl_config.h /usr/include/spl/module/spl_config.h \ |
24 |
+ || die |
25 |
} |
26 |
|
27 |
diff --git a/sys-fs/zfs/files/zfs.initd b/sys-fs/zfs/files/zfs.initd |
28 |
new file mode 100644 |
29 |
index 0000000..d8ec4ea |
30 |
--- /dev/null |
31 |
+++ b/sys-fs/zfs/files/zfs.initd |
32 |
@@ -0,0 +1,134 @@ |
33 |
+#!/sbin/runscript |
34 |
+# Copyright 1999-2011 Gentoo Foundation |
35 |
+# Distributed under the terms of the GNU General Public License v2 |
36 |
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/zfs/files/zfs,v 0.9 2011/04/30 10:13:43 devsk Exp $ |
37 |
+ |
38 |
+depend() { |
39 |
+ before net |
40 |
+ after udev |
41 |
+} |
42 |
+ |
43 |
+CACHEFILE=/etc/zfs/zpool.cache |
44 |
+ZPOOL=/sbin/zpool |
45 |
+ZFS=/sbin/zfs |
46 |
+ZFS_MODULE=zfs |
47 |
+LOCKFILE=/var/lock/zfs/zfs_lockfile |
48 |
+ |
49 |
+checksystem() |
50 |
+{ |
51 |
+ /sbin/modinfo $ZFS_MODULE &>/dev/null |
52 |
+ if [[ $? -ne 0 ]] |
53 |
+ then |
54 |
+ eerror "$ZFS_MODULE not found. Is the ZFS package installed?" |
55 |
+ return 1 |
56 |
+ fi |
57 |
+ if [[ ! -x $ZPOOL ]] |
58 |
+ then |
59 |
+ eerror "$ZPOOL binary not found." |
60 |
+ return 1 |
61 |
+ fi |
62 |
+ if [[ ! -x $ZFS ]] |
63 |
+ then |
64 |
+ eerror "$ZFS binary not found." |
65 |
+ return 1 |
66 |
+ fi |
67 |
+ return 0 |
68 |
+} |
69 |
+ |
70 |
+start() |
71 |
+{ |
72 |
+ if [[ -f $LOCKFILE ]] |
73 |
+ then |
74 |
+ einfo "ZFS already running, please stop it first. Delete $LOCKFILE if its not so." |
75 |
+ eend 3 |
76 |
+ return 3 |
77 |
+ fi |
78 |
+ ebegin "Starting ZFS" |
79 |
+ checksystem || return 1 |
80 |
+ if ! grep -q $ZFS_MODULE /proc/modules |
81 |
+ then |
82 |
+ /sbin/modprobe $ZFS_MODULE &>/dev/null |
83 |
+ rv=$? |
84 |
+ if [[ $rv -ne 0 ]] |
85 |
+ then |
86 |
+ eerror "Failed to load the $ZFS_MODULE module, check 'dmesg|tail'." |
87 |
+ eend $rv |
88 |
+ return $rv |
89 |
+ fi |
90 |
+ fi |
91 |
+ |
92 |
+ # Import all pools described by the cache file, and then mount |
93 |
+ # all filesystem based on their properties. |
94 |
+ if [[ -f $CACHEFILE ]] |
95 |
+ then |
96 |
+ einfo "Importing ZFS pools" |
97 |
+ |
98 |
+ # as per fedora script, import can fail if all pools are already imported |
99 |
+ # The check for $rv makes no sense...but someday, it will work right. |
100 |
+ $ZPOOL import -c $CACHEFILE -aN 2>/dev/null || true |
101 |
+ rv=$? |
102 |
+ if [[ $rv -ne 0 ]] |
103 |
+ then |
104 |
+ eerror "Failed to import not-yet imported pools." |
105 |
+ eend $rv |
106 |
+ return $rv |
107 |
+ fi |
108 |
+ fi |
109 |
+ |
110 |
+ einfo "Mounting ZFS filesystems" |
111 |
+ $ZFS mount -a |
112 |
+ rv=$? |
113 |
+ if [[ $rv -ne 0 ]] |
114 |
+ then |
115 |
+ eerror "Failed to mount ZFS filesystems." |
116 |
+ eend $rv |
117 |
+ return $rv |
118 |
+ fi |
119 |
+ |
120 |
+ # hack to read mounted file systems because otherwise |
121 |
+ # zfs returns EPERM when a non-root user reads a mounted filesystem before root did |
122 |
+ savepwd="$PWD" |
123 |
+ mount | grep " type zfs " | sed 's/.*on //' | sed 's/ type zfs.*$//' | \ |
124 |
+ while read line |
125 |
+ do |
126 |
+ cd "$line" &> /dev/null |
127 |
+ ls &> /dev/null |
128 |
+ done |
129 |
+ cd "$savepwd" |
130 |
+ |
131 |
+ touch $LOCKFILE |
132 |
+ eend 0 |
133 |
+ return 0 |
134 |
+} |
135 |
+ |
136 |
+stop() |
137 |
+{ |
138 |
+ if [[ ! -f $LOCKFILE ]] |
139 |
+ then |
140 |
+ einfo "ZFS is not started, remove $LOCKFILE if its not so." |
141 |
+ eend 3 |
142 |
+ return 3 |
143 |
+ fi |
144 |
+ ebegin "Unmounting ZFS filesystems" |
145 |
+ sync |
146 |
+ $ZFS umount -a |
147 |
+ if [[ $rv -ne 0 ]] |
148 |
+ then |
149 |
+ eerror "Failed to umount ZFS filesystems." |
150 |
+ fi |
151 |
+ rm -f $LOCKFILE |
152 |
+ eend $rv |
153 |
+} |
154 |
+ |
155 |
+status() |
156 |
+{ |
157 |
+ if [[ ! -f $LOCKFILE ]] |
158 |
+ then |
159 |
+ einfo "ZFS is not started, remove $LOCKFILE if its not so." |
160 |
+ eend 3 |
161 |
+ return 3 |
162 |
+ fi |
163 |
+ |
164 |
+ # show pool status and list |
165 |
+ $ZPOOL status && echo && $ZPOOL list |
166 |
+} |