lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tue, Aug 24, 2010 at 8:07 AM, steve donovan
<steve.j.donovan@gmail.com> wrote:
> On Tue, Aug 17, 2010 at 6:20 PM, steve donovan
> <steve.j.donovan@gmail.com> wrote:
>> I'm having a look at the Git latest to see how best to get such a
>> warning in. (With a --local option to force of course)
>
> The issue is that _usually_ a person wants to install a rock globally,
> if luarocks was installed with superuser privileges.
>
> Here's a little patch that seems to do the job; it's for
> luarocks/install.lua and comes just after the basic
> argument-is-a-string check in run():
>
>   if not flags["local"] and not
> fs.is_writable(cfg.config.LUAROCKS_ROCKS_TREE) then
>      return nil, "Must be a superuser to install rocks globally\nOr
> you can install locally with --local"
>   end
>
> It should not interfere with local installations, although I haven't
> tried this yet.

I committed a change to this behavior.

I dropped the old behavior in which the tree list was scanned to find
the first writable one (which meant users ended up installing rocks
locally). Now it always tries the last in the list (which is by
default the global one) and warns users when they have no write
permissions. (It picks the _last_ one so that the old behavior when
running sudo remains the same).

I also added --local as a shorthand to specify the local tree, as
suggested by Steve Donovan.

Feedback is welcome from anyone tracking LuaRocks git -- with this
feature, I believe we're ready for a new 2.0.x release.

-- Hisham