Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Life without user defined mounts sh #1379

Closed
sxored opened this issue Oct 28, 2022 · 14 comments
Closed

Life without user defined mounts sh #1379

sxored opened this issue Oct 28, 2022 · 14 comments

Comments

@sxored
Copy link
Contributor

sxored commented Oct 28, 2022

How I can get back my features in user defined "~/.config/far2l/mounts.sh" ?

Features list

  1. show path to FS or path to device instead of type of FS, optionally show path to loop device image

  2. path can be non-absolute in "${HOME}/.config/far2l/favorites", ' ~ ' should point to home directory of current user and possibility to use environment variables like this "~/various/${my_env_var}/subdir"

  3. optionally show use percentage in disk list with other delimiter than "/", i guess that "blank space" is better delimiter when there are more than 2 columns like in "df" an "mount" output

  4. optionally show used disk space for some paths in favorites

  5. show read-write/read-only status of mounted FS ( ' - ' before FS )

"/mnt/backup" is mounted read-only

FAR2L, version 2.4.0-6af0746e-beta Linux x86_64

before changes

╔═══════════════════════════════════════════════ Location ═══════════════════════════════════════════════╗

...

║                                   /run/user/1000 │ 392M 392M 1%             │ tmpfs > tmpfs            ▓
║                                      /mnt/backup │ 3.2G 175G 99%            │ - ext4 > /dev/xvdi       ▓
║                                       /mnt/media │ 1.1G 100G 99%            │ fuseblk > /dev/xvdj      ▓
║                                      /mnt/custom │ 1.2G 146G 99%            │ ext4 > /dev/xvdk         ▓
║                              /tmp/test_mnt/a1 a2 │ 3.6M 3.9M 1%             │ ext4 > /dev/loop0        ▓
║                             /tmp/test_mnt/b1  b2 │ 3.6M 3.9M 1%             │ ext4 > /dev/loop1        ▓

...

║                                /tmp/test_mnt/^?_ │ 0.0K 0.0K [useprc]       │ ext4 > /tmp… a/disk4.img ░
║                                /tmp/test_mnt/|?} │ 0.0K 0.0K [useprc]       │ ext4 > /tmp… ]/disk5.img ░
║                                /tmp/test_mnt/9?[ │ 0.0K 0.0K [useprc]       │ ext4 > /tmp… 0/disk6.img ░

...

╟────────────────────────────────────────────── home dirs ────────────────────┼──────────────────────────░
║                               /home/user/Desktop │                          │                          ░
║                             /home/user/Documents │ =  1.6G                  │ ~/Documents              ░

...

╚═══════════════════════════════════════ Ins,Del,Shift-Del,F4,F9 ════════════════════════════════════════╝

FAR2L, version 2.4.1-a2ece888-beta Linux x86_64

after changes

╔═════════════════════════════════════════ Location ═════════════════════════════════════════╗

...

║                                            /home │ 8.48G/19.5G  │ ext4                     ▓
║                                       /usr/local │ 8.48G/19.5G  │ ext4                     ▓
║                                  /var/spool/cron │ 8.48G/19.5G  │ ext4                     ▓
║                                   /var/lib/lxcfs │   0B/0B      │ fuse.lxcfs               ▓
║                                      /mnt/backup │ 3.21G/176.0G │ ext4                     ▓
║                                       /mnt/media │ 1.20G/100.0G │ fuseblk                  ▓
║                                      /mnt/custom │ 1.21G/146.5G │ ext4                     ▓
╟──────────────────────────────────────── home dirs ──────────────┼──────────────────────────▓
║                                        ~/Desktop │              │ ~/Desktop                ▓
║                                      ~/Documents │ :du          │ ~/Documents              ▓

...

╚═════════════════════════════════ Ins,Del,Shift-Del,F4,F9 ══════════════════════════════════╝
@elfmz
Copy link
Owner

elfmz commented Oct 28, 2022

1,3,5: doable but will need extra config options in F9 as not all may like this, question if it worth that?
2,4 passing favorites lines through wordexp with commands substitution enabled would resolve all that by making favorites little bit scriptable..

@sxored
Copy link
Contributor Author

sxored commented Oct 28, 2022

1a) show path to FS or path to device instead of type of FS

this was default behavior in macOS ( Darwin ) environment

IMHO info about FS type gives too little information in Linux and FreeBSD

1b) optionally show path to loop device image

IMHO /dev/loop12 gives too little information, that is why "mount" command show path to loop device image

