mirror of
https://github.com/TECHNOFAB11/disko.git
synced 2026-02-02 17:35:08 +01:00
use nix at eval time rather grep at runtime
This commit is contained in:
parent
af29463588
commit
e9d1f151a2
1 changed files with 6 additions and 7 deletions
|
|
@ -11,11 +11,11 @@ let {
|
||||||
|
|
||||||
helper.find-device = device: let
|
helper.find-device = device: let
|
||||||
environment = helper.device-id device;
|
environment = helper.device-id device;
|
||||||
in ''
|
in
|
||||||
if echo '${device}' | grep -q '^/dev/disk'; then
|
# DEVICE points already to /dev/disk, so we don't handle it via /dev/disk/by-path
|
||||||
# DEVICE points already to /dev/disk, so we don't handle it via /dev/disk/by-path
|
if hasPrefix "/dev/disk" device then
|
||||||
${environment}='${device}'
|
"${environment}='${device}'"
|
||||||
else
|
else ''
|
||||||
${environment}=$(for x in /dev/disk/by-path/*; do
|
${environment}=$(for x in /dev/disk/by-path/*; do
|
||||||
dev=$x
|
dev=$x
|
||||||
if [ "$(readlink -f $x)" = '${device}' ]; then
|
if [ "$(readlink -f $x)" = '${device}' ]; then
|
||||||
|
|
@ -29,8 +29,7 @@ let {
|
||||||
else
|
else
|
||||||
echo $target
|
echo $target
|
||||||
fi)
|
fi)
|
||||||
fi
|
'';
|
||||||
'';
|
|
||||||
|
|
||||||
helper.device-id = device: "DEVICE${builtins.substring 0 5 (builtins.hashString "sha1" device)}";
|
helper.device-id = device: "DEVICE${builtins.substring 0 5 (builtins.hashString "sha1" device)}";
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue