sane-mount-servo: fix so we really do prefer lan over wan mounts

This commit is contained in:
colin 2023-01-20 04:58:05 +00:00
parent e527beb9d0
commit 1e67b5c97e
2 changed files with 20 additions and 16 deletions

View File

@ -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

View File

@ -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