Merge pull request #37 from basvandewiel/30-create-an-unmount-script

30 create an unmount script
This commit is contained in:
Bas v.d. Wiel 2023-03-12 15:32:58 +01:00 committed by GitHub
commit 4d649592af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 10 deletions

View File

@ -10,8 +10,8 @@ into the mainline MiSTer project and live on there.
## Installing the script
Place the nfs_mount.sh script inside your MiSTer's /media/fat/Scripts directory. You can run
it from there through the OSD or from a (remote) Linux shell as you see fit.
Place the ```nfs_mount.sh``` and ```nfs_unmount.sh``` scripts inside your MiSTer's ```/media/fat/Scripts```
directory. You can run it from there through the OSD or from a (remote) Linux shell as you see fit.
## Configuration
@ -138,11 +138,7 @@ images for cores like PCXT/AO486 or Amiga. Those simulated machines expect their
writable at all times and things get hairy if they're not.
This is a fact of life when using a datacenter protocol with an appliance and will also happen if
you rudely hang up a CIFS server, so there's no real recourse against this. A reasonable habit to
keep this to a minimum would be to wait up to 30 seconds from inside the Menu core or any other core
that doesn't write to the disk before shutting down the device. Any pending writes will have been
flushed to the server by then and you'll be safe-ish.. no guarantees though!
The ```MOUNT_AT_BOOT``` flag installs a script that cleanly unmounts your NFS share at system shutdown.
A script that can trigger this same action from the OSD is on the to-do list.
you rudely hang up a CIFS server, so there's no real recourse against this. You really should always
call the ```nfs_unmount.sh``` script from the ```Scripts``` folder before shutting down your MiSTer.
The ```MOUNT_AT_BOOT``` flag installs a script that cleanly unmounts your NFS share upon clean
system shutdown. The main problem with that is that clean system shutdowns are so rare on MiSTer.

30
nfs_unmount.sh Executable file
View File

@ -0,0 +1,30 @@
#!/usr/bin/env bash
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Copyright 2022 Oliver "RealLarry" Jaksch
# You can download the latest version of this script from:
# https://github.com/MiSTer-devel/CIFS_MiSTer
# Version 1.0 - 2023-03-10 - First commit
#=========NO USER-SERVICEABLE PARTS BELOW THIS LINE=====
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root. Please run again with sudo or as root user. Exiting."
exit 1
else
umount -a -t nfs4
fi