forked from openzfs/zfs
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add import script to zed, run as service
Signed-off-by: Jorgen Lundman <lundman@lundman.net>
- Loading branch information
Showing
21 changed files
with
670 additions
and
365 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
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,36 @@ | ||
#!/bin/powershell | ||
# shellcheck disable=SC2154 | ||
# | ||
# Log all environment variables to ZED_DEBUG_LOG. | ||
# | ||
# This can be a useful aid when developing/debugging ZEDLETs since it shows the | ||
# environment variables defined for each zevent. | ||
|
||
if (Test-Path "$env:ZED_ZEDLET_DIR\zed.rc") { | ||
. "$env:ZED_ZEDLET_DIR\zed.rc" | ||
} | ||
if (Test-Path "$env:ZED_ZEDLET_DIR\zed-functions.ps1") { | ||
. "$env:ZED_ZEDLET_DIR\zed-functions.ps1" | ||
} | ||
|
||
# | ||
# system_boot.ps1 | ||
# | ||
|
||
# Define the path to the zpool.cache file | ||
$zpoolCachePath = "C:\Windows\System32\Drivers\zpool.cache" | ||
|
||
# Check if the zpool.cache file exists | ||
if (Test-Path $zpoolCachePath) { | ||
Write-Host "zpool.cache found. Importing ZFS pools..." | ||
zed_log_msg LOG_NOTICE "zpool.cache found. Importing ZFS pools" | ||
|
||
# Import ZFS pools using the zpool command and the cache file | ||
& "$env:ZPOOL" import -c "$zpoolCachePath" -a | ||
|
||
# Optionally, log the result or handle any output | ||
zed_log_msg "ZFS Pools Imported." | ||
zed_notify "ZFS Pools Imported" "path" | ||
} else { | ||
zed_log_msg "zpool.cache not found. No pools imported." | ||
} |
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
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
Oops, something went wrong.