diff options
| author | Thijs Schreijer <thijs@thijsschreijer.nl> | 2013-12-03 14:06:44 +0100 |
|---|---|---|
| committer | Thijs Schreijer <thijs@thijsschreijer.nl> | 2013-12-03 14:06:44 +0100 |
| commit | 16af24817fafbd7d199c1e9f2f6a1e87320de5d9 (patch) | |
| tree | 77cc3aabf663eaf71721a84cc4b771be2e67d66f | |
| parent | 5f0879653006ed468370849b6268ad8751285a8d (diff) | |
| download | luarocks-16af24817fafbd7d199c1e9f2f6a1e87320de5d9.tar.gz luarocks-16af24817fafbd7d199c1e9f2f6a1e87320de5d9.tar.bz2 luarocks-16af24817fafbd7d199c1e9f2f6a1e87320de5d9.zip | |
Does the windows installation with Windowish defaults
Adds a prompt before installing, and a switch /Q to ignore that
example added to help text to explain a self contained installation
registry information is now loaded without prompts
| -rw-r--r-- | install.bat | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/install.bat b/install.bat index 8373f856..39043f9a 100644 --- a/install.bat +++ b/install.bat | |||
| @@ -4,10 +4,11 @@ rem=rem --[[ | |||
| 4 | 4 | ||
| 5 | local vars = {} | 5 | local vars = {} |
| 6 | 6 | ||
| 7 | vars.PREFIX = [[C:\LuaRocks]] | 7 | |
| 8 | vars.PREFIX = os.getenv("PROGRAMFILES")..[[\LuaRocks]] | ||
| 8 | vars.VERSION = "2.1" | 9 | vars.VERSION = "2.1" |
| 9 | vars.SYSCONFDIR = nil | 10 | vars.SYSCONFDIR = (os.getenv("PROGRAMDATA") or (os.getenv("ALLUSERSPROFILE")..[[\Application Data]])) .. [[\LuaRocks]] -- ALLUSERS for WinXP compat |
| 10 | vars.ROCKS_TREE = nil | 11 | vars.ROCKS_TREE = vars.SYSCONFDIR |
| 11 | vars.SCRIPTS_DIR = nil | 12 | vars.SCRIPTS_DIR = nil |
| 12 | vars.LUA_INTERPRETER = nil | 13 | vars.LUA_INTERPRETER = nil |
| 13 | vars.LUA_PREFIX = nil | 14 | vars.LUA_PREFIX = nil |
| @@ -21,13 +22,13 @@ vars.LUA_LIB_NAMES = "lua5.1.lib lua51.dll liblua.dll.a" | |||
| 21 | vars.LUA_RUNTIME = nil | 22 | vars.LUA_RUNTIME = nil |
| 22 | vars.UNAME_M = nil | 23 | vars.UNAME_M = nil |
| 23 | 24 | ||
| 24 | local P_SET = false | ||
| 25 | local FORCE = false | 25 | local FORCE = false |
| 26 | local FORCE_CONFIG = false | 26 | local FORCE_CONFIG = false |
| 27 | local INSTALL_LUA = false | 27 | local INSTALL_LUA = false |
| 28 | local USE_MINGW = false | 28 | local USE_MINGW = false |
| 29 | local REGISTRY = false | 29 | local REGISTRY = false |
| 30 | local NOADMIN = false | 30 | local NOADMIN = false |
| 31 | local PROMPT = true | ||
| 31 | 32 | ||
| 32 | --- | 33 | --- |
| 33 | -- Some helpers | 34 | -- Some helpers |
| @@ -111,16 +112,17 @@ local function print_help() | |||
| 111 | print(S[[ | 112 | print(S[[ |
| 112 | Installs LuaRocks. | 113 | Installs LuaRocks. |
| 113 | 114 | ||
| 114 | /P [dir] (REQUIRED) Where to install LuaRocks. | 115 | /P [dir] Where to install LuaRocks. |
| 115 | Note that version; $VERSION, will be appended to this | 116 | Note that version; $VERSION, will be appended to this |
| 116 | path, so "/P c:\luarocks\" will install in | 117 | path, so "/P c:\luarocks\" will install in |
| 117 | "c:\luarocks\$VERSION\" | 118 | "c:\luarocks\$VERSION\" |
| 119 | Default is %PROGRAMFILES%\LuaRocks | ||
| 118 | 120 | ||
| 119 | Configuring the destinations: | 121 | Configuring the destinations: |
| 120 | /TREE [dir] Root of the local tree of installed rocks. | 122 | /TREE [dir] Root of the local tree of installed rocks. |
| 121 | Default is same place of installation | 123 | Default is %PROGRAMDATA%\LuaRocks |
| 122 | /SCRIPTS [dir] Where to install commandline scripts installed by | 124 | /SCRIPTS [dir] Where to install commandline scripts installed by |
| 123 | rocks. Default is TREE/bin. | 125 | rocks. Default is {TREE}/bin. |
| 124 | 126 | ||
| 125 | Configuring the Lua interpreter: | 127 | Configuring the Lua interpreter: |
| 126 | /LV [version] Lua version to use; either 5.1 or 5.2. | 128 | /LV [version] Lua version to use; either 5.1 or 5.2. |
| @@ -148,7 +150,7 @@ Compiler configuration: | |||
| 148 | 150 | ||
| 149 | Other options: | 151 | Other options: |
| 150 | /CONFIG [dir] Location where the config file should be installed. | 152 | /CONFIG [dir] Location where the config file should be installed. |
| 151 | Default is same place of installation | 153 | Default is %PROGRAMDATA%\LuaRocks |
| 152 | /FORCECONFIG Use a single config location. Do not use the | 154 | /FORCECONFIG Use a single config location. Do not use the |
| 153 | LUAROCKS_CONFIG variable or the user's home directory. | 155 | LUAROCKS_CONFIG variable or the user's home directory. |
| 154 | Useful to avoid conflicts when LuaRocks | 156 | Useful to avoid conflicts when LuaRocks |
| @@ -161,6 +163,11 @@ Other options: | |||
| 161 | switch to prevent elevation, but make sure the | 163 | switch to prevent elevation, but make sure the |
| 162 | destination paths are all accessible for the current | 164 | destination paths are all accessible for the current |
| 163 | user. | 165 | user. |
| 166 | /Q Do not prompt for confirmation of settings | ||
| 167 | |||
| 168 | Example: | ||
| 169 | To create a self contained install use (assuming Lua is in your PATH): | ||
| 170 | INSTALL /P c:\LuaRocks /TREE c:\LuaRocks /CONFIG c:\LuaRocks | ||
| 164 | 171 | ||
| 165 | ]]) | 172 | ]]) |
| 166 | end | 173 | end |
| @@ -176,7 +183,6 @@ local function parse_options(args) | |||
| 176 | os.exit(0) | 183 | os.exit(0) |
| 177 | elseif name == "/P" then | 184 | elseif name == "/P" then |
| 178 | vars.PREFIX = option.value | 185 | vars.PREFIX = option.value |
| 179 | P_SET = true | ||
| 180 | elseif name == "/CONFIG" then | 186 | elseif name == "/CONFIG" then |
| 181 | vars.SYSCONFDIR = option.value | 187 | vars.SYSCONFDIR = option.value |
| 182 | elseif name == "/TREE" then | 188 | elseif name == "/TREE" then |
| @@ -205,6 +211,8 @@ local function parse_options(args) | |||
| 205 | REGISTRY = true | 211 | REGISTRY = true |
| 206 | elseif name == "/NOADMIN" then | 212 | elseif name == "/NOADMIN" then |
| 207 | NOADMIN = true | 213 | NOADMIN = true |
| 214 | elseif name == "/Q" then | ||
| 215 | PROMPT = false | ||
| 208 | else | 216 | else |
| 209 | die("Unrecognized option: " .. name) | 217 | die("Unrecognized option: " .. name) |
| 210 | end | 218 | end |
| @@ -213,9 +221,6 @@ end | |||
| 213 | 221 | ||
| 214 | -- check for combination/required flags | 222 | -- check for combination/required flags |
| 215 | local function check_flags() | 223 | local function check_flags() |
| 216 | if not P_SET then | ||
| 217 | die("Missing required parameter /P") | ||
| 218 | end | ||
| 219 | if INSTALL_LUA then | 224 | if INSTALL_LUA then |
| 220 | if vars.LUA_INCDIR or vars.LUA_BINDIR or vars.LUA_LIBDIR or vars.LUA_PREFIX then | 225 | if vars.LUA_INCDIR or vars.LUA_BINDIR or vars.LUA_LIBDIR or vars.LUA_PREFIX then |
| 221 | die("Cannot combine option /L with any of /LUA /BIN /LIB /INC") | 226 | die("Cannot combine option /L with any of /LUA /BIN /LIB /INC") |
| @@ -531,8 +536,6 @@ else | |||
| 531 | print("Admin priviledges available for installing") | 536 | print("Admin priviledges available for installing") |
| 532 | end | 537 | end |
| 533 | 538 | ||
| 534 | vars.SYSCONFDIR = vars.SYSCONFDIR or vars.PREFIX | ||
| 535 | vars.ROCKS_TREE = vars.ROCKS_TREE or vars.PREFIX | ||
| 536 | vars.FULL_PREFIX = S"$PREFIX\\$VERSION" | 539 | vars.FULL_PREFIX = S"$PREFIX\\$VERSION" |
| 537 | vars.BINDIR = vars.FULL_PREFIX | 540 | vars.BINDIR = vars.FULL_PREFIX |
| 538 | vars.LIBDIR = vars.FULL_PREFIX | 541 | vars.LIBDIR = vars.FULL_PREFIX |
| @@ -563,14 +566,18 @@ print(S[[ | |||
| 563 | Will configure LuaRocks with the following paths: | 566 | Will configure LuaRocks with the following paths: |
| 564 | LuaRocks : $FULL_PREFIX | 567 | LuaRocks : $FULL_PREFIX |
| 565 | Lua interpreter: $LUA_BINDIR\$LUA_INTERPRETER | 568 | Lua interpreter: $LUA_BINDIR\$LUA_INTERPRETER |
| 566 | Lua binaries : $LUA_BINDIR | 569 | binaries : $LUA_BINDIR |
| 567 | Lua libraries : $LUA_LIBDIR | 570 | libraries : $LUA_LIBDIR |
| 568 | Lua includes : $LUA_INCDIR | 571 | includes : $LUA_INCDIR |
| 569 | Binaries will be linked against: $LUA_LIBNAME with runtime $LUA_RUNTIME | 572 | Binaries will be linked against: $LUA_LIBNAME with runtime $LUA_RUNTIME |
| 570 | System architecture detected as: $UNAME_M | 573 | System architecture detected as: $UNAME_M |
| 571 | 574 | ||
| 572 | ]]) | 575 | ]]) |
| 573 | 576 | ||
| 577 | if PROMPT then | ||
| 578 | print("Press <ENTER> to start installing, or press <CTRL>+<C> to abort. Use install /? for installation options.") | ||
| 579 | io.read() | ||
| 580 | end | ||
| 574 | 581 | ||
| 575 | -- *********************************************************** | 582 | -- *********************************************************** |
| 576 | -- Install LuaRocks files | 583 | -- Install LuaRocks files |
| @@ -770,7 +777,7 @@ if REGISTRY then | |||
| 770 | print() | 777 | print() |
| 771 | print([[Loading registry information for ".rockspec" files]]) | 778 | print([[Loading registry information for ".rockspec" files]]) |
| 772 | exec( S[[lua5.1\bin\lua5.1.exe "$FULL_PREFIX\LuaRocks.reg.lua" "$FULL_PREFIX\LuaRocks.reg.template"]] ) | 779 | exec( S[[lua5.1\bin\lua5.1.exe "$FULL_PREFIX\LuaRocks.reg.lua" "$FULL_PREFIX\LuaRocks.reg.template"]] ) |
| 773 | exec( S[["$FULL_PREFIX\\LuaRocks.reg"]] ) | 780 | exec( S[[regedit /S "$FULL_PREFIX\\LuaRocks.reg"]] ) |
| 774 | end | 781 | end |
| 775 | 782 | ||
| 776 | -- *********************************************************** | 783 | -- *********************************************************** |
