nautilus-copy-path icon indicating copy to clipboard operation
nautilus-copy-path copied to clipboard

net-installer extracts files into wrong place

Open YanceyChiew opened this issue 10 months ago • 0 comments

There is such a line of guide in the readme:

Net Install

curl -L https://raw.githubusercontent.com/chr314/nautilus-copy-path/master/net-installer.sh | sudo bash

This will cause the entire script to run as an elevated user, which is necessary for the install_dependencies function in net-installer.sh, but it also causes the path written in the install function to be based on the home directory of the root user.

...
install () {
  mkdir -p ~/.local/share/nautilus-python/extensions/nautilus-copy-path
  cp nautilus-copy-path.py ~/.local/share/nautilus-python/extensions
  cp nautilus_copy_path.py translation.py config.json ~/.local/share/nautilus-python/extensions/nautilus-copy-path
  cp -rf translations ~/.local/share/nautilus-python/extensions/nautilus-copy-path
  "${NAUTILUS_PATH}" -q || true
}
...

There are three ways to alleviate this problem:

  • Install this extension into a path accessible to all users: /usr/share/nautilus-python/extensions .
  • Add -E (--preserve-env) flag between sudo and bash, which will preserve the user's environment variables.
  • Put sudo in front of commands that do require root privileges to execute, instead of running the whole script in an elevated bash.

YanceyChiew avatar Sep 04 '23 00:09 YanceyChiew