fundle icon indicating copy to clipboard operation
fundle copied to clipboard

Configure global installation

Open hunter-richardson opened this issue 3 years ago • 11 comments

#50

  • Added an installation script for installing/configuring fundle globally (includes a flag to restrict user installations)
  • Added functions to functions/fundle.fish for installing and updating global scripts
  • Added completions for these functions to completions/fundle.fish
  • Included global plugins in fundle list printout (disabled the list verbosity flag)
  • Updated README with new functionality

Also (this can be rolled back if necessary, since it isn't related):

  • Optimized/cleaned previous code
  • Use builtin and command where possible to avoid invoking user aliases
  • Replaced echo with printf where possible, since echo is more expensive
  • Use fish builtin argparse to implement --argument-based functionality
  • Deleted unreachable code

Please note: I have not been able to test this functionality, since I don't currently have a personal computer (thanks, ex-wife) and I can't run fish at work.

hunter-richardson avatar Oct 28 '22 19:10 hunter-richardson

I may test this if you ask me to, but not immediately, just hit me up, i'll get back to you

BarbzYHOOL avatar Oct 30 '22 17:10 BarbzYHOOL

@BarbzYHOOL I would appreciate that! It should be ready now.

hunter-richardson avatar Oct 31 '22 14:10 hunter-richardson

@hunter-richardson I was gonna test, i was reading the new readme (saw few typos + link to the obsolete "tuvistavie" github name) and the changed files, and then i thought "but how do i install it??" I am not sure how to test all of this because the install script links to the current fundle.fish and it's not yours

plz give me a simple way to test this (also i haven't tried a PR for more than 2 years, i'm a bit rusty)

BarbzYHOOL avatar Nov 03 '22 21:11 BarbzYHOOL

@BarbzYHOOL LMAO

I wrote the README changes to with the idea in mind that @danhper would merge it. So the link to my new installation script is broken until that happens.

You should be able to just follow the installation instructions, but replace the broken link with the working one.

EDIT: I just realized that simply using my installer also wouldn't grab my new changes to fundle itself, so:

wget https://raw.githubusercontent.com/hunter-richardson/fundle-global/master/install-fundle-global.fish
nano ./install-fundle-global.fish
  # replace "https://raw.githubusercontent.com/tuvistavie/fundle/master/$i/fundle.fish" with "https://raw.githubusercontent.com/hunter-richardson/fundle-global/master/$i/fundle.fish"
  # Ctrl-X y Enter
fish -c "source ./install-fundle-global.fish"
  # optionally with --restrict-user-plugins
rm -rf ./install-fundle-global.fish

hunter-richardson avatar Nov 03 '22 21:11 hunter-richardson

Couldn't install, here are the commands and the output

hastebin.com/danexexika.yaml

BarbzYHOOL avatar Nov 04 '22 20:11 BarbzYHOOL

@hunter-richardson in case you didn't see my reply

BarbzYHOOL avatar Nov 06 '22 19:11 BarbzYHOOL

the hastebin has expired sadly, but it was full of errors, i don't remember, couldn't install it

BarbzYHOOL avatar Nov 14 '22 20:11 BarbzYHOOL

@BarbzYHOOL Sorry it took me so long to get back with you! Work has been a little crazy while I transitioned back to the home-office.

I was able to scan your error log briefly; if I remember correctly, the first few lines looked like invalid permissions. Were you a logged-in as a sudoer on your machine?

EDIT: My bad, I just realized that even if you are a sudoer, you still have to sudo as root to access the /root/.config directories. Hopefully it works now!

hunter-richardson avatar Dec 13 '22 16:12 hunter-richardson

tried the commands you posted on november 3rd, nothing worked, I don't recall the errors but I think it was permission related

BarbzYHOOL avatar Dec 31 '22 22:12 BarbzYHOOL

Hi and thanks a lot for working on this. I think there are currently a few issues with the install script.

First, something like this will not work:

sudo echo foo > /some/protected/file

because only echo will be sudoed and the redirection will be done by the current user, so unless it already has the permissions, this will fail. A common work around is to replace it by

echo foo | sudo tee /some/protected/file > /dev/null

so that the file is actually written to using sudo. tee -a can replace >>. There also seem to be a few sudo missing, e.g. for grep or chmod. The argparse currently does not work with older version of fish (e.g. 3.1.0). The 'restrict_user_plugins'part should be changed to'r-restrict_user_plugins'. I also believe that $argsshould be$argv`.

danhper avatar Jan 04 '23 16:01 danhper

@danhper Good catch, and thanks for the assist! I have corrected these errors, although I don't fully understand the distinction with the change to argparse.

hunter-richardson avatar Jan 05 '23 16:01 hunter-richardson