From 1e67b5c97eafc8c6b51c23ad81d4129d8cda1f4b Mon Sep 17 00:00:00 2001 From: colin Date: Fri, 20 Jan 2023 04:58:05 +0000 Subject: [PATCH] sane-mount-servo: fix so we really do prefer lan over wan mounts --- pkgs/sane-scripts/src/sane-mount-servo | 18 ++++++++++-------- pkgs/sane-scripts/src/sane-mount-servo-root | 18 ++++++++++-------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/pkgs/sane-scripts/src/sane-mount-servo b/pkgs/sane-scripts/src/sane-mount-servo index 35d50c89..5640feb3 100755 --- a/pkgs/sane-scripts/src/sane-mount-servo +++ b/pkgs/sane-scripts/src/sane-mount-servo @@ -1,19 +1,21 @@ #!/usr/bin/env bash set -ex -mnt=/mnt/servo-media-wan # if lan not mounted, then try to mount it if ! (test -d /mnt/servo-media-lan/Music) then - sudo mount /mnt/servo-media-lan && mnt=/mnt/servo-media-lan + sudo mount /mnt/servo-media-lan +fi +# not much reason not to mount the wan while we're here. +if ! (test -d /mnt/servo-media-wan/Music) +then + sudo mount /mnt/servo-media-wan fi -# if the needed mount isn't mounted, mount it -if ! (test -d $mnt/Music) -then - sudo mount $mnt -fi +mnt=/mnt/servo-media-wan +# if the LAN is accessible, prefer that +test -d /mnt/servo-media-wan/Music && mnt=/mnt/servo-media-lan # symlink the fastest mount point into place # uncomment if i see the bug again: sudo unlink /mnt/servo-media # XXX ln gets confused if the destination is a symlink to a stale mount -sudo ln -sf $mnt /mnt/servo-media +sudo ln -sf --no-dereference $mnt /mnt/servo-media diff --git a/pkgs/sane-scripts/src/sane-mount-servo-root b/pkgs/sane-scripts/src/sane-mount-servo-root index bdd4fdb9..4f48d8b9 100755 --- a/pkgs/sane-scripts/src/sane-mount-servo-root +++ b/pkgs/sane-scripts/src/sane-mount-servo-root @@ -1,19 +1,21 @@ #!/usr/bin/env bash set -ex -mnt=/mnt/servo-root-wan # if lan not mounted, then try to mount it if ! (test -d /mnt/servo-root-lan/nix) then - sudo mount /mnt/servo-root-lan && mnt=/mnt/servo-root-lan + sudo mount /mnt/servo-root-lan +fi +# not much reason not to mount the wan while we're here. +if ! (test -d /mnt/servo-root-wan/nix) +then + sudo mount /mnt/servo-root-wan fi -# if the needed mount isn't mounted, mount it -if ! (test -d $mnt/nix) -then - sudo mount $mnt -fi +mnt=/mnt/servo-root-wan +# if the LAN is accessible, prefer that +test -d /mnt/servo-root-wan/nix && mnt=/mnt/servo-root-lan # symlink the fastest mount point into place # uncomment if i see the bug again: sudo unlink /mnt/servo-root # XXX ln gets confused if the destination is a symlink to a stale mount -sudo ln -sf $mnt /mnt/servo-root +sudo ln -sf --no-dereference $mnt /mnt/servo-root