Line 0
Link Here
|
|
|
1 |
#!@PREFIX@/sbin/runscript |
2 |
# Copyright 1992-2012 FreeBSD Project |
3 |
# Released under the 2-clause BSD license |
4 |
# $Header: $ |
5 |
|
6 |
depend() { |
7 |
before swap |
8 |
} |
9 |
|
10 |
start() { |
11 |
while read device mountpoint type options rest ; do |
12 |
case ":${device}:${type}:${options}" in |
13 |
:#*) |
14 |
continue |
15 |
;; |
16 |
*.bde:swap:sw) |
17 |
passphrase=`dd if=/dev/random count=1 2>/dev/null | md5 -q` |
18 |
device="${device%.bde}" |
19 |
gbde init "${device}" -P "${passphrase}" || return 1 |
20 |
gbde attach "${device}" -p "${passphrase}" || return 1 |
21 |
;; |
22 |
*.eli:swap:sw) |
23 |
device="${device%.eli}" |
24 |
geli onetime ${geli_swap_flags} "${device}" || return 1 |
25 |
;; |
26 |
esac |
27 |
done < /etc/fstab |
28 |
} |
29 |
|
30 |
stop() { |
31 |
while read device mountpoint type options rest ; do |
32 |
case ":${device}:${type}:${options}" in |
33 |
:#*) |
34 |
continue |
35 |
;; |
36 |
*.bde:swap:sw) |
37 |
device="${device%.bde}" |
38 |
gbde detach "${device}" |
39 |
;; |
40 |
*.eli:swap:sw) |
41 |
# Nothing here, because geli swap devices should be |
42 |
# created with the auto-detach-on-last-close option. |
43 |
;; |
44 |
esac |
45 |
done < /etc/fstab |
46 |
} |