Update nmount, troubleshooting

This commit is contained in:
Arun Prakash Jana 2019-04-25 22:08:38 +05:30
parent 9ac9c1bf4f
commit cefc4b08a7
No known key found for this signature in database
GPG key ID: A75979F35C080412
2 changed files with 9 additions and 20 deletions

View file

@ -66,8 +66,7 @@ Have as many scripts as you want to extend the power of `nnn`! Pick from the ava
- [Troubleshooting](#troubleshooting) - [Troubleshooting](#troubleshooting)
- [Tmux configuration](#tmux-configuration) - [Tmux configuration](#tmux-configuration)
- [BSD terminal issue](#bsd-terminal-issue) - [BSD terminal issue](#bsd-terminal-issue)
- [Restrict file open](#restrict-file-open) - [100% CPU usage](#100-cpu-usage)
- [Restrict 0-byte files](#restrict-0-byte-files)
- [Why fork?](#why-fork) - [Why fork?](#why-fork)
- [Mentions](#mentions) - [Mentions](#mentions)
- [Developers](#developers) - [Developers](#developers)
@ -345,7 +344,7 @@ The following indicators are used in the detail view:
| `NNN_USE_EDITOR=1` | open text files in `$EDITOR` (`$VISUAL`, if defined; fallback vi) | | `NNN_USE_EDITOR=1` | open text files in `$EDITOR` (`$VISUAL`, if defined; fallback vi) |
| `NNN_NO_AUTOSELECT=1` | do not auto-select matching dir in _nav-as-you-type_ mode | | `NNN_NO_AUTOSELECT=1` | do not auto-select matching dir in _nav-as-you-type_ mode |
| `NNN_RESTRICT_NAV_OPEN=1` | open files on <kbd></kbd>, not <kbd></kbd> or <kbd>l</kbd> | | `NNN_RESTRICT_NAV_OPEN=1` | open files on <kbd></kbd>, not <kbd></kbd> or <kbd>l</kbd> |
| `NNN_RESTRICT_0B=1` | do not open 0-byte files | | `NNN_RESTRICT_0B=1` | disable 0-byte file open; see [#187](https://github.com/jarun/nnn/issues/187), use _edit_ or _open with_ |
| `NNN_TRASH=1` | trash files to the desktop Trash [default: delete] | | `NNN_TRASH=1` | trash files to the desktop Trash [default: delete] |
| `NNN_OPS_PROG=1` | show copy, move progress on Linux | | `NNN_OPS_PROG=1` | show copy, move progress on Linux |
@ -404,23 +403,9 @@ TLDR: Use the keybind <kbd>K</kbd> to toggle selection if you are having issues
By default in OpenBSD & FreeBSD (and probably on macOS as well), `stty` maps <kbd>^Y</kbd> to `DSUSP`. This means that typing <kbd>^Y</kbd> will suspend `nnn` as if you typed <kbd>^Z</kbd> (you can bring `nnn` back to the foreground by issuing `fg`) instead of entering multi-selection mode. You can check this with `stty -a`. If it includes the text `dsusp = ^Y`, issuing `stty dsusp undef` will disable this `DSUSP` and let `nnn` receive the <kbd>^Y</kbd> instead. By default in OpenBSD & FreeBSD (and probably on macOS as well), `stty` maps <kbd>^Y</kbd> to `DSUSP`. This means that typing <kbd>^Y</kbd> will suspend `nnn` as if you typed <kbd>^Z</kbd> (you can bring `nnn` back to the foreground by issuing `fg`) instead of entering multi-selection mode. You can check this with `stty -a`. If it includes the text `dsusp = ^Y`, issuing `stty dsusp undef` will disable this `DSUSP` and let `nnn` receive the <kbd>^Y</kbd> instead.
##### Restrict file open
In order to disable opening files on accidental navigation key (<kbd></kbd> or <kbd>l</kbd>) press:
export NNN_RESTRICT_NAV_OPEN=1
Use <kbd>Enter</kbd> to open these files.
##### Restrict 0-byte files
Restrict opening 0-byte files due to [unexpected behaviour](https://github.com/jarun/nnn/issues/187); use _edit_ or _open with_ to open the file.
export NNN_RESTRICT_0B=1
##### 100% CPU usage ##### 100% CPU usage
There is a known issue where if you close the terminal directly with `nnn` waiting for a spawned process to exit, a deadlock occurs and `nnn` uses 100% CPU. Please see issue [#225](https://github.com/jarun/nnn/issues/225) for more details. Make sure you quit the spawned process before closing the terminal. It's not a problem if there is no spawned process. There is a known issue where if you close the terminal directly with `nnn` waiting for a spawned process to exit, a deadlock occurs and `nnn` uses 100% CPU. Please see issue [#225](https://github.com/jarun/nnn/issues/225) for more details. Make sure you quit the spawned process before closing the terminal. It's not a problem if there is no spawned process (`nnn` isn't blocked) as `nnn` checks if the parent process has exited.
#### WHY FORK? #### WHY FORK?

View file

@ -1,7 +1,8 @@
#!/usr/bin/env sh #!/usr/bin/env sh
# Description: Toggle mount status of a device using pmount # Description: Toggle mount status of a device using pmount
# If the device is mounted, it will be unmounted and vice versa. # If the device is not mounted, it will be mounted.
# If the device is mounted, it will be unmounted and powered down.
# #
# Shell: POSIX compliant # Shell: POSIX compliant
# Author: Arun Prakash Jana # Author: Arun Prakash Jana
@ -19,7 +20,10 @@ echo
if grep -qs "$dev " /proc/mounts; then if grep -qs "$dev " /proc/mounts; then
pumount "$dev" pumount "$dev"
echo $dev unmounted. if [ "$?" -eq "0" ]; then
udisksctl power-off -b /dev/"$dev"
echo $dev ejected.
fi
else else
pmount "$dev" pmount "$dev"
echo "$dev" mounted to "$(lsblk -n /dev/"$dev" | rev | cut -d' ' -f1 | rev)". echo "$dev" mounted to "$(lsblk -n /dev/"$dev" | rev | cut -d' ' -f1 | rev)".