Open G4Vi opened 3 weeks ago
SGTM! @zshipko may have some thoughts / direction to add. But please do make any improvements you have in mind.
Will only add that if it impacts the install process, that we update the README and docs throughout the extism.org site etc.
Yeah, I think either of those solutions sound good - it sounds like the first option is a little more automatic, but both are common patterns people will be used to. We should just make sure to test all the edge cases before updating all the docs - I'm happy to help with that when you're ready.
Currently the installation invoke
sudo
if the user is notroot
and$out_prefix
is not in$HOME
. This heuristic has a lot of false positives, all of the failures I looked at http://matrix.cpantesters.org/?dist=Alien-libextism%20v0.1.1 appear to be the cli install script attempting sudo in a scenario where it shouldn't.If we insist on installing with
sudo
, rather that attempting to detect when it's needed, we should try without, and on permission error retry with sudo.However, instead I think we should make two changes:
Don't use sudo at all in the install script. I will use sudo or run it as root myself if I am going to install somewhere that I don't have write access to.
Install the cli to a
$HOME
directory by default. After installing the file on disk, to get it in$PATH
, I prefer when it spits out instructions rather than appends to a dot file, as I know best how to handle my own dot files (I append to.profile
on my systems for efficiency reasons, though it requires logging out and back in for it to take effect). This removes the need for root/sudo for the default install case. If we wanted to we could add a flag to get a system install that just sets the prefix to/usr/local/bin
.