...

  1. optionally show use percentage in disk list with other delimiter than "/", i guess that "blank space" is better delimiter when there are more than 2 columns like in "df" an "mount" output

IMHO people like me are lazy enough to make unexpected calculations in mind like percentage

otherwise, why display percentages in other places like copy dialog or in viewer for example ?

...

  1. show read-write/read-only status of mounted FS ( ' - ' before FS )

one will notice that FS is in read-only mode only after the failure with file saving or copying of the file into this FS does not work

whether a person is expected to store this information in his or her working memory ?

@sxored
Copy link
Contributor Author

sxored commented Oct 28, 2022

and also

  1. user defined filters for excluding some items from disk list
		if [ ".${sysname}" = ".Linux" ]; then
			AWK_ARG_SRCF='-e'
			DF_ARGS='-P -k -T'
			MNT_CMN_FILTER='grep -v -e " /proc\(/[\/a-z_]\+\)* " -e " /sys\(/[a-z_,]\+\)* " -e " /dev\(/\(pts\|hugepages\|mqueue\)\)\? " -e " /run/user/\([0-1]\+\)/[a-z][a-z0-9\-]* " -e " /home/\([a-z0-9\._]\+\)/.cache/doc " -e " /var/lib/lxcfs " -e " /tmp/\.\([a-z0-9\._]\+\)_\([a-zA-Z0-9\._]\+\) " -e " /run/snapd/ns\(\(/[a-z][a-z0-9\-]\+\.mnt\)\?\) " -e " /snap/\([a-z][a-z0-9\-]\+\)/\([0-9]\+\) " -e " /var/snap\(\(\/\)\|\(\/[^/]\+\?\)\+\?\) " -e " /run/credentials\(\(\/\)\|\(\/[^/]\+\?\)\+\?\) "'
			MNT_USR_FILTER='grep -v -e " /dev\(/\(shm\|foo\|bar\)\)\? " -e " /run\(/\(lock\|rpc_pipefs\|foo\|bar\)\)\? "'
			DF_CMN_FILTER='grep -v -e " /dev\(/\(foo\|bar\)\)\?$" -e " /run\(/\(foo\|bar\)\)\?$"'
			DF_USR_FILTER='grep -v -e " /opt\(/\(shm\|foo\|bar\)\)\?$" -e " /run\(/\(lock\|foo\|bar\)\)\?$" -e " /net$"'
			FT_HEADER='Filesystem Type 1K-blocks Used Available Use%% Mounted_on Mount_options'
		fi

		if [ ".${sysname}" = ".FreeBSD" ]; then
			AWK_ARG_SRCF=''
			DF_ARGS='-P -k'
			MNT_CMN_FILTER='grep -v -e " \(/[a-z]\+\)*/dev/foo "'
			MNT_USR_FILTER='grep -v -e " /opt\(/\(foo\|bar\)\)\? "'
			DF_CMN_FILTER='grep -v -e " /dev\(/\(foo\|bar\)\)\?$"'
			DF_USR_FILTER='grep -v -e " /opt\(/\(foo\|bar\)\)\?$" -e " /net$" -e " /home$"'
			FT_HEADER='Filesystem Type 1K-blocks Used Avail Capacity Mounted_on Mount_options'
		fi

		if [ ".${sysname}" = ".Darwin" ]; then
			DF_ARGS='-P -k'
			AWK_ARG_SRCF=''
			MNT_CMN_FILTER='grep -v -e " /dev " -e " /private/var/\(vm\|folders\)\(\(\/\)\|\(\/[^/]\+\)\+\) " -e " /System/Volumes\(\(\/\)\|\(\/[^/]\+\)\+\) "'
			MNT_USR_FILTER='grep -v -e " /opt\(/\(foo\|bar\)\)\? " -e " /net " -e " /home "'
			DF_CMN_FILTER='grep -v -e " /private/var/\(vm\|folders\)\(\(\/\)\|\(\/[^/]\+\)\+\)$" -e " /System/Volumes\(\(\/\)\|\(\/[^/]\+\)\+\)$"'
			DF_USR_FILTER='grep -v -e " /opt\(/\(foo\|bar\)\)\?$" -e " /net$" -e " /home$"'
			FT_HEADER='Filesystem 1024-blocks Used Available Capacity Mounted_on Mount_options'
		fi

@elfmz
Copy link
Owner

elfmz commented Oct 29, 2022

Now mountpoints are much more customizeable - press F9 key in Alt+F1/2 menu and then press F1.
Also now ~/.config/far2l/favorites may contain shell variable and command expansion also supported there.
So if you still want script-level customization - you can disable mountpoints items at all and then only favorites will be processed. And you can add just one thing there: $(/path/to/your/script.sh) so it will run that script and it will be essentially same script as mounts.sh

