diff options
| author | Thijs Schreijer <thijs@thijsschreijer.nl> | 2013-12-25 00:05:23 +0100 |
|---|---|---|
| committer | Thijs Schreijer <thijs@thijsschreijer.nl> | 2013-12-25 00:05:23 +0100 |
| commit | 33e0ec7be10734235c165c9777d90e28ecc0878c (patch) | |
| tree | 2e4e9ab94f2fca0d5cb6d87550842a04ade75a7f | |
| parent | cd2b8957b519ee01f15c481e13e21ff7f6fa22a0 (diff) | |
| download | luarocks-33e0ec7be10734235c165c9777d90e28ecc0878c.tar.gz luarocks-33e0ec7be10734235c165c9777d90e28ecc0878c.tar.bz2 luarocks-33e0ec7be10734235c165c9777d90e28ecc0878c.zip | |
updated default system tree location to 'program files', so it is protected with admin rights.
Implemented a /SELFCONTAINED installation option that makes a single directory installation
| -rw-r--r-- | install.bat | 66 |
1 files changed, 50 insertions, 16 deletions
diff --git a/install.bat b/install.bat index f6d6f842..ed2a49ff 100644 --- a/install.bat +++ b/install.bat | |||
| @@ -5,10 +5,10 @@ rem=rem --[[ | |||
| 5 | local vars = {} | 5 | local vars = {} |
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | vars.PREFIX = os.getenv("PROGRAMFILES")..[[\LuaRocks]] | 8 | vars.PREFIX = nil |
| 9 | vars.VERSION = "2.1" | 9 | vars.VERSION = "2.1" |
| 10 | vars.SYSCONFDIR = (os.getenv("PROGRAMDATA") or (os.getenv("ALLUSERSPROFILE")..[[\Application Data]])) .. [[\LuaRocks]] -- ALLUSERS for WinXP compat | 10 | vars.SYSCONFDIR = nil |
| 11 | vars.ROCKS_TREE = vars.SYSCONFDIR | 11 | vars.ROCKS_TREE = nil |
| 12 | vars.SCRIPTS_DIR = nil | 12 | vars.SCRIPTS_DIR = nil |
| 13 | vars.LUA_INTERPRETER = nil | 13 | vars.LUA_INTERPRETER = nil |
| 14 | vars.LUA_PREFIX = nil | 14 | vars.LUA_PREFIX = nil |
| @@ -26,9 +26,10 @@ 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 = true |
| 30 | local NOADMIN = false | 30 | local NOADMIN = false |
| 31 | local PROMPT = true | 31 | local PROMPT = true |
| 32 | local SELFCONTAINED = false | ||
| 32 | 33 | ||
| 33 | --- | 34 | --- |
| 34 | -- Some helpers | 35 | -- Some helpers |
| @@ -120,10 +121,19 @@ Installs LuaRocks. | |||
| 120 | 121 | ||
| 121 | Configuring the destinations: | 122 | Configuring the destinations: |
| 122 | /TREE [dir] Root of the local tree of installed rocks. | 123 | /TREE [dir] Root of the local tree of installed rocks. |
| 123 | Default is %PROGRAMDATA%\LuaRocks | 124 | Default is %PROGRAMFILES%\LuaRocks\systree |
| 124 | /SCRIPTS [dir] Where to install commandline scripts installed by | 125 | /SCRIPTS [dir] Where to install commandline scripts installed by |
| 125 | rocks. Default is {TREE}/bin. | 126 | rocks. Default is {TREE}/bin. |
| 126 | 127 | /CONFIG [dir] Location where the config file should be installed. | |
| 128 | Default is %PROGRAMFILES%\LuaRocks | ||
| 129 | /SELFCONTAINED Creates a self contained installation in a single | ||
| 130 | directory given by /P. | ||
| 131 | Sets the /TREE and /CONFIG options to the same | ||
| 132 | location as /P. And does not load registry info | ||
| 133 | with option /NOREG. The only option NOT self | ||
| 134 | contained is the user rock tree, so don't use that | ||
| 135 | if you create a self contained installation. | ||
| 136 | |||
| 127 | Configuring the Lua interpreter: | 137 | Configuring the Lua interpreter: |
| 128 | /LV [version] Lua version to use; either 5.1 or 5.2. | 138 | /LV [version] Lua version to use; either 5.1 or 5.2. |
| 129 | Default is 5.1 | 139 | Default is 5.1 |
| @@ -149,14 +159,12 @@ Compiler configuration: | |||
| 149 | /MW Use mingw as build system instead of MSVC | 159 | /MW Use mingw as build system instead of MSVC |
| 150 | 160 | ||
| 151 | Other options: | 161 | Other options: |
| 152 | /CONFIG [dir] Location where the config file should be installed. | ||
| 153 | Default is %PROGRAMDATA%\LuaRocks | ||
| 154 | /FORCECONFIG Use a single config location. Do not use the | 162 | /FORCECONFIG Use a single config location. Do not use the |
| 155 | LUAROCKS_CONFIG variable or the user's home directory. | 163 | LUAROCKS_CONFIG variable or the user's home directory. |
| 156 | Useful to avoid conflicts when LuaRocks | 164 | Useful to avoid conflicts when LuaRocks |
| 157 | is embedded within an application. | 165 | is embedded within an application. |
| 158 | /F Remove installation directory if it already exists. | 166 | /F Remove installation directory if it already exists. |
| 159 | /R Load registry information to register '.rockspec' | 167 | /NOREG Do not load registry info to register '.rockspec' |
| 160 | extension with LuaRocks commands (right-click). | 168 | extension with LuaRocks commands (right-click). |
| 161 | /NOADMIN The installer requires admin priviledges. If not | 169 | /NOADMIN The installer requires admin priviledges. If not |
| 162 | available it will elevate a new process. Use this | 170 | available it will elevate a new process. Use this |
| @@ -165,10 +173,6 @@ Other options: | |||
| 165 | user. | 173 | user. |
| 166 | /Q Do not prompt for confirmation of settings | 174 | /Q Do not prompt for confirmation of settings |
| 167 | 175 | ||
| 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 | ||
| 171 | |||
| 172 | ]]) | 176 | ]]) |
| 173 | end | 177 | end |
| 174 | 178 | ||
| @@ -207,8 +211,10 @@ local function parse_options(args) | |||
| 207 | FORCE_CONFIG = true | 211 | FORCE_CONFIG = true |
| 208 | elseif name == "/F" then | 212 | elseif name == "/F" then |
| 209 | FORCE = true | 213 | FORCE = true |
| 210 | elseif name == "/R" then | 214 | elseif name == "/SELFCONTAINED" then |
| 211 | REGISTRY = true | 215 | SELFCONTAINED = true |
| 216 | elseif name == "/NOREG" then | ||
| 217 | REGISTRY = false | ||
| 212 | elseif name == "/NOADMIN" then | 218 | elseif name == "/NOADMIN" then |
| 213 | NOADMIN = true | 219 | NOADMIN = true |
| 214 | elseif name == "/Q" then | 220 | elseif name == "/Q" then |
| @@ -221,6 +227,14 @@ end | |||
| 221 | 227 | ||
| 222 | -- check for combination/required flags | 228 | -- check for combination/required flags |
| 223 | local function check_flags() | 229 | local function check_flags() |
| 230 | if SELFCONTAINED then | ||
| 231 | if not vars.PREFIX then | ||
| 232 | die("Option /P is required when using /SELFCONTAINED") | ||
| 233 | end | ||
| 234 | if vars.SYSCONFDIR or vars.ROCKS_TREE or vars.SCRIPTS_DIR then | ||
| 235 | die("Cannot combine /TREE, /SCRIPTS or /CONFIG with /SELFCONTAINED") | ||
| 236 | end | ||
| 237 | end | ||
| 224 | if INSTALL_LUA then | 238 | if INSTALL_LUA then |
| 225 | if vars.LUA_INCDIR or vars.LUA_BINDIR or vars.LUA_LIBDIR or vars.LUA_PREFIX then | 239 | if vars.LUA_INCDIR or vars.LUA_BINDIR or vars.LUA_LIBDIR or vars.LUA_PREFIX then |
| 226 | die("Cannot combine option /L with any of /LUA /BIN /LIB /INC") | 240 | die("Cannot combine option /L with any of /LUA /BIN /LIB /INC") |
| @@ -536,6 +550,7 @@ else | |||
| 536 | print("Admin priviledges available for installing") | 550 | print("Admin priviledges available for installing") |
| 537 | end | 551 | end |
| 538 | 552 | ||
| 553 | vars.PREFIX = vars.PREFIX or os.getenv("PROGRAMFILES")..[[\LuaRocks]] | ||
| 539 | vars.FULL_PREFIX = S"$PREFIX\\$VERSION" | 554 | vars.FULL_PREFIX = S"$PREFIX\\$VERSION" |
| 540 | vars.BINDIR = vars.FULL_PREFIX | 555 | vars.BINDIR = vars.FULL_PREFIX |
| 541 | vars.LIBDIR = vars.FULL_PREFIX | 556 | vars.LIBDIR = vars.FULL_PREFIX |
| @@ -561,15 +576,34 @@ else | |||
| 561 | vars.UNAME_M = get_architecture() -- can only do when installation was found | 576 | vars.UNAME_M = get_architecture() -- can only do when installation was found |
| 562 | end | 577 | end |
| 563 | 578 | ||
| 579 | local datapath | ||
| 580 | if vars.UNAME_M == "x86" then | ||
| 581 | datapath = os.getenv("PROGRAMFILES") .. [[\LuaRocks]] | ||
| 582 | else | ||
| 583 | -- our target interpreter is 64bit, so the tree (with binaries) should go into 64bit program files | ||
| 584 | datapath = os.getenv("ProgramW6432") .. [[\LuaRocks]] | ||
| 585 | end | ||
| 586 | vars.SYSCONFDIR = vars.SYSCONDFIR or datapath | ||
| 587 | vars.ROCKS_TREE = vars.ROCKS_TREE or datapath..[[\systree]] | ||
| 588 | if SELFCONTAINED then | ||
| 589 | vars.SYSCONFDIR = vars.PREFIX | ||
| 590 | vars.ROCKS_TREE = vars.PREFIX..[[\systree]] | ||
| 591 | REGISTRY = false | ||
| 592 | end | ||
| 593 | |||
| 564 | print(S[[ | 594 | print(S[[ |
| 565 | 595 | ||
| 566 | Will configure LuaRocks with the following paths: | 596 | Will configure LuaRocks with the following paths: |
| 567 | LuaRocks : $FULL_PREFIX | 597 | LuaRocks : $FULL_PREFIX |
| 598 | Config file : $SYSCONFDIR\config.lua | ||
| 599 | Rocktree : $ROCKS_TREE | ||
| 600 | |||
| 568 | Lua interpreter: $LUA_BINDIR\$LUA_INTERPRETER | 601 | Lua interpreter: $LUA_BINDIR\$LUA_INTERPRETER |
| 569 | binaries : $LUA_BINDIR | 602 | binaries : $LUA_BINDIR |
| 570 | libraries : $LUA_LIBDIR | 603 | libraries : $LUA_LIBDIR |
| 571 | includes : $LUA_INCDIR | 604 | includes : $LUA_INCDIR |
| 572 | Binaries will be linked against: $LUA_LIBNAME with runtime $LUA_RUNTIME | 605 | |
| 606 | Binaries will be linked against: $LUA_LIBNAME with runtime $LUA_RUNTIME.dll | ||
| 573 | System architecture detected as: $UNAME_M | 607 | System architecture detected as: $UNAME_M |
| 574 | 608 | ||
| 575 | ]]) | 609 | ]]) |
