aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--install.bat43
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
5local vars = {} 5local vars = {}
6 6
7vars.PREFIX = [[C:\LuaRocks]] 7
8vars.PREFIX = os.getenv("PROGRAMFILES")..[[\LuaRocks]]
8vars.VERSION = "2.1" 9vars.VERSION = "2.1"
9vars.SYSCONFDIR = nil 10vars.SYSCONFDIR = (os.getenv("PROGRAMDATA") or (os.getenv("ALLUSERSPROFILE")..[[\Application Data]])) .. [[\LuaRocks]] -- ALLUSERS for WinXP compat
10vars.ROCKS_TREE = nil 11vars.ROCKS_TREE = vars.SYSCONFDIR
11vars.SCRIPTS_DIR = nil 12vars.SCRIPTS_DIR = nil
12vars.LUA_INTERPRETER = nil 13vars.LUA_INTERPRETER = nil
13vars.LUA_PREFIX = nil 14vars.LUA_PREFIX = nil
@@ -21,13 +22,13 @@ vars.LUA_LIB_NAMES = "lua5.1.lib lua51.dll liblua.dll.a"
21vars.LUA_RUNTIME = nil 22vars.LUA_RUNTIME = nil
22vars.UNAME_M = nil 23vars.UNAME_M = nil
23 24
24local P_SET = false
25local FORCE = false 25local FORCE = false
26local FORCE_CONFIG = false 26local FORCE_CONFIG = false
27local INSTALL_LUA = false 27local INSTALL_LUA = false
28local USE_MINGW = false 28local USE_MINGW = false
29local REGISTRY = false 29local REGISTRY = false
30local NOADMIN = false 30local NOADMIN = false
31local 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[[
112Installs LuaRocks. 113Installs 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
119Configuring the destinations: 121Configuring 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
125Configuring the Lua interpreter: 127Configuring 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
149Other options: 151Other 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
168Example:
169To create a self contained install use (assuming Lua is in your PATH):
170INSTALL /P c:\LuaRocks /TREE c:\LuaRocks /CONFIG c:\LuaRocks
164 171
165]]) 172]])
166end 173end
@@ -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
215local function check_flags() 223local 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")
532end 537end
533 538
534vars.SYSCONFDIR = vars.SYSCONFDIR or vars.PREFIX
535vars.ROCKS_TREE = vars.ROCKS_TREE or vars.PREFIX
536vars.FULL_PREFIX = S"$PREFIX\\$VERSION" 539vars.FULL_PREFIX = S"$PREFIX\\$VERSION"
537vars.BINDIR = vars.FULL_PREFIX 540vars.BINDIR = vars.FULL_PREFIX
538vars.LIBDIR = vars.FULL_PREFIX 541vars.LIBDIR = vars.FULL_PREFIX
@@ -563,14 +566,18 @@ print(S[[
563Will configure LuaRocks with the following paths: 566Will configure LuaRocks with the following paths:
564LuaRocks : $FULL_PREFIX 567LuaRocks : $FULL_PREFIX
565Lua interpreter: $LUA_BINDIR\$LUA_INTERPRETER 568Lua interpreter: $LUA_BINDIR\$LUA_INTERPRETER
566Lua binaries : $LUA_BINDIR 569 binaries : $LUA_BINDIR
567Lua libraries : $LUA_LIBDIR 570 libraries : $LUA_LIBDIR
568Lua includes : $LUA_INCDIR 571 includes : $LUA_INCDIR
569Binaries will be linked against: $LUA_LIBNAME with runtime $LUA_RUNTIME 572Binaries will be linked against: $LUA_LIBNAME with runtime $LUA_RUNTIME
570System architecture detected as: $UNAME_M 573System architecture detected as: $UNAME_M
571 574
572]]) 575]])
573 576
577if PROMPT then
578 print("Press <ENTER> to start installing, or press <CTRL>+<C> to abort. Use install /? for installation options.")
579 io.read()
580end
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"]] )
774end 781end
775 782
776-- *********************************************************** 783-- ***********************************************************