@sxored
Copy link
Contributor Author

sxored commented Oct 30, 2022

1a - done

1b - workaround with shell scripting exists, needs testing and some thought

3 - works

5 - works

2,4,6 - needs testing

@elfmz
Copy link
Owner

elfmz commented Nov 6, 2022

so, may close now?

@sxored
Copy link
Contributor Author

sxored commented Nov 6, 2022

wait a moment, please, i need to test last changes

@sxored
Copy link
Contributor Author

sxored commented Nov 6, 2022

there is a minor inconsistency in formatting of values in 2nd column

( from 3 to 5 symbols with last version )

i use this setting for 2nd column - "$U $T $u%"

same with default setting - "$U/$T"


FAR2L, version 2.4.0-6af0746e-beta Linux x86_64

before changes

╔═══════════════════════════════════════════════ Location ═══════════════════════════════════════════════╗

...

║                                   /run/user/1000 │ 392M 392M  1%            │ tmpfs > tmpfs            ▓
║                                      /mnt/backup │ 3.2G 175G 99%            │ - ext4 > /dev/xvdi       ▓
║                                       /mnt/media │ 1.1G 100G 99%            │ fuseblk > /dev/xvdj      ▓
║                                      /mnt/custom │ _85M 146G 99%            │ ext4 > /dev/xvdk         ▓
║                              /tmp/test_mnt/a1 a2 │ 3.6M 3.9M  1%            │ ext4 > /dev/loop0        ▓

...

╚═══════════════════════════════════════ Ins,Del,Shift-Del,F4,F9 ════════════════════════════════════════╝

FAR2L, version 2.4.1-c42eba33-beta Linux x86_64

after changes

╔═══════════════════════════════════════════ Location ════════════════════════════════════════════╗

...

║                                   /var/lib/lxcfs │ 0B 0B NA%         │  lxcfs                   ▓
║                                      /mnt/backup │ 163.7G 176.0G 93% │ !/dev/xvdi               ▓
║                                       /mnt/media │ 98.8G 100.0G 98%  │  /dev/xvdj               ▓
║                                      /mnt/custom │ 137.8G 146.5G 94% │  /dev/xvdk               ▓
║                              /tmp/test_mnt/a1 a2 │ 24.0K 3.92M 0%    │  /dev/loop0              ▓

...

╚════════════════════════════════════ Ins,Del,Shift-Del,F4,F9 ════════════════════════════════════╝

@sxored
Copy link
Contributor Author

sxored commented Nov 6, 2022

2,4 testing


my "favorites" file

-	home dirs
~/Desktop		~/Desktop
~/Documents	= $(printf "%4s" "`[ -e ~/Documents/ ]&&sh -c 'du -sh ~/Documents/ 2>/dev/null|cut -f1'||printf '-'`")	~/Documents
~/Downloads	= $(printf "%4s" "`[ -e ~/Downloads/ ]&&sh -c 'du -sh ~/Downloads/ 2>/dev/null|cut -f1'||printf '-'`")	~/Downloads
~/Music	= $(printf "%4s" "`[ -e ~/Music/ ]&&sh -c 'du -sh ~/Music/ 2>/dev/null|cut -f1'||printf '-'`")	~/Music
~/Pictures	= $(printf "%4s" "`[ -e ~/Pictures/ ]&&sh -c 'du -sh ~/Pictures/ 2>/dev/null|cut -f1'||printf '-'`")	~/Pictures
~/Public	= $(printf "%4s" "`[ -e ~/Public/ ]&&sh -c 'du -sh ~/Public/ 2>/dev/null|cut -f1'||printf '-'`")	~/Public
~/Videos	= $(printf "%4s" "`[ -e ~/Videos/ ]&&sh -c 'du -sh ~/Videos/ 2>/dev/null|cut -f1'||printf '-'`")	~/Videos
-	home work
~/download	= $(printf "%4s" "`[ -e ~/download/ ]&&sh -c 'du -sh ~/download/ 2>/dev/null|cut -f1'||printf '-'`")	~/download
~/projects	= $(printf "%4s" "`[ -e ~/projects/ ]&&sh -c 'du -sh ~/projects/ 2>/dev/null|cut -f1'||printf '-'`")	~/projects
~/various	= $(printf "%4s" "`[ -e ~/various/ ]&&sh -c 'du -sh ~/various/ 2>/dev/null|cut -f1'||printf '-'`")	~/various
-	home hidden
~/.config	= $(printf "%4s" "`[ -e ~/.config/ ]&&sh -c 'du -sh ~/.config/ 2>/dev/null|cut -f1'||printf '-'`")	~/.config
~/.local/share	= $(printf "%4s" "`[ -e ~/.local/share/ ]&&sh -c 'du -sh ~/.local/share/ 2>/dev/null|cut -f1'||printf '-'`")	~/.local/share
~/.local/share/Trash/info	= $(printf "%4s" "`[ -e ~/.local/share/Trash/info/ ]&&sh -c 'du -sh ~/.local/share/Trash/info/ 2>/dev/null|cut -f1'||printf '-'`")	~/.local/share/Trash/info
~/.local/share/Trash/files	= $(printf "%4s" "`[ -e ~/.local/share/Trash/files/ ]&&sh -c 'du -sh ~/.local/share/Trash/files/ 2>/dev/null|cut -f1'||printf '-'`")	~/.local/share/Trash/files
~/.cache	= $(printf "%4s" "`[ -e ~/.cache/ ]&&sh -c 'du -sh ~/.cache/ 2>/dev/null|cut -f1'||printf '-'`")	~/.cache
-	system
/tmp	= $(printf "%4s" "`[ -e /tmp/ ]&&sh -c 'du -sh /tmp/ 2>/dev/null|cut -f1'||printf '-'`")	/tmp
/var/tmp	= $(printf "%4s" "`[ -e /var/tmp/ ]&&sh -c 'du -sh /var/tmp/ 2>/dev/null|cut -f1'||printf '-'`")	/var/tmp


