diff options
| author | Thijs Schreijer <thijs@thijsschreijer.nl> | 2013-12-26 09:31:09 +0100 |
|---|---|---|
| committer | Thijs Schreijer <thijs@thijsschreijer.nl> | 2013-12-26 09:31:09 +0100 |
| commit | 57c4c60f352c0bbecdb28b0f5c27831b48f653a2 (patch) | |
| tree | ed67f90fe99114394b32208e227e3748946d58ff | |
| parent | e4760c86b1a0a90e13017a1f3057216d87595ccf (diff) | |
| download | luarocks-57c4c60f352c0bbecdb28b0f5c27831b48f653a2.tar.gz luarocks-57c4c60f352c0bbecdb28b0f5c27831b48f653a2.tar.bz2 luarocks-57c4c60f352c0bbecdb28b0f5c27831b48f653a2.zip | |
updated comments for exitcodes
batch wrapper script (luarocks.bat) updated to auto-elevate if permission was denied
| -rw-r--r-- | install.bat | 54 | ||||
| -rw-r--r-- | src/luarocks/build.lua | 4 | ||||
| -rw-r--r-- | src/luarocks/install.lua | 4 | ||||
| -rw-r--r-- | src/luarocks/make.lua | 4 | ||||
| -rw-r--r-- | src/luarocks/remove.lua | 4 |
5 files changed, 61 insertions, 9 deletions
diff --git a/install.bat b/install.bat index ed2a49ff..03ec7c94 100644 --- a/install.bat +++ b/install.bat | |||
| @@ -519,6 +519,14 @@ end | |||
| 519 | 519 | ||
| 520 | print(S"LuaRocks $VERSION.x installer.\n") | 520 | print(S"LuaRocks $VERSION.x installer.\n") |
| 521 | 521 | ||
| 522 | print([[ | ||
| 523 | |||
| 524 | ======================== | ||
| 525 | == Checking system... == | ||
| 526 | ======================== | ||
| 527 | |||
| 528 | ]]) | ||
| 529 | |||
| 522 | parse_options(config) | 530 | parse_options(config) |
| 523 | check_flags() | 531 | check_flags() |
| 524 | 532 | ||
| @@ -593,6 +601,10 @@ end | |||
| 593 | 601 | ||
| 594 | print(S[[ | 602 | print(S[[ |
| 595 | 603 | ||
| 604 | ========================== | ||
| 605 | == System check results == | ||
| 606 | ========================== | ||
| 607 | |||
| 596 | Will configure LuaRocks with the following paths: | 608 | Will configure LuaRocks with the following paths: |
| 597 | LuaRocks : $FULL_PREFIX | 609 | LuaRocks : $FULL_PREFIX |
| 598 | Config file : $SYSCONFDIR\config.lua | 610 | Config file : $SYSCONFDIR\config.lua |
| @@ -613,6 +625,14 @@ if PROMPT then | |||
| 613 | io.read() | 625 | io.read() |
| 614 | end | 626 | end |
| 615 | 627 | ||
| 628 | print([[ | ||
| 629 | |||
| 630 | ============================ | ||
| 631 | == Installing LuaRocks... == | ||
| 632 | ============================ | ||
| 633 | |||
| 634 | ]]) | ||
| 635 | |||
| 616 | -- *********************************************************** | 636 | -- *********************************************************** |
| 617 | -- Install LuaRocks files | 637 | -- Install LuaRocks files |
| 618 | -- *********************************************************** | 638 | -- *********************************************************** |
| @@ -680,6 +700,35 @@ IF NOT "%LUA_PATH_5_2%"=="" ( | |||
| 680 | ) | 700 | ) |
| 681 | SET "PATH=$BINDIR;%PATH%" | 701 | SET "PATH=$BINDIR;%PATH%" |
| 682 | "$LUA_INTERPRETER" "$BINDIR\]]..c..[[.lua" %* | 702 | "$LUA_INTERPRETER" "$BINDIR\]]..c..[[.lua" %* |
| 703 | IF NOT "%ERRORLEVEL%"=="2" GOTO EXITLR | ||
| 704 | |||
| 705 | REM Permission denied error, try and auto elevate... | ||
| 706 | REM already an admin? (checking to prevent loops) | ||
| 707 | NET SESSION >NUL 2>&1 | ||
| 708 | IF "%ERRORLEVEL%"=="0" GOTO EXITLR | ||
| 709 | |||
| 710 | REM Do we have PowerShell available? | ||
| 711 | PowerShell /? >NUL 2>&1 | ||
| 712 | IF NOT "%ERRORLEVEL%"=="0" GOTO EXITLR | ||
| 713 | |||
| 714 | :GETTEMPNAME | ||
| 715 | SET TMPFILE=%TEMP%\LuaRocks-Elevator-%RANDOM%.bat | ||
| 716 | IF EXIST "%TMPFILE%" GOTO :GETTEMPNAME | ||
| 717 | |||
| 718 | ECHO @ECHO OFF > "%TMPFILE%" | ||
| 719 | ECHO CHDIR /D %CD% >> "%TMPFILE%" | ||
| 720 | ECHO ECHO %0 %* >> "%TMPFILE%" | ||
| 721 | ECHO ECHO. >> "%TMPFILE%" | ||
| 722 | ECHO CALL %0 %* >> "%TMPFILE%" | ||
| 723 | ECHO ECHO. >> "%TMPFILE%" | ||
| 724 | ECHO ECHO Press any key to close this window... >> "%TMPFILE%" | ||
| 725 | ECHO PAUSE ^> NUL >> "%TMPFILE%" | ||
| 726 | ECHO DEL "%TMPFILE%" >> "%TMPFILE%" | ||
| 727 | |||
| 728 | ECHO Now trying to run again elevated... | ||
| 729 | PowerShell -Command (New-Object -com 'Shell.Application').ShellExecute('%TMPFILE%', '', '', 'runas') | ||
| 730 | |||
| 731 | :EXITLR | ||
| 683 | ENDLOCAL | 732 | ENDLOCAL |
| 684 | ]]) | 733 | ]]) |
| 685 | f:close() | 734 | f:close() |
| @@ -833,7 +882,10 @@ exec( S[[del "$FULL_PREFIX\pe-parser.lua" >NUL]] ) | |||
| 833 | 882 | ||
| 834 | print(S[[ | 883 | print(S[[ |
| 835 | 884 | ||
| 836 | *** LuaRocks is installed! *** | 885 | ============================ |
| 886 | == LuaRocks is installed! == | ||
| 887 | ============================ | ||
| 888 | |||
| 837 | 889 | ||
| 838 | You may want to add the following elements to your paths; | 890 | You may want to add the following elements to your paths; |
| 839 | Lua interpreter; | 891 | Lua interpreter; |
diff --git a/src/luarocks/build.lua b/src/luarocks/build.lua index cee65781..ec269023 100644 --- a/src/luarocks/build.lua +++ b/src/luarocks/build.lua | |||
| @@ -351,8 +351,8 @@ end | |||
| 351 | -- if returned a result, installs the matching rock. | 351 | -- if returned a result, installs the matching rock. |
| 352 | -- @param version string: When passing a package name, a version number may | 352 | -- @param version string: When passing a package name, a version number may |
| 353 | -- also be given. | 353 | -- also be given. |
| 354 | -- @return boolean or (nil, string): True if build was successful; nil and an | 354 | -- @return boolean or (nil, string, exitcode): True if build was successful; nil and an |
| 355 | -- error message otherwise. | 355 | -- error message otherwise. exitcode is optionally returned. |
| 356 | function run(...) | 356 | function run(...) |
| 357 | local flags, name, version = util.parse_flags(...) | 357 | local flags, name, version = util.parse_flags(...) |
| 358 | if type(name) ~= "string" then | 358 | if type(name) ~= "string" then |
diff --git a/src/luarocks/install.lua b/src/luarocks/install.lua index 041d8ca2..b28e6282 100644 --- a/src/luarocks/install.lua +++ b/src/luarocks/install.lua | |||
| @@ -120,8 +120,8 @@ end | |||
| 120 | -- if returned a result, installs the matching rock. | 120 | -- if returned a result, installs the matching rock. |
| 121 | -- @param version string: When passing a package name, a version number | 121 | -- @param version string: When passing a package name, a version number |
| 122 | -- may also be given. | 122 | -- may also be given. |
| 123 | -- @return boolean or (nil, string): True if installation was | 123 | -- @return boolean or (nil, string, exitcode): True if installation was |
| 124 | -- successful, nil and an error message otherwise. | 124 | -- successful, nil and an error message otherwise. exitcode is optionally returned. |
| 125 | function run(...) | 125 | function run(...) |
| 126 | local flags, name, version = util.parse_flags(...) | 126 | local flags, name, version = util.parse_flags(...) |
| 127 | if type(name) ~= "string" then | 127 | if type(name) ~= "string" then |
diff --git a/src/luarocks/make.lua b/src/luarocks/make.lua index aff4f93c..3999e39f 100644 --- a/src/luarocks/make.lua +++ b/src/luarocks/make.lua | |||
| @@ -40,8 +40,8 @@ To install rocks, you'll normally want to use the "install" and | |||
| 40 | 40 | ||
| 41 | --- Driver function for "make" command. | 41 | --- Driver function for "make" command. |
| 42 | -- @param name string: A local rockspec. | 42 | -- @param name string: A local rockspec. |
| 43 | -- @return boolean or (nil, string): True if build was successful; nil and an | 43 | -- @return boolean or (nil, string, exitcode): True if build was successful; nil and an |
| 44 | -- error message otherwise. | 44 | -- error message otherwise. exitcode is optionally returned. |
| 45 | function run(...) | 45 | function run(...) |
| 46 | local flags, rockspec = util.parse_flags(...) | 46 | local flags, rockspec = util.parse_flags(...) |
| 47 | assert(type(rockspec) == "string" or not rockspec) | 47 | assert(type(rockspec) == "string" or not rockspec) |
diff --git a/src/luarocks/remove.lua b/src/luarocks/remove.lua index 9ab6d11f..f2f6997b 100644 --- a/src/luarocks/remove.lua +++ b/src/luarocks/remove.lua | |||
| @@ -132,8 +132,8 @@ end | |||
| 132 | -- a specific version; otherwise, try to remove all versions. | 132 | -- a specific version; otherwise, try to remove all versions. |
| 133 | -- @param version string: When passing a package name, a version number | 133 | -- @param version string: When passing a package name, a version number |
| 134 | -- may also be given. | 134 | -- may also be given. |
| 135 | -- @return boolean or (nil, string): True if removal was | 135 | -- @return boolean or (nil, string, exitcode): True if removal was |
| 136 | -- successful, nil and an error message otherwise. | 136 | -- successful, nil and an error message otherwise. exitcode is optionally returned. |
| 137 | function run(...) | 137 | function run(...) |
| 138 | local flags, name, version = util.parse_flags(...) | 138 | local flags, name, version = util.parse_flags(...) |
| 139 | 139 | ||
