HOW TO resolve multiple instances of symlinks in ls and in mc?

Technical issues/questions of an intermediate or advanced nature.
User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

HOW TO resolve multiple instances of symlinks in ls and in mc?

Post#1 by Rava » 01 Oct 2022, 09:10

I use multiple instances of symlinks for some modules in /base/ so that the several Porteus variants I have always point to the most recent version without the need to change anything in the several /base/ folders I have.

As example here the palemoon module on the external SD card via USB reader, currently mounted as /mnt/sdc1 :
root@porteus:/mnt/sdc1/Porteus_5.0/porteus/base# ls -lH 005-palemoon-recent.xzm
-rw-r--r-- 1 root root 40427520 2022-09-28 17:44 005-palemoon-recent.xzm
root@porteus:/mnt/sdc1/Porteus_5.0/porteus/base# ls -l 005-palemoon-recent.xzm
lrwxrwxrwx 1 root root 53 2022-09-29 14:06 005-palemoon-recent.xzm -> ../../../Porteus_modules/base/005-palemoon-recent.xzm
root@porteus:/mnt/sdc1/Porteus_5.0/porteus/base# ls -l ../../../Porteus_modules/base/005-palemoon-recent.xzm
lrwxrwxrwx 1 root root 43 2022-09-29 14:11 ../../../Porteus_modules/base/005-palemoon-recent.xzm -> 005-palemoon-31.3.0.1.linux-x86_64-gtk3.xzm
When copying the files via mc and using [x] Follow links I get the module itself not a symlink. But I want the resulting module not be "005-palemoon-recent.xzm" but be "005-palemoon-31.3.0.1.linux-x86_64-gtk3.xzm"

As you see in the [ quote ] snippet above, ls is also unable to dereference the command line to the end.

Code: Select all

root@porteus:~# ls --help |grep -A 1 -- -H
  -H, --dereference-command-line
                             follow symbolic links listed on the command line
lt only resolves one level of dereference but fails into following to the original non-symlinked file.

Any ideas how to solve both?
having ls giving the resulting file (in the above example dereference to 005-palemoon-31.3.0.1.linux-x86_64-gtk3.xzm
getting mc to copy the resulting file (in the above example having a file named 005-palemoon-31.3.0.1.linux-x86_64-gtk3.xzm and not 005-palemoon-recent.xzm)
Cheers!
Yours Rava