result

╔══════════════════════════════════════ Location ═══════════════════════════════════════╗           

...

╟────────────────────────────────────── home dirs ───────────┼──────────────────────────╢           
║                     /home/user/Desktop │                   │ ~/Desktop                ║           
║                   /home/user/Documents │ = 1.6G            │ ~/Documents              ║           
║                   /home/user/Downloads │ = 1.6G            │ ~/Downloads              ║           
║                       /home/user/Music │ =  38M            │ ~/Music                  ║           
║                    /home/user/Pictures │ =  54M            │ ~/Pictures               ║           
║                      /home/user/Public │ = 1.7G            │ ~/Public                 ║           
║                      /home/user/Videos │ = 122G            │ ~/Videos                 ║           
╟────────────────────────────────────── home work ───────────┼──────────────────────────╢           
║                    /home/user/download │ = 2.6G            │ ~/download               ║           
║                    /home/user/projects │ = 2.3G            │ ~/projects               ║           
║                     /home/user/various │ =    -            │ ~/various                ║           
╟───────────────────────────────────── home hidden ──────────┼──────────────────────────╢           
║                     /home/user/.config │ = 917M            │ ~/.config                ║           
║                /home/user/.local/share │ =  58M            │ ~/.local/share           ║           
║     /home/user/.local/share/Trash/info │ =  16K            │ ~/.local/s…re/Trash/info ║           
║    /home/user/.local/share/Trash/files │ =  32K            │ ~/.local/sh…/Trash/files ║           
║                      /home/user/.cache │ = 397M            │ ~/.cache                 ║           
╟─────────────────────────────────────── system ─────────────┼──────────────────────────╢           
║                                   /tmp │ =  84K            │ /tmp                     ║           
║                               /var/tmp │ =  20K            │ /var/tmp                 ║           

...

╚═══════════════════════════════ Ins,Del,Shift-Del,F4,F9 ═══════════════════════════════╝           

@sxored
Copy link
Contributor Author

sxored commented Nov 6, 2022

3rd column in my settings - "$S $N > $D"

@sxored
Copy link
Contributor Author

sxored commented Nov 6, 2022

Exceptions list can have this value by default

/System/*;/proc;/proc/*;/sys;/sys/*;/dev;/dev/*;/run;/run/*;/tmp;/snap;/snap/*;/private;/private/*;/usr/local;/usr/lib/modules;/var/lib/lxcfs;/var/snap/*;/var/spool/cron;

What do you think ?

@elfmz
Copy link
Owner

elfmz commented Nov 7, 2022

/usr/local;/usr/lib/modules looks not good to be default others ok

@elfmz
Copy link
Owner

elfmz commented Jan 3, 2023

now you can use $> and $< to pad with spaces word on right and on left respectively ti equalize its length with longest similar word across all items

@sxored
Copy link
Contributor Author

sxored commented Jan 9, 2023

Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants