]>
Commit | Line | Data |
---|---|---|
dbdad250 DH |
1 | From: Darik Horn <dajhorn@vanadac.com> |
2 | Date: Tue, 17 Jan 2012 11:54:21 -0600 | |
3906dce5 | 3 | Subject: Remove all upstream init.d components. |
dbdad250 DH |
4 | |
5 | The etc/init.d/ components are redundant because the debian/ overlay | |
6 | bundles init files according to Debian packaging policy. | |
7 | --- | |
8 | configure.ac | 1 - | |
9 | etc/Makefile.am | 2 +- | |
10 | etc/init.d/.gitignore | 1 - | |
bcf0963f DH |
11 | etc/init.d/Makefile.am | 22 ----- |
12 | etc/init.d/zfs.arch.in | 62 ------------ | |
13 | etc/init.d/zfs.fedora.in | 244 ---------------------------------------------- | |
14 | etc/init.d/zfs.gentoo.in | 111 --------------------- | |
15 | etc/init.d/zfs.lsb.in | 130 ------------------------ | |
16 | etc/init.d/zfs.lunar.in | 95 ------------------ | |
17 | etc/init.d/zfs.redhat.in | 176 --------------------------------- | |
18 | 10 files changed, 1 insertion(+), 843 deletions(-) | |
dbdad250 DH |
19 | delete mode 100644 etc/init.d/.gitignore |
20 | delete mode 100644 etc/init.d/Makefile.am | |
dbdad250 DH |
21 | delete mode 100644 etc/init.d/zfs.arch.in |
22 | delete mode 100644 etc/init.d/zfs.fedora.in | |
23 | delete mode 100644 etc/init.d/zfs.gentoo.in | |
24 | delete mode 100644 etc/init.d/zfs.lsb.in | |
25 | delete mode 100644 etc/init.d/zfs.lunar.in | |
26 | delete mode 100644 etc/init.d/zfs.redhat.in | |
27 | ||
28 | diff --git a/configure.ac b/configure.ac | |
ce930ec5 | 29 | index 2abd05d..da40356 100644 |
dbdad250 DH |
30 | --- a/configure.ac |
31 | +++ b/configure.ac | |
0cde9545 | 32 | @@ -61,7 +61,6 @@ AC_CONFIG_FILES([ |
dbdad250 DH |
33 | udev/Makefile |
34 | udev/rules.d/Makefile | |
35 | etc/Makefile | |
36 | - etc/init.d/Makefile | |
37 | etc/zfs/Makefile | |
38 | man/Makefile | |
db0d2f5b | 39 | man/man5/Makefile |
dbdad250 DH |
40 | diff --git a/etc/Makefile.am b/etc/Makefile.am |
41 | index 65882b5..b5e497f 100644 | |
42 | --- a/etc/Makefile.am | |
43 | +++ b/etc/Makefile.am | |
44 | @@ -1 +1 @@ | |
45 | -SUBDIRS = init.d zfs | |
46 | +SUBDIRS = zfs | |
47 | diff --git a/etc/init.d/.gitignore b/etc/init.d/.gitignore | |
48 | deleted file mode 100644 | |
49 | index 73304bc..0000000 | |
50 | --- a/etc/init.d/.gitignore | |
51 | +++ /dev/null | |
52 | @@ -1 +0,0 @@ | |
53 | -zfs | |
54 | diff --git a/etc/init.d/Makefile.am b/etc/init.d/Makefile.am | |
55 | deleted file mode 100644 | |
56 | index c1b131b..0000000 | |
57 | --- a/etc/init.d/Makefile.am | |
58 | +++ /dev/null | |
59 | @@ -1,22 +0,0 @@ | |
60 | -initdir = $(DEFAULT_INIT_DIR) | |
61 | -init_SCRIPTS = zfs | |
62 | - | |
63 | -EXTRA_DIST = \ | |
64 | - $(top_srcdir)/etc/init.d/zfs.fedora.in \ | |
65 | - $(top_srcdir)/etc/init.d/zfs.gentoo.in \ | |
66 | - $(top_srcdir)/etc/init.d/zfs.lsb.in \ | |
67 | - $(top_srcdir)/etc/init.d/zfs.lunar.in \ | |
68 | - $(top_srcdir)/etc/init.d/zfs.redhat.in \ | |
69 | - $(top_srcdir)/etc/init.d/zfs.arch.in | |
70 | - | |
71 | -$(init_SCRIPTS): | |
72 | - -$(SED) -e 's,@bindir\@,$(bindir),g' \ | |
73 | - -e 's,@sbindir\@,$(sbindir),g' \ | |
74 | - -e 's,@udevdir\@,$(udevdir),g' \ | |
75 | - -e 's,@udevruledir\@,$(udevruledir),g' \ | |
76 | - -e 's,@sysconfdir\@,$(sysconfdir),g' \ | |
77 | - -e 's,@initdir\@,$(initdir),g' \ | |
78 | - '$@.$(DEFAULT_INIT_SCRIPT).in' >'$@' | |
79 | - | |
80 | -distclean-local:: | |
81 | - -$(RM) $(init_SCRIPTS) | |
dbdad250 DH |
82 | diff --git a/etc/init.d/zfs.arch.in b/etc/init.d/zfs.arch.in |
83 | deleted file mode 100644 | |
84 | index de2ea8a..0000000 | |
85 | --- a/etc/init.d/zfs.arch.in | |
86 | +++ /dev/null | |
87 | @@ -1,62 +0,0 @@ | |
88 | -#!/bin/bash | |
89 | - | |
90 | -. /etc/rc.conf | |
91 | -. /etc/rc.d/functions | |
92 | - | |
93 | -ZFS="@sbindir@/zfs" | |
94 | -ZPOOL="@sbindir@/zpool" | |
95 | -ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache" | |
96 | - | |
97 | -case "$1" in | |
98 | - start) | |
99 | - stat_busy "Starting zfs" | |
100 | - | |
101 | - if [ ! -c /dev/zfs ]; then | |
102 | - modprobe zfs | |
103 | - if [ $? -ne 0 ]; then | |
104 | - stat_fail | |
105 | - exit 1 | |
106 | - fi | |
107 | - fi | |
108 | - | |
109 | - # Import ZFS pools (via cache file) | |
110 | - if [ -f $ZPOOL_CACHE ]; then | |
111 | - $ZPOOL import -c $ZPOOL_CACHE -aN 2>/dev/null | |
112 | - if [ $? -ne 0 ]; then | |
113 | - stat_fail | |
114 | - exit 1 | |
115 | - fi | |
116 | - fi | |
117 | - | |
118 | - # Mount ZFS filesystems | |
119 | - $ZFS mount -a | |
120 | - if [ $? -ne 0 ]; then | |
121 | - stat_fail | |
122 | - exit 1 | |
123 | - fi | |
124 | - | |
125 | - # Export ZFS flesystems | |
126 | - $ZFS share -a | |
127 | - if [ $? -ne 0 ]; then | |
128 | - stat_fail | |
129 | - exit 1 | |
130 | - fi | |
131 | - | |
132 | - add_daemon zfs | |
133 | - stat_done | |
134 | - ;; | |
135 | - stop) | |
136 | - stat_busy "Stopping zfs" | |
137 | - $ZFS umount -a | |
138 | - rm_daemon zfs | |
139 | - stat_done | |
140 | - ;; | |
141 | - restart) | |
142 | - $0 stop | |
143 | - $0 start | |
144 | - ;; | |
145 | - *) | |
146 | - echo "usage: $0 {start|stop|restart}" | |
147 | -esac | |
148 | - | |
149 | -exit 0 | |
150 | diff --git a/etc/init.d/zfs.fedora.in b/etc/init.d/zfs.fedora.in | |
151 | deleted file mode 100644 | |
152 | index 04f2077..0000000 | |
153 | --- a/etc/init.d/zfs.fedora.in | |
154 | +++ /dev/null | |
155 | @@ -1,244 +0,0 @@ | |
156 | -#!/bin/bash | |
157 | -# | |
158 | -# zfs This script will mount/umount the zfs filesystems. | |
159 | -# | |
160 | -# chkconfig: 2345 01 99 | |
161 | -# description: This script will mount/umount the zfs filesystems during | |
162 | -# system boot/shutdown. Configuration of which filesystems | |
163 | -# should be mounted is handled by the zfs 'mountpoint' and | |
164 | -# 'canmount' properties. See the zfs(8) man page for details. | |
165 | -# It is also responsible for all userspace zfs services. | |
166 | -# | |
167 | -### BEGIN INIT INFO | |
168 | -# Provides: zfs | |
169 | -# Required-Start: | |
170 | -# Required-Stop: | |
171 | -# Should-Start: | |
172 | -# Should-Stop: | |
173 | -# Default-Start: 2 3 4 5 | |
174 | -# Default-Stop: 1 | |
175 | -# Short-Description: Mount/umount the zfs filesystems | |
176 | -# Description: ZFS is an advanced filesystem designed to simplify managing | |
177 | -# and protecting your data. This service mounts the ZFS | |
178 | -# filesystems and starts all related zfs services. | |
179 | -### END INIT INFO | |
180 | - | |
181 | -export PATH=/usr/local/sbin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin | |
182 | - | |
183 | -# Source function library & LSB routines | |
184 | -. /etc/rc.d/init.d/functions | |
185 | - | |
186 | -# script variables | |
187 | -RETVAL=0 | |
188 | -ZFS="@sbindir@/zfs" | |
189 | -ZPOOL="@sbindir@/zpool" | |
190 | -ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache" | |
191 | -servicename=zfs | |
192 | -LOCKFILE=/var/lock/subsys/$servicename | |
193 | - | |
194 | -# functions | |
195 | -zfs_installed() { | |
196 | - modinfo zfs > /dev/null 2>&1 || return 5 | |
197 | - $ZPOOL > /dev/null 2>&1 | |
198 | - [ $? == 127 ] && return 5 | |
199 | - $ZFS > /dev/null 2>&1 | |
200 | - [ $? == 127 ] && return 5 | |
201 | - return 0 | |
202 | -} | |
203 | - | |
204 | -reregister_mounts() { | |
205 | - cat /etc/mtab | while read -r fs mntpnt fstype opts rest ; do | |
206 | - fs=`printf '%b\n' "$fs"` | |
207 | - mntpnt=`printf '%b\n' "$mntpnt"` | |
208 | - if [ "$fstype" == "zfs" ] ; then | |
209 | - if [ "$mntpnt" == "/" ] ; then | |
210 | - mount -f -o zfsutil -t zfs --move / /removethismountpointhoweverpossible | |
211 | - umount --fake /removethismountpointhoweverpossible | |
212 | - else | |
213 | - umount --fake "$mntpnt" | |
214 | - fi | |
215 | - elif echo "$fs" | grep -q "^/dev/zd" ; then | |
216 | - if [ "$mntpnt" == "/" ] ; then | |
217 | - mount -f -t "$fstype" --move / /removethismountpointhoweverpossible | |
218 | - umount --fake /removethismountpointhoweverpossible | |
219 | - else | |
220 | - umount --fake "$mntpnt" | |
221 | - fi | |
222 | - fi | |
223 | - done | |
224 | - cat /proc/mounts | while read -r fs mntpnt fstype opts rest ; do | |
225 | - fs=`printf '%b\n' "$fs"` | |
226 | - mntpnt=`printf '%b\n' "$mntpnt"` | |
227 | - if [ "$fstype" == "zfs" ] ; then | |
228 | - mount -f -t zfs -o zfsutil "$fs" "$mntpnt" | |
229 | - elif echo "$fs" | grep -q "^/dev/zd" ; then | |
230 | - mount -f -t "$fstype" -o "$opts" "$fs" "$mntpnt" | |
231 | - fi | |
232 | - done | |
233 | -} | |
234 | - | |
235 | -# i need a bash guru to simplify this, since this is copy and paste, but donno how | |
236 | -# to correctly dereference variable names in bash, or how to do this right | |
237 | - | |
238 | -declare -A MTAB | |
239 | -declare -A FSTAB | |
240 | - | |
241 | -# first parameter is a regular expression that filters mtab | |
242 | -read_mtab() { | |
243 | - for fs in "${!MTAB[@]}" ; do unset MTAB["$fs"] ; done | |
244 | - while read -r fs mntpnt fstype opts blah ; do | |
245 | - fs=`printf '%b\n' "$fs"` | |
246 | - MTAB["$fs"]=$mntpnt | |
247 | - done < <(grep "$1" /etc/mtab) | |
248 | -} | |
249 | - | |
250 | -in_mtab() { | |
251 | - [ "${MTAB[$1]}" != "" ] | |
252 | - return $? | |
253 | -} | |
254 | - | |
255 | -# first parameter is a regular expression that filters fstab | |
256 | -read_fstab() { | |
257 | - for fs in "${!FSTAB[@]}" ; do unset FSTAB["$fs"] ; done | |
258 | - while read -r fs mntpnt fstype opts blah ; do | |
259 | - fs=`printf '%b\n' "$fs"` | |
260 | - FSTAB["$fs"]=$mntpnt | |
261 | - done < <(grep "$1" /etc/fstab) | |
262 | -} | |
263 | - | |
264 | -in_fstab() { | |
265 | - [ "${FSTAB[$1]}" != "" ] | |
266 | - return $? | |
267 | -} | |
268 | - | |
269 | -start() | |
270 | -{ | |
271 | - if [ -f "$LOCKFILE" ] ; then return 0 ; fi | |
272 | - | |
273 | - # check if ZFS is installed. If not, comply to FC standards and bail | |
274 | - zfs_installed || { | |
275 | - action $"Checking if ZFS is installed: not installed" /bin/false | |
276 | - return 5 | |
277 | - } | |
278 | - | |
279 | - # Requires selinux policy which has not been written. | |
280 | - if [ -r "/selinux/enforce" ] && | |
281 | - [ "$(cat /selinux/enforce)" = "1" ]; then | |
282 | - action $"SELinux ZFS policy required: " /bin/false || return 6 | |
283 | - fi | |
284 | - | |
285 | - # Delay until all required block devices are present. | |
286 | - udevadm settle | |
287 | - | |
288 | - # load kernel module infrastructure | |
289 | - if ! grep -q zfs /proc/modules ; then | |
290 | - action $"Loading kernel ZFS infrastructure: " modprobe zfs || return 5 | |
291 | - fi | |
292 | - | |
293 | - # fix mtab to include already-mounted fs filesystems, in case there are any | |
294 | - # we ONLY do this if mtab does not point to /proc/mounts | |
295 | - # which is the case in some systems (systemd may bring that soon) | |
296 | - if ! readlink /etc/mtab | grep -q /proc ; then | |
297 | - if grep -qE "(^/dev/zd| zfs )" /proc/mounts ; then | |
298 | - action $"Registering already-mounted ZFS filesystems and volumes: " reregister_mounts || return 150 | |
299 | - fi | |
300 | - fi | |
301 | - | |
302 | - if [ -f $ZPOOL_CACHE ] ; then | |
303 | - | |
304 | - echo -n $"Importing ZFS pools not yet imported: " | |
305 | - $ZPOOL import -c $ZPOOL_CACHE -aN || true # stupid zpool will fail if all pools are already imported | |
306 | - RETVAL=$? | |
307 | - if [ $RETVAL -ne 0 ]; then | |
308 | - failure "Importing ZFS pools not yet imported: " | |
309 | - return 151 | |
310 | - fi | |
311 | - success "Importing ZFS pools not yet imported: " | |
312 | - | |
313 | - fi | |
314 | - | |
315 | - action $"Mounting ZFS filesystems not yet mounted: " $ZFS mount -a || return 152 | |
316 | - | |
317 | - action $"Exporting ZFS filesystems: " $ZFS share -a || return 153 | |
318 | - | |
319 | - read_mtab "^/dev/zd" | |
320 | - read_fstab "^/dev/zd" | |
321 | - | |
322 | - template=$"Mounting volume %s registered in fstab: " | |
323 | - for volume in "${!FSTAB[@]}" ; do | |
324 | - if in_mtab "$volume" ; then continue ; fi | |
325 | - string=`printf "$template" "$volume"` | |
326 | - action "$string" mount "$volume" | |
327 | - done | |
328 | - | |
329 | - touch "$LOCKFILE" | |
330 | -} | |
331 | - | |
332 | -stop() | |
333 | -{ | |
334 | - if [ ! -f "$LOCKFILE" ] ; then return 0 ; fi | |
335 | - | |
336 | - # check if ZFS is installed. If not, comply to FC standards and bail | |
337 | - zfs_installed || { | |
338 | - action $"Checking if ZFS is installed: not installed" /bin/false | |
339 | - return 5 | |
340 | - } | |
341 | - | |
342 | - # the poweroff of the system takes care of this | |
343 | - # but it never unmounts the root filesystem itself | |
344 | - # shit | |
345 | - | |
346 | - action $"Syncing ZFS filesystems: " sync | |
347 | - # about the only thing we can do, and then we | |
348 | - # hope that the umount process will succeed | |
349 | - # unfortunately the umount process does not dismount | |
350 | - # the root file system, there ought to be some way | |
351 | - # we can tell zfs to just flush anything in memory | |
352 | - # when a request to remount,ro comes in | |
353 | - | |
354 | - #echo -n $"Unmounting ZFS filesystems: " | |
355 | - #$ZFS umount -a | |
356 | - #RETVAL=$? | |
357 | - #if [ $RETVAL -ne 0 ]; then | |
358 | - # failure | |
359 | - | |
360 | - # return 8 | |
361 | - #fi | |
362 | - #success | |
363 | - | |
364 | - rm -f "$LOCKFILE" | |
365 | -} | |
366 | - | |
367 | -# See how we are called | |
368 | -case "$1" in | |
369 | - start) | |
370 | - start | |
371 | - RETVAL=$? | |
372 | - ;; | |
373 | - stop) | |
374 | - stop | |
375 | - RETVAL=$? | |
376 | - ;; | |
377 | - status) | |
378 | - lsmod | grep -q zfs || RETVAL=3 | |
379 | - $ZPOOL status && echo && $ZFS list || { | |
380 | - [ -f "$LOCKFILE" ] && RETVAL=2 || RETVAL=4 | |
381 | - } | |
382 | - ;; | |
383 | - restart) | |
384 | - stop | |
385 | - start | |
386 | - ;; | |
387 | - condrestart) | |
388 | - if [ -f "$LOCKFILE" ] ; then | |
389 | - stop | |
390 | - start | |
391 | - fi | |
392 | - ;; | |
393 | - *) | |
394 | - echo $"Usage: $0 {start|stop|status|restart|condrestart}" | |
395 | - RETVAL=3 | |
396 | - ;; | |
397 | -esac | |
398 | - | |
399 | -exit $RETVAL | |
400 | diff --git a/etc/init.d/zfs.gentoo.in b/etc/init.d/zfs.gentoo.in | |
401 | deleted file mode 100644 | |
4bb9be73 | 402 | index df883cf..0000000 |
dbdad250 DH |
403 | --- a/etc/init.d/zfs.gentoo.in |
404 | +++ /dev/null | |
405 | @@ -1,111 +0,0 @@ | |
406 | -#!/sbin/runscript | |
407 | -# Copyright 1999-2011 Gentoo Foundation | |
4bb9be73 | 408 | -# Released under the 2-clause BSD license. |
dbdad250 DH |
409 | -# $Header: /var/cvsroot/gentoo-x86/sys-fs/zfs/files/zfs,v 0.9 2011/04/30 10:13:43 devsk Exp $ |
410 | - | |
411 | -depend() | |
412 | -{ | |
413 | - # bootmisc will log to /var which may be a different zfs than root. | |
414 | - before net bootmisc | |
415 | - after udev localmount | |
416 | - keyword -lxc -openvz -prefix -vserver | |
417 | -} | |
418 | - | |
419 | -ZFS="@sbindir@/zfs" | |
420 | -ZPOOL="@sbindir@/zpool" | |
421 | -ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache" | |
422 | -ZFS_MODULE=zfs | |
423 | - | |
424 | -checksystem() { | |
425 | - if [ ! -c /dev/zfs ]; then | |
426 | - einfo "Checking if ZFS modules present" | |
e5ce50f3 | 427 | - if ! modinfo zfs > /dev/null 2>&1 ; then |
dbdad250 DH |
428 | - eerror "$ZFS_MODULE not found. Is the ZFS package installed?" |
429 | - return 1 | |
430 | - fi | |
431 | - fi | |
432 | - einfo "Checking if zfs userspace tools present" | |
433 | - if [ ! -x $ZPOOL ]; then | |
434 | - eerror "$ZPOOL binary not found." | |
435 | - return 1 | |
436 | - fi | |
437 | - if [ ! -x $ZFS ]; then | |
438 | - eerror "$ZFS binary not found." | |
439 | - return 1 | |
440 | - fi | |
441 | - return 0 | |
442 | -} | |
443 | - | |
444 | -start() { | |
445 | - ebegin "Starting ZFS" | |
446 | - checksystem || return 1 | |
447 | - | |
448 | - # Delay until all required block devices are present. | |
449 | - udevadm settle | |
450 | - | |
451 | - if [ ! -c /dev/zfs ]; then | |
452 | - modprobe $ZFS_MODULE | |
453 | - rv=$? | |
454 | - if [ $rv -ne 0 ]; then | |
455 | - eerror "Failed to load the $ZFS_MODULE module, check 'dmesg|tail'." | |
456 | - eend $rv | |
457 | - return $rv | |
458 | - fi | |
459 | - fi | |
460 | - | |
461 | - # Import all pools described by the cache file, and then mount | |
462 | - # all filesystem based on their properties. | |
463 | - if [ -f $ZPOOL_CACHE ]; then | |
464 | - einfo "Importing ZFS pools" | |
465 | - # as per fedora script, import can fail if all pools are already imported | |
466 | - # The check for $rv makes no sense...but someday, it will work right. | |
467 | - $ZPOOL import -c $ZPOOL_CACHE -aN 2>/dev/null || true | |
468 | - rv=$? | |
469 | - if [ $rv -ne 0 ]; then | |
470 | - eerror "Failed to import not-yet imported pools." | |
471 | - eend $rv | |
472 | - return $rv | |
473 | - fi | |
474 | - fi | |
475 | - | |
476 | - einfo "Mounting ZFS filesystems" | |
477 | - $ZFS mount -a | |
478 | - rv=$? | |
479 | - if [ $rv -ne 0 ]; then | |
480 | - eerror "Failed to mount ZFS filesystems." | |
481 | - eend $rv | |
482 | - return $rv | |
483 | - fi | |
484 | - | |
485 | - einfo "Exporting ZFS filesystems" | |
486 | - $ZFS share -a | |
487 | - rv=$? | |
488 | - if [ $rv -ne 0 ]; then | |
489 | - eerror "Failed to export ZFS filesystems." | |
490 | - eend $rv | |
491 | - return $rv | |
492 | - fi | |
493 | - | |
494 | - eend 0 | |
495 | - return 0 | |
496 | -} | |
497 | - | |
498 | -stop() | |
499 | -{ | |
500 | - ebegin "Unmounting ZFS filesystems" | |
501 | - $ZFS umount -a | |
502 | - rv=$? | |
503 | - if [ $rv -ne 0 ]; then | |
504 | - einfo "Some ZFS filesystems not unmounted" | |
505 | - fi | |
506 | - | |
507 | - # Don't fail if we couldn't umount everything. /usr might be in use. | |
508 | - eend 0 | |
509 | - return 0 | |
510 | -} | |
511 | - | |
512 | -status() | |
513 | -{ | |
514 | - # show pool status and list | |
515 | - $ZPOOL status && echo && $ZPOOL list | |
516 | -} | |
517 | diff --git a/etc/init.d/zfs.lsb.in b/etc/init.d/zfs.lsb.in | |
518 | deleted file mode 100644 | |
519 | index 3d04206..0000000 | |
520 | --- a/etc/init.d/zfs.lsb.in | |
521 | +++ /dev/null | |
522 | @@ -1,130 +0,0 @@ | |
523 | -#!/bin/bash | |
524 | -# | |
525 | -# zfs This script will mount/umount the zfs filesystems. | |
526 | -# | |
527 | -# chkconfig: 2345 01 99 | |
528 | -# description: This script will mount/umount the zfs filesystems during | |
529 | -# system boot/shutdown. Configuration of which filesystems | |
530 | -# should be mounted is handled by the zfs 'mountpoint' and | |
531 | -# 'canmount' properties. See the zfs(8) man page for details. | |
532 | -# It is also responsible for all userspace zfs services. | |
533 | -# | |
534 | -### BEGIN INIT INFO | |
535 | -# Provides: zfs | |
536 | -# Required-Start: $local_fs | |
537 | -# Required-Stop: $local_fs | |
538 | -# Default-Start: 2 3 4 5 | |
539 | -# Default-Stop: 0 1 6 | |
540 | -# Should-Stop: | |
541 | -# Short-Description: Mount/umount the zfs filesystems | |
542 | -# Description: ZFS is an advanced filesystem designed to simplify managing | |
543 | -# and protecting your data. This service mounts the ZFS | |
544 | -# filesystems and starts all related zfs services. | |
545 | -### END INIT INFO | |
546 | - | |
547 | -# Source function library. | |
548 | -. /lib/lsb/init-functions | |
549 | - | |
550 | -LOCKFILE=/var/lock/zfs | |
551 | -ZFS="@sbindir@/zfs" | |
552 | -ZPOOL="@sbindir@/zpool" | |
553 | -ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache" | |
554 | - | |
555 | -# Source zfs configuration. | |
556 | -[ -r '/etc/default/zfs' ] && . /etc/default/zfs | |
557 | - | |
558 | -[ -x "$ZPOOL" ] || exit 1 | |
559 | -[ -x "$ZFS" ] || exit 2 | |
560 | - | |
561 | -start() | |
562 | -{ | |
563 | - [ -f "$LOCKFILE" ] && return 3 | |
564 | - | |
565 | - # Requires selinux policy which has not been written. | |
566 | - if [ -r "/selinux/enforce" ] && | |
567 | - [ "$(cat /selinux/enforce)" = "1" ]; then | |
568 | - | |
569 | - log_failure_msg "SELinux ZFS policy required" | |
570 | - return 4 | |
571 | - fi | |
572 | - | |
573 | - # Delay until all required block devices are present. | |
574 | - udevadm settle | |
575 | - | |
576 | - # Load the zfs module stack | |
577 | - /sbin/modprobe zfs | |
578 | - | |
579 | - # Ensure / exists in /etc/mtab, if not update mtab accordingly. | |
580 | - # This should be handled by rc.sysinit but lets be paranoid. | |
581 | - awk '$2 == "/" { exit 1 }' /etc/mtab | |
582 | - RETVAL=$? | |
583 | - if [ "$RETVAL" -eq 0 ]; then | |
584 | - /bin/mount -f / | |
585 | - fi | |
586 | - | |
587 | - # Import all pools described by the cache file, and then mount | |
588 | - # all filesystem based on their properties. | |
589 | - if [ -f "$ZPOOL_CACHE" ] ; then | |
590 | - log_begin_msg "Importing ZFS pools" | |
591 | - "$ZPOOL" import -c "$ZPOOL_CACHE" -aN 2>/dev/null | |
592 | - log_end_msg $? | |
593 | - | |
594 | - log_begin_msg "Mounting ZFS filesystems" | |
595 | - "$ZFS" mount -a | |
596 | - log_end_msg $? | |
597 | - | |
598 | - log_begin_msg "Exporting ZFS filesystems" | |
599 | - "$ZFS" share -a | |
600 | - log_end_msg $? | |
601 | - fi | |
602 | - | |
603 | - touch "$LOCKFILE" | |
604 | -} | |
605 | - | |
606 | -stop() | |
607 | -{ | |
608 | - [ ! -f "$LOCKFILE" ] && return 3 | |
609 | - | |
610 | - log_begin_msg "Unmounting ZFS filesystems" | |
611 | - "$ZFS" umount -a | |
612 | - log_end_msg $? | |
613 | - | |
614 | - rm -f "$LOCKFILE" | |
615 | -} | |
616 | - | |
617 | -status() | |
618 | -{ | |
619 | - [ ! -f "$LOCKFILE" ] && return 3 | |
620 | - | |
621 | - "$ZPOOL" status && echo "" && "$ZPOOL" list | |
622 | -} | |
623 | - | |
624 | -case "$1" in | |
625 | - start) | |
626 | - start | |
627 | - RETVAL=$? | |
628 | - ;; | |
629 | - stop) | |
630 | - stop | |
631 | - RETVAL=$? | |
632 | - ;; | |
633 | - status) | |
634 | - status | |
635 | - RETVAL=$? | |
636 | - ;; | |
637 | - restart) | |
638 | - stop | |
639 | - start | |
640 | - ;; | |
641 | - condrestart) | |
642 | - if [ -f "$LOCKFILE" ]; then | |
643 | - stop | |
644 | - start | |
645 | - fi | |
646 | - ;; | |
647 | - *) | |
648 | - echo $"Usage: $0 {start|stop|status|restart|condrestart}" | |
649 | - ;; | |
650 | -esac | |
651 | - | |
652 | -exit $RETVAL | |
653 | diff --git a/etc/init.d/zfs.lunar.in b/etc/init.d/zfs.lunar.in | |
654 | deleted file mode 100644 | |
655 | index 97384dc..0000000 | |
656 | --- a/etc/init.d/zfs.lunar.in | |
657 | +++ /dev/null | |
658 | @@ -1,95 +0,0 @@ | |
659 | -#!/bin/bash | |
660 | -# | |
661 | -# zfs This shell script takes care of starting (mount) and | |
662 | -# stopping (umount) zfs shares. | |
663 | -# | |
664 | -# chkconfig: 35 60 40 | |
665 | -# description: ZFS is a filesystem developed by Sun, ZFS is a | |
666 | -# combined file system and logical volume manager | |
667 | -# designed by Sun Microsystems. Made available to Linux | |
668 | -# using SPL (Solaris Porting Layer) by zfsonlinux.org. | |
669 | -# probe: true | |
670 | - | |
671 | -ZFS="@sbindir@/zfs" | |
672 | -ZPOOL="@sbindir@/zpool" | |
673 | -ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache" | |
674 | - | |
675 | -case $1 in | |
676 | - start) echo "$1ing ZFS filesystems" | |
677 | - | |
678 | - # Delay until all required block devices are present. | |
679 | - udevadm settle | |
680 | - | |
681 | - if ! grep "zfs" /proc/modules > /dev/null; then | |
682 | - echo "ZFS kernel module not loaded yet; loading..."; | |
683 | - if ! modprobe zfs; then | |
684 | - echo "Failed to load ZFS kernel module..."; | |
685 | - exit 0; | |
686 | - fi | |
687 | - fi | |
688 | - | |
689 | - if ! [ `uname -m` == "x86_64" ]; then | |
690 | - echo "Warning: You're not running 64bit. Currently native zfs in"; | |
691 | - echo " linux is only supported and tested on 64bit."; | |
692 | - # should we break here? People doing this should know what they | |
693 | - # do, thus i'm not breaking here. | |
694 | - fi | |
695 | - | |
696 | - # mount the filesystems | |
697 | - while IFS= read -r -d $'\n' dev; do | |
698 | - mdev=$(echo "$dev" | awk '{ print $1; }') | |
699 | - echo -n "mounting $mdev..." | |
700 | - if $ZFS mount $mdev; then | |
701 | - echo -e "done"; | |
702 | - else | |
703 | - echo -e "failed"; | |
704 | - fi | |
705 | - done < <($ZFS list -H); | |
706 | - | |
707 | - # export the filesystems | |
708 | - echo -n "exporting ZFS filesystems..." | |
709 | - if $ZFS share -a; then | |
710 | - echo -e "done"; | |
711 | - else | |
712 | - echo -e "failed"; | |
713 | - fi | |
714 | - | |
715 | - | |
716 | - ;; | |
717 | - | |
718 | - stop) echo "$1ping ZFS filesystems" | |
719 | - | |
720 | - if grep "zfs" /proc/modules > /dev/null; then | |
721 | - # module is loaded, so we can try to umount filesystems | |
722 | - while IFS= read -r -d $'\n' dev; do | |
723 | - mdev=$(echo "$dev" | awk '{ print $1 }'); | |
724 | - echo -n "umounting $mdev..."; | |
725 | - if $ZFS umount $mdev; then | |
726 | - echo -e "done"; | |
727 | - else | |
728 | - echo -e "failed"; | |
729 | - fi | |
730 | - # the next line is, because i have to reverse the | |
731 | - # output, otherwise it wouldn't work as it should | |
732 | - done < <($ZFS list -H | tac); | |
733 | - | |
734 | - # and finally let's rmmod the module | |
735 | - rmmod zfs | |
736 | - | |
737 | - | |
738 | - else | |
739 | - # module not loaded, no need to umount anything | |
740 | - exit 0 | |
741 | - fi | |
742 | - | |
743 | - ;; | |
744 | - | |
745 | - restart) echo "$1ing ZFS filesystems" | |
746 | - $0 stop | |
747 | - $0 start | |
748 | - ;; | |
749 | - | |
750 | - *) echo "Usage: $0 {start|stop|restart}" | |
751 | - ;; | |
752 | - | |
753 | -esac | |
754 | diff --git a/etc/init.d/zfs.redhat.in b/etc/init.d/zfs.redhat.in | |
755 | deleted file mode 100644 | |
756 | index ae797c1..0000000 | |
757 | --- a/etc/init.d/zfs.redhat.in | |
758 | +++ /dev/null | |
759 | @@ -1,176 +0,0 @@ | |
760 | -#!/bin/bash | |
761 | -# | |
762 | -# zfs This script will mount/umount the zfs filesystems. | |
763 | -# | |
764 | -# chkconfig: 2345 01 99 | |
765 | -# description: This script will mount/umount the zfs filesystems during | |
766 | -# system boot/shutdown. Configuration of which filesystems | |
767 | -# should be mounted is handled by the zfs 'mountpoint' and | |
768 | -# 'canmount' properties. See the zfs(8) man page for details. | |
769 | -# It is also responsible for all userspace zfs services. | |
770 | -# | |
771 | -### BEGIN INIT INFO | |
772 | -# Provides: zfs | |
773 | -# Required-Start: | |
774 | -# Required-Stop: | |
775 | -# Should-Start: | |
776 | -# Should-Stop: | |
777 | -# Default-Start: 2 3 4 5 | |
778 | -# Default-Stop: 1 | |
779 | -# Short-Description: Mount/umount the zfs filesystems | |
780 | -# Description: ZFS is an advanced filesystem designed to simplify managing | |
781 | -# and protecting your data. This service mounts the ZFS | |
782 | -# filesystems and starts all related zfs services. | |
783 | -### END INIT INFO | |
784 | - | |
785 | -export PATH=/usr/local/sbin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin | |
786 | - | |
787 | -# Source function library & LSB routines | |
788 | -. /etc/rc.d/init.d/functions | |
789 | - | |
790 | -# script variables | |
791 | -RETVAL=0 | |
792 | -ZFS="@sbindir@/zfs" | |
793 | -ZPOOL="@sbindir@/zpool" | |
794 | -ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache" | |
795 | -servicename=zfs | |
796 | -LOCKFILE=/var/lock/subsys/$servicename | |
797 | - | |
798 | -# functions | |
799 | -zfs_installed() { | |
800 | - modinfo zfs > /dev/null 2>&1 || return 5 | |
801 | - $ZPOOL > /dev/null 2>&1 | |
802 | - [ $? == 127 ] && return 5 | |
803 | - $ZFS > /dev/null 2>&1 | |
804 | - [ $? == 127 ] && return 5 | |
805 | - return 0 | |
806 | -} | |
807 | - | |
808 | -# i need a bash guru to simplify this, since this is copy and paste, but donno how | |
809 | -# to correctly dereference variable names in bash, or how to do this right | |
810 | - | |
811 | -# first parameter is a regular expression that filters fstab | |
812 | -read_fstab() { | |
813 | - unset FSTAB | |
814 | - n=0 | |
815 | - while read -r fs mntpnt fstype opts blah ; do | |
816 | - fs=`printf '%b\n' "$fs"` | |
817 | - FSTAB[$n]=$fs | |
818 | - let n++ | |
819 | - done < <(egrep "$1" /etc/fstab) | |
820 | -} | |
821 | - | |
822 | -start() | |
823 | -{ | |
824 | - # Disable lockfile check | |
825 | - # if [ -f "$LOCKFILE" ] ; then return 0 ; fi | |
826 | - | |
827 | - # check if ZFS is installed. If not, comply to FC standards and bail | |
828 | - zfs_installed || { | |
829 | - action $"Checking if ZFS is installed: not installed" /bin/false | |
830 | - return 5 | |
831 | - } | |
832 | - | |
833 | - # Requires selinux policy which has not been written. | |
834 | - if [ -r "/selinux/enforce" ] && | |
835 | - [ "$(cat /selinux/enforce)" = "1" ]; then | |
836 | - action $"SELinux ZFS policy required: " /bin/false || return 6 | |
837 | - fi | |
838 | - | |
839 | - # Delay until all required block devices are present. | |
840 | - if [ -x /sbin/udevadm ]; then | |
841 | - /sbin/udevadm settle | |
842 | - elif [ -x /sbin/udevsettle ]; then | |
843 | - /sbin/udevsettle | |
844 | - fi | |
845 | - | |
846 | - # load kernel module infrastructure | |
847 | - if ! grep -q zfs /proc/modules ; then | |
848 | - action $"Loading kernel ZFS infrastructure: " modprobe zfs || return 5 | |
849 | - fi | |
850 | - sleep 1 | |
851 | - | |
852 | - action $"Mounting automounted ZFS filesystems: " $ZFS mount -a || return 152 | |
853 | - | |
854 | - action $"Exporting ZFS filesystems: " $ZFS share -a || return 153 | |
855 | - | |
856 | - # Read fstab, try to mount zvols ignoring error | |
857 | - read_fstab "^/dev/(zd|zvol)" | |
858 | - template=$"Mounting volume %s registered in fstab: " | |
859 | - for volume in "${FSTAB[@]}" ; do | |
860 | - string=`printf "$template" "$volume"` | |
861 | - action "$string" mount "$volume" 2>/dev/null || /bin/true | |
862 | - done | |
863 | - | |
864 | - # touch "$LOCKFILE" | |
865 | -} | |
866 | - | |
867 | -stop() | |
868 | -{ | |
869 | - # Disable lockfile check | |
870 | - # if [ ! -f "$LOCKFILE" ] ; then return 0 ; fi | |
871 | - | |
872 | - # check if ZFS is installed. If not, comply to FC standards and bail | |
873 | - zfs_installed || { | |
874 | - action $"Checking if ZFS is installed: not installed" /bin/false | |
875 | - return 5 | |
876 | - } | |
877 | - | |
878 | - # the poweroff of the system takes care of this | |
879 | - # but it never unmounts the root filesystem itself | |
880 | - # shit | |
881 | - | |
882 | - action $"Syncing ZFS filesystems: " sync | |
883 | - # about the only thing we can do, and then we | |
884 | - # hope that the umount process will succeed | |
885 | - # unfortunately the umount process does not dismount | |
886 | - # the root file system, there ought to be some way | |
887 | - # we can tell zfs to just flush anything in memory | |
888 | - # when a request to remount,ro comes in | |
889 | - | |
890 | - #echo -n $"Unmounting ZFS filesystems: " | |
891 | - #$ZFS umount -a | |
892 | - #RETVAL=$? | |
893 | - #if [ $RETVAL -ne 0 ]; then | |
894 | - # failure | |
895 | - | |
896 | - # return 8 | |
897 | - #fi | |
898 | - #success | |
899 | - | |
900 | - rm -f "$LOCKFILE" | |
901 | -} | |
902 | - | |
903 | -# See how we are called | |
904 | -case "$1" in | |
905 | - start) | |
906 | - start | |
907 | - RETVAL=$? | |
908 | - ;; | |
909 | - stop) | |
910 | - stop | |
911 | - RETVAL=$? | |
912 | - ;; | |
913 | - status) | |
914 | - lsmod | grep -q zfs || RETVAL=3 | |
915 | - $ZPOOL status && echo && $ZFS list || { | |
916 | - [ -f "$LOCKFILE" ] && RETVAL=2 || RETVAL=4 | |
917 | - } | |
918 | - ;; | |
919 | - restart) | |
920 | - stop | |
921 | - start | |
922 | - ;; | |
923 | - condrestart) | |
924 | - if [ -f "$LOCKFILE" ] ; then | |
925 | - stop | |
926 | - start | |
927 | - fi | |
928 | - ;; | |
929 | - *) | |
930 | - echo $"Usage: $0 {start|stop|status|restart|condrestart}" | |
931 | - RETVAL=3 | |
932 | - ;; | |
933 | -esac | |
934 | - | |
935 | -exit $RETVAL | |
936 | -- |