250628.1 · 0edb4d678530df22a2cd313df4eafdf86943d11e
bin: mount NAS read-only on media PCs
Murphy is getting older now and learning how to use the keyboards for the media PCs. This increases the risk that he does some kind of destructive operation. He could easily delete entire directories of contents, for example. And I don't keep backups of non-personal media due to the cost.
So when mounting the NAS on these media PCs, let's do it read-only to protect the data. I very rarely need to do writable or destructive operations to the NAS from a media PC. And if that becomes a regular workflow, I can devise some other means of doing that.
reading declarations
@@ -5,17 +5,17 @@ case "$(myhostname)" in echo "cannot mount media on nas; the nas IS the media!" >&2 exit 1 ;;- duff|frink)+ duff) if [ ! $1 ] || [ $1 != down ]; then sudo mount nas:/m /m else sudo umount /m fi ;;- Turtle)- msshfs down /m+ flanders|wiggum|milhouse|otto)+ msshfs-readonly down /m if [ ! $1 ] || [ $1 != down ]; then- msshfs home.burntsushi.net:/m /m+ msshfs-readonly nas:/m /m fi ;; *)
@@ -7,9 +7,5 @@ if [ "$1" = down ]; then fusermount -u $2 fi else- if is-work; then- sshfs $1 $2 -o allow_other,reconnect,follow_symlinks,kernel_cache- else- sshfs $1 $2 -o allow_other,reconnect,follow_symlinks,writeback_cache=no,kernel_cache- fi+ sshfs $1 $2 -o allow_other,reconnect,follow_symlinks,writeback_cache=no,kernel_cache fi
@@ -0,0 +1,11 @@+#!/bin/sh++if [ "$1" = down ]; then+ if cmd-exists fusermount3; then+ fusermount3 -u $2+ else+ fusermount -u $2+ fi+else+ sshfs $1 $2 -o ro,allow_other,reconnect,follow_symlinks,writeback_cache=no,kernel_cache+fi