diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2012-10-08 20:19:50 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2012-10-08 20:19:50 -0300 |
commit | dde3ca9493dedbb950d5c1dfdf32a1bd1b152fca (patch) | |
tree | 33ddc17fa0e5a85962908c328c7490704a711d80 /src | |
parent | e457e70e65f7d1d19af6a6717601fc57175648b8 (diff) | |
download | luarocks-dde3ca9493dedbb950d5c1dfdf32a1bd1b152fca.tar.gz luarocks-dde3ca9493dedbb950d5c1dfdf32a1bd1b152fca.tar.bz2 luarocks-dde3ca9493dedbb950d5c1dfdf32a1bd1b152fca.zip |
Check root parent only if root does not exist (useful for ~/.luarocks, avoids breakage with /usr/local). Closes #100.
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/fs/lua.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua index c413ccb3..24b05a59 100644 --- a/src/luarocks/fs/lua.lua +++ b/src/luarocks/fs/lua.lua | |||
@@ -669,13 +669,18 @@ function check_command_permissions(flags) | |||
669 | local root_dir = path.root_dir(cfg.rocks_dir) | 669 | local root_dir = path.root_dir(cfg.rocks_dir) |
670 | local ok = true | 670 | local ok = true |
671 | local err = "" | 671 | local err = "" |
672 | for _, dir in ipairs { cfg.rocks_dir, root_dir, dir.dir_name(root_dir) } do | 672 | for _, dir in ipairs { cfg.rocks_dir, root_dir } do |
673 | if fs.exists(dir) and not fs.is_writable(dir) then | 673 | if fs.exists(dir) and not fs.is_writable(dir) then |
674 | ok = false | 674 | ok = false |
675 | err = "Your user does not have write permissions in " .. dir | 675 | err = "Your user does not have write permissions in " .. dir |
676 | break | 676 | break |
677 | end | 677 | end |
678 | end | 678 | end |
679 | local root_parent = dir.dir_name(root_dir) | ||
680 | if ok and not fs.exists(root_dir) and not fs.is_writable(root_parent) then | ||
681 | ok = false | ||
682 | err = root_dir.." does not exist and your user does not have write permissions in " .. root_parent | ||
683 | end | ||
679 | if ok then | 684 | if ok then |
680 | return true | 685 | return true |
681 | else | 686 | else |