aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2018-07-19 14:51:03 -0300
committerHisham Muhammad <hisham@gobolinux.org>2018-07-20 09:15:00 -0300
commit288db4a9e3abb6ceea2d78b82a044d2c869ad745 (patch)
tree8cf05ffdd0db463f6bd5d23434402127caa84c89
parentc2297e3ca54f96be2ee789c218b4f7e4f225370a (diff)
downloadluarocks-288db4a9e3abb6ceea2d78b82a044d2c869ad745.tar.gz
luarocks-288db4a9e3abb6ceea2d78b82a044d2c869ad745.tar.bz2
luarocks-288db4a9e3abb6ceea2d78b82a044d2c869ad745.zip
install.bat: updates for 3.0.0-rc1
-rw-r--r--install.bat57
1 files changed, 23 insertions, 34 deletions
diff --git a/install.bat b/install.bat
index 5e0f7030..444a6847 100644
--- a/install.bat
+++ b/install.bat
@@ -1,4 +1,4 @@
1rem=rem --[[ 1rem=rem --[[--lua
2@setlocal& set luafile="%~f0" & if exist "%~f0.bat" set luafile="%~f0.bat" 2@setlocal& set luafile="%~f0" & if exist "%~f0.bat" set luafile="%~f0.bat"
3@win32\lua5.1\bin\lua5.1.exe %luafile% %*& exit /b ]] 3@win32\lua5.1\bin\lua5.1.exe %luafile% %*& exit /b ]]
4 4
@@ -601,7 +601,7 @@ local function look_for_lua_install ()
601 return false 601 return false
602end 602end
603 603
604-- backup config[x.x].lua[.bak] and site_config[_x_x].lua 604-- backup config[x.x].lua[.bak]
605local function backup_config_files() 605local function backup_config_files()
606 local temppath 606 local temppath
607 while not temppath do 607 while not temppath do
@@ -611,14 +611,12 @@ local function backup_config_files()
611 vars.CONFBACKUPDIR = temppath 611 vars.CONFBACKUPDIR = temppath
612 mkdir(vars.CONFBACKUPDIR) 612 mkdir(vars.CONFBACKUPDIR)
613 exec(S[[COPY "$PREFIX\config*.*" "$CONFBACKUPDIR" >NUL]]) 613 exec(S[[COPY "$PREFIX\config*.*" "$CONFBACKUPDIR" >NUL]])
614 exec(S[[COPY "$PREFIX\lua\luarocks\core\site_config*.*" "$CONFBACKUPDIR" >NUL]])
615end 614end
616 615
617-- restore previously backed up config files 616-- restore previously backed up config files
618local function restore_config_files() 617local function restore_config_files()
619 if not vars.CONFBACKUPDIR then return end -- there is no backup to restore 618 if not vars.CONFBACKUPDIR then return end -- there is no backup to restore
620 exec(S[[COPY "$CONFBACKUPDIR\config*.*" "$PREFIX" >NUL]]) 619 exec(S[[COPY "$CONFBACKUPDIR\config*.*" "$PREFIX" >NUL]])
621 exec(S[[COPY "$CONFBACKUPDIR\site_config*.*" "$PREFIX\lua\luarocks\core" >NUL]])
622 -- cleanup 620 -- cleanup
623 exec(S[[RD /S /Q "$CONFBACKUPDIR"]]) 621 exec(S[[RD /S /Q "$CONFBACKUPDIR"]])
624 vars.CONFBACKUPDIR = nil 622 vars.CONFBACKUPDIR = nil
@@ -1011,44 +1009,35 @@ restore_config_files()
1011print() 1009print()
1012print("Configuring LuaRocks...") 1010print("Configuring LuaRocks...")
1013 1011
1014-- Create a site-config file 1012-- Create hardcoded.lua
1015local site_config = S("site_config_$LUA_VERSION"):gsub("%.","_")
1016 1013
1017if exists(S([[$LUADIR\luarocks\core\]]..site_config..[[.lua]])) then 1014local hardcoded_lua = S[[$LUADIR\luarocks\core\hardcoded.lua]]
1018 local nname = backup(S([[$LUADIR\luarocks\core\]]..site_config..[[.lua]]), site_config..".lua.bak") 1015
1019 print("***************") 1016os.remove(hardcoded_lua)
1020 print("*** WARNING *** LuaRocks site_config file already exists: '"..site_config..".lua'. The old file has been renamed to '"..nname.."'") 1017
1021 print("***************") 1018vars.SYSTEM = USE_MINGW and "MINGW" or "WindowsNT"
1022end 1019
1023local f = io.open(vars.LUADIR.."\\luarocks\\core\\"..site_config..".lua", "w") 1020local f = io.open(hardcoded_lua, "w")
1024f:write(S[=[
1025local site_config = {}
1026site_config.LUA_INCDIR=[[$LUA_INCDIR]]
1027site_config.LUA_LIBDIR=[[$LUA_LIBDIR]]
1028site_config.LUA_BINDIR=[[$LUA_BINDIR]]
1029site_config.LUA_INTERPRETER=[[$LUA_INTERPRETER]]
1030]=])
1031if USE_MINGW then
1032 f:write("site_config.LUAROCKS_UNAME_S=[[MINGW]]\n")
1033else
1034 f:write("site_config.LUAROCKS_UNAME_S=[[WindowsNT]]\n")
1035end
1036f:write(S[=[ 1021f:write(S[=[
1037site_config.LUAROCKS_UNAME_M=[[$UNAME_M]] 1022return {
1038site_config.LUAROCKS_ROCKS_TREE=[[$TREE_ROOT]] 1023 LUA_INCDIR=[[$LUA_INCDIR]],
1039site_config.LUAROCKS_PREFIX=[[$PREFIX]] 1024 LUA_LIBDIR=[[$LUA_LIBDIR]],
1040site_config.LUAROCKS_DOWNLOADER=[[wget]] 1025 LUA_BINDIR=[[$LUA_BINDIR]],
1041site_config.LUAROCKS_MD5CHECKER=[[md5sum]] 1026 LUA_INTERPRETER=[[$LUA_INTERPRETER]],
1027 SYSTEM = [[$SYSTEM]],
1028 PROCESSOR = [[$UNAME_M]],
1029 PREFIX = [[$PREFIX]],
1030 WIN_TOOLS = [[$PREFIX/tools]],
1042]=]) 1031]=])
1043if FORCE_CONFIG then 1032if FORCE_CONFIG then
1044 f:write("site_config.LUAROCKS_FORCE_CONFIG=true\n") 1033 f:write(" FORCE_CONFIG = true,\n")
1045end 1034end
1046if vars.SYSCONFFORCE then -- only write this value when explcitly given, otherwise rely on defaults 1035if vars.SYSCONFFORCE then -- only write this value when explcitly given, otherwise rely on defaults
1047 f:write(S("site_config.LUAROCKS_SYSCONFDIR=[[$SYSCONFDIR]]\n")) 1036 f:write(S(" SYSCONFDIR = [[$SYSCONFDIR]],\n"))
1048end 1037end
1049f:write("return site_config\n") 1038f:write("}\n")
1050f:close() 1039f:close()
1051print(S([[Created LuaRocks site-config file: $LUADIR\luarocks\core\]]..site_config..[[.lua]])) 1040print(S([[Created LuaRocks hardcoded settings file: $LUADIR\luarocks\core\hardcoded.lua]]))
1052 1041
1053-- create config file 1042-- create config file
1054if not exists(vars.SYSCONFDIR) then 1043if not exists(vars.SYSCONFDIR) then