forked from openzfs/zfs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jorgen Lundman <[email protected]>
- Loading branch information
Showing
15 changed files
with
937 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
zpool-import-all.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
noinst_launch_d_DATA = \ | ||
%D%/zpool-import-all.sh.in | ||
noinst_launch_ddir = \ | ||
$(launchdscriptdir)/ | ||
|
||
do_subst = -$(SED) -e 's,@bindir\@,$(bindir),g' \ | ||
-e 's,@runstatedir\@,$(runstatedir),g' \ | ||
-e 's,@sbindir\@,$(sbindir),g' \ | ||
-e 's,@sysconfdir\@,$(sysconfdir),g' \ | ||
-e 's,@launchdscriptdir\@,$(launchdscriptdir),g' | ||
|
||
CLEANFILES += %D%/zpool-import-all.sh | ||
|
||
INSTALL_DATA_HOOKS += install-zpool-import | ||
|
||
install-zpool-import: %D%/zpool-import-all.sh.in | ||
$(do_subst) < %D%/zpool-import-all.sh.in > $(DESTDIR)/$(launchdscriptdir)/zpool-import-all.sh | ||
chmod +x $(DESTDIR)/$(launchdscriptdir)/zpool-import-all.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/bash | ||
|
||
echo "+zpool-import-all.sh" | ||
date | ||
export ZPOOL_IMPORT_ALL_COOKIE=/var/run/org.openzfsonosx.zpool-import-all.didRun | ||
export INVARIANT_DISKS_IDLE_FILE=/var/run/disk/invariant.idle | ||
export TIMEOUT_SECONDS=60 | ||
export MAXIMUM_SLEEP_ITERATIONS=$((${TIMEOUT_SECONDS} * 10)) | ||
|
||
/usr/bin/time /usr/sbin/system_profiler SPParallelATADataType SPCardReaderDataType SPFibreChannelDataType SPFireWireDataType SPHardwareRAIDDataType SPNetworkDataType SPPCIDataType SPParallelSCSIDataType SPSASDataType SPSerialATADataType SPStorageDataType SPThunderboltDataType SPUSBDataType SPNetworkVolumeDataType 1>/dev/null 2>&1 | ||
|
||
/bin/sync | ||
|
||
echo "Waiting up to ${TIMEOUT_SECONDS} seconds for the InvariantDisks idle file ${INVARIANT_DISKS_IDLE_FILE} to exist" | ||
|
||
i=0 | ||
while [ "${i}" -lt "${MAXIMUM_SLEEP_ITERATIONS}" -a ! -e "${INVARIANT_DISKS_IDLE_FILE}" ] | ||
do | ||
i=$((i+1)) | ||
sleep .1 | ||
done | ||
|
||
if [ -e "${INVARIANT_DISKS_IDLE_FILE}" ] | ||
then | ||
echo "Found ${INVARIANT_DISKS_IDLE_FILE} after ${i} iterations of sleeping 0.1 seconds" | ||
else | ||
echo "File ${INVARIANT_DISKS_IDLE_FILE} not found within ${TIMEOUT_SECONDS} seconds" | ||
fi | ||
date | ||
|
||
if [ -f "@sysconfdir@/zfs/zsysctl.conf" ]; then | ||
@sbindir@/zsysctl -f @sysconfdir@/zfs/zsysctl.conf | ||
fi | ||
|
||
# check to see if we have been instructed not to try to import at all | ||
if [ -f /etc/zfs/noautoimport ]; | ||
then | ||
echo "/etc/zfs/noautoimport exits, exiting"; | ||
exit 0; | ||
fi | ||
|
||
date | ||
echo "-zpool-import-all.sh" | ||
|
||
sleep 10 | ||
echo "Loading and starting org.openzfsonosx.zpool-import" | ||
date | ||
|
||
/bin/launchctl load /Library/LaunchDaemons/org.openzfsonosx.zpool-import.plist | ||
/bin/launchctl kickstart -kp system/org.openzfsonosx.zpool-import | ||
|
||
echo Status: $? | ||
|
||
echo "Touching the file ${ZPOOL_IMPORT_ALL_COOKIE}" | ||
touch "${ZPOOL_IMPORT_ALL_COOKIE}" | ||
|
||
date | ||
echo "-zpool-import-all.sh" | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
launchddaemondir = /Library/LaunchDaemons | ||
launchdscriptdir = ${libexecdir}/zfs/launchd.d | ||
|
||
include $(srcdir)/%D%/daemons/Makefile.am |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
org.openzfsonosx.zconfigd.plist | ||
org.openzfsonosx.zed.plist | ||
org.openzfsonosx.zpool-import.plist | ||
org.openzfsonosx.zpool-import-all.plist | ||
org.openzfsonosx.InvariantDisks.plist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
CLEANFILES += $(launchddaemon_DATA) | ||
|
||
launchddaemon_DATA = \ | ||
$(top_srcdir)/etc/launchd/daemons/org.openzfsonosx.zconfigd.plist \ | ||
$(top_srcdir)/etc/launchd/daemons/org.openzfsonosx.zed.plist \ | ||
$(top_srcdir)/etc/launchd/daemons/org.openzfsonosx.zpool-import.plist \ | ||
$(top_srcdir)/etc/launchd/daemons/org.openzfsonosx.zpool-import-all.plist \ | ||
$(top_srcdir)/etc/launchd/daemons/org.openzfsonosx.InvariantDisks.plist | ||
|
||
dist_launchddaemon_DATA = \ | ||
%D%/org.openzfsonosx.zconfigd.plist.in \ | ||
%D%/org.openzfsonosx.zed.plist.in \ | ||
%D%/org.openzfsonosx.zpool-import.plist.in \ | ||
%D%/org.openzfsonosx.zpool-import-all.plist.in \ | ||
%D%/org.openzfsonosx.InvariantDisks.plist.in | ||
|
||
%D%/org.openzfsonosx.zconfigd.plist: %D%/org.openzfsonosx.zconfigd.plist.in | ||
%D%/org.openzfsonosx.zed.plist: %D%/org.openzfsonosx.zed.plist.in | ||
%D%/org.openzfsonosx.zpool-import.plist: %D%/org.openzfsonosx.zpool-import.plist.in | ||
%D%/org.openzfsonosx.zpool-import-all.plist: %D%/org.openzfsonosx.zpool-import-all.plist.in | ||
%D%/org.openzfsonosx.InvariantDisks.plist: %D%/org.openzfsonosx.InvariantDisks.plist.in | ||
|
||
$(launchddaemon_DATA): | ||
-$(SED) -e 's,@bindir\@,$(bindir),g' \ | ||
-e 's,@runstatedir\@,$(runstatedir),g' \ | ||
-e 's,@sbindir\@,$(sbindir),g' \ | ||
-e 's,@sysconfdir\@,$(sysconfdir),g' \ | ||
-e 's,@launchddaemondir\@,$(launchddaemondir),g' \ | ||
-e 's,@launchdscriptdir\@,$(launchdscriptdir),g' \ | ||
'[email protected]' >'$@' | ||
|
||
|
16 changes: 16 additions & 0 deletions
16
etc/launchd/daemons/org.openzfsonosx.InvariantDisks.plist.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>Label</key> | ||
<string>org.openzfsonosx.InvariantDisks</string> | ||
<key>ProgramArguments</key> | ||
<array> | ||
<string>@sbindir@/InvariantDisks</string> | ||
</array> | ||
<key>RunAtLoad</key> | ||
<true/> | ||
<key>KeepAlive</key> | ||
<true/> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>Label</key> | ||
<string>org.openzfsonosx.zconfigd</string> | ||
<key>ProgramArguments</key> | ||
<array> | ||
<string>@sbindir@/zconfigd</string> | ||
</array> | ||
<key>RunAtLoad</key> | ||
<true/> | ||
<key>KeepAlive</key> | ||
<true/> | ||
<key>StandardErrorPath</key> | ||
<string>/private/var/log/org.openzfsonosx.zconfigd.err</string> | ||
<key>StandardOutPath</key> | ||
<string>/private/var/log/org.openzfsonosx.zconfigd.log</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>Label</key> | ||
<string>org.openzfsonosx.zed</string> | ||
<key>ProgramArguments</key> | ||
<array> | ||
<string>@sbindir@/zed</string> | ||
<string>-vfF</string> | ||
</array> | ||
<key>RunAtLoad</key> | ||
<true/> | ||
<key>KeepAlive</key> | ||
<true/> | ||
<key>StandardErrorPath</key> | ||
<string>/private/var/log/org.openzfsonosx.zed.err</string> | ||
<key>StandardOutPath</key> | ||
<string>/private/var/log/org.openzfsonosx.zed.log</string> | ||
</dict> | ||
</plist> |
18 changes: 18 additions & 0 deletions
18
etc/launchd/daemons/org.openzfsonosx.zpool-import-all.plist.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>Label</key> | ||
<string>org.openzfsonosx.zpool-import-all</string> | ||
<key>ProgramArguments</key> | ||
<array> | ||
<string>@launchdscriptdir@/zpool-import-all.sh</string> | ||
</array> | ||
<key>RunAtLoad</key> | ||
<true/> | ||
<key>StandardErrorPath</key> | ||
<string>/private/var/log/org.openzfsonosx.zpool-import-all.err</string> | ||
<key>StandardOutPath</key> | ||
<string>/private/var/log/org.openzfsonosx.zpool-import-all.log</string> | ||
</dict> | ||
</plist> |
24 changes: 24 additions & 0 deletions
24
etc/launchd/daemons/org.openzfsonosx.zpool-import.plist.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>Label</key> | ||
<string>org.openzfsonosx.zpool-import</string> | ||
<key>ProgramArguments</key> | ||
<array> | ||
<string>@sbindir@/zpool</string> | ||
<string>import</string> | ||
<string>-a</string> | ||
<string>-d</string> | ||
<string>/var/run/disk/by-id</string> | ||
</array> | ||
<key>RunAtLoad</key> | ||
<false/> | ||
<key>LaunchOnlyOnce</key> | ||
<false/> | ||
<key>StandardErrorPath</key> | ||
<string>/private/var/log/org.openzfsonosx.zpool-import-all.log</string> | ||
<key>StandardOutPath</key> | ||
<string>/private/var/log/org.openzfsonosx.zpool-import-all.log</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
zfs-path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
pathsddir = $(sysconfdir)/paths.d | ||
pathsd_DATA = %D%/zfs-path | ||
|
||
paths_ddir = $(sysconfdir)/paths.d/ | ||
dist_paths_d_DATA = \ | ||
%D%/zfs-path | ||
|
||
zfs-path: %D%/zfs-path.in | ||
|
||
CLEANFILES += $(pathsd_DATA) | ||
CLEANFILES += %D%/zfs-path | ||
INSTALL_DATA_HOOKS += pathsd-data-hook | ||
pathsd-data-hook: %D%/zfs-path.in | ||
-$(SED) -e 's,@bindir\@,$(bindir),g' \ | ||
-e 's,@runstatedir\@,$(runstatedir),g' \ | ||
-e 's,@sbindir\@,$(sbindir),g' \ | ||
-e 's,@sysconfdir\@,$(sysconfdir),g' \ | ||
-e 's,@launchddaemondir\@,$(launchddaemondir),g' \ | ||
-e 's,@launchdscriptdir\@,$(launchdscriptdir),g' \ | ||
%D%/zfs-path.in > $(DESTDIR)/$(sysconfdir)/paths.d/zfs-path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@bindir@ | ||
@sbindir@ |
Oops, something went wrong.