Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Installing extra files from install script
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Jakob Borg  
View profile  
 More options Sep 29 2012, 11:47 am
From: Jakob Borg <ja...@nym.se>
Date: Sat, 29 Sep 2012 08:47:40 -0700 (PDT)
Local: Sat, Sep 29 2012 11:47 am
Subject: Installing extra files from install script

Hi!

I'd like to install a zsh completion script for a CLI tool when it's
installed globally (i.e. npm install -g). This would mean putting a file in
/usr/share/zsh/site-functions (or wherever zsh was installed). That usually
requires root permissions. When testing this with an install script, it
fails. Checking the documentation, I see

BEST PRACTICES
[...]
       o   Don't prefix your script commands with "sudo".  If root
permissions are required for some reason,
           then it'll fail with that error, and the user will sudo the npm
command in question.

So a "sudo npm install -g" would run the script as root? No:

USER
       If npm was invoked with root privileges, then it will change the uid
to the user account or uid spec-
       ified  by  the  user  config, which defaults to nobody.  Set the
unsafe-perm flag to run scripts with
       root privileges.

So is there no way to get the install script to run with root privs (apart
from setting 'unsafe-perm')? Using sudo from within the script itself
wouldn't work either, since it's run as nobody...

Is this simply outside the scope of npm, hence not supported and I should
implement something like "mycommand install-completion" instead, to be used
after the installation is complete?

//jb


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Isaac Schlueter  
View profile  
 More options Sep 29 2012, 3:45 pm
From: Isaac Schlueter <i...@izs.me>
Date: Sat, 29 Sep 2012 12:45:15 -0700
Local: Sat, Sep 29 2012 3:45 pm
Subject: Re: [npm] Installing extra files from install script
Yes, you should have a command that the user needs to run after
installation to add the completion stuff.  Check out how npm adds
completion capabilities.  Running `npm completion` outputs a script
that you can pipe to wherever you want, or run with `. <(npm
completion)` in your .bashrc or .zshrc file.

It's very hard to do this in a platform-independent way anyway, so
it's best to just make it easy for the user, but let them decide how
to go about it.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »