aboutsummaryrefslogtreecommitdiff
path: root/install.bat
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2017-10-04 11:14:42 -0300
committerGitHub <noreply@github.com>2017-10-04 11:14:42 -0300
commit84b4fe99cac37850a97858e0b641043bd3178d8a (patch)
treeb4578689091b8360aed71f531faf2513b7d41684 /install.bat
parent100c18d048936b5a47f29f55e6ce8b24277fb70f (diff)
downloadluarocks-84b4fe99cac37850a97858e0b641043bd3178d8a.tar.gz
luarocks-84b4fe99cac37850a97858e0b641043bd3178d8a.tar.bz2
luarocks-84b4fe99cac37850a97858e0b641043bd3178d8a.zip
Use versioned files only. (#734)
Let's take the opportunity of a new major version to make an important cleanup: getting rid of the error-prone unversioned configuration files. This drops support for: * Unversioned config.lua -> use config-5.x.lua * Unversioned luarocks/site_config.lua -> it always generates luarocks/core/site_config_5_x.lua * Unversioned lib/luarocks/rocks -> it always uses lib/luarocks/rocks-5.x
Diffstat (limited to 'install.bat')
-rw-r--r--install.bat13
1 files changed, 7 insertions, 6 deletions
diff --git a/install.bat b/install.bat
index 118abfc7..0f334ab9 100644
--- a/install.bat
+++ b/install.bat
@@ -604,14 +604,14 @@ local function backup_config_files()
604 vars.CONFBACKUPDIR = temppath 604 vars.CONFBACKUPDIR = temppath
605 mkdir(vars.CONFBACKUPDIR) 605 mkdir(vars.CONFBACKUPDIR)
606 exec(S[[COPY "$PREFIX\config*.*" "$CONFBACKUPDIR" >NUL]]) 606 exec(S[[COPY "$PREFIX\config*.*" "$CONFBACKUPDIR" >NUL]])
607 exec(S[[COPY "$PREFIX\lua\luarocks\site_config*.*" "$CONFBACKUPDIR" >NUL]]) 607 exec(S[[COPY "$PREFIX\lua\luarocks\core\site_config*.*" "$CONFBACKUPDIR" >NUL]])
608end 608end
609 609
610-- restore previously backed up config files 610-- restore previously backed up config files
611local function restore_config_files() 611local function restore_config_files()
612 if not vars.CONFBACKUPDIR then return end -- there is no backup to restore 612 if not vars.CONFBACKUPDIR then return end -- there is no backup to restore
613 exec(S[[COPY "$CONFBACKUPDIR\config*.*" "$PREFIX" >NUL]]) 613 exec(S[[COPY "$CONFBACKUPDIR\config*.*" "$PREFIX" >NUL]])
614 exec(S[[COPY "$CONFBACKUPDIR\site_config*.*" "$PREFIX\lua\luarocks" >NUL]]) 614 exec(S[[COPY "$CONFBACKUPDIR\site_config*.*" "$PREFIX\lua\luarocks\core" >NUL]])
615 -- cleanup 615 -- cleanup
616 exec(S[[RD /S /Q "$CONFBACKUPDIR"]]) 616 exec(S[[RD /S /Q "$CONFBACKUPDIR"]])
617 vars.CONFBACKUPDIR = nil 617 vars.CONFBACKUPDIR = nil
@@ -937,13 +937,14 @@ print("Configuring LuaRocks...")
937 937
938-- Create a site-config file 938-- Create a site-config file
939local site_config = S("site_config_$LUA_VERSION"):gsub("%.","_") 939local site_config = S("site_config_$LUA_VERSION"):gsub("%.","_")
940if exists(S([[$LUADIR\luarocks\]]..site_config..[[.lua]])) then 940
941 local nname = backup(S([[$LUADIR\luarocks\]]..site_config..[[.lua]]), site_config..".lua.bak") 941if exists(S([[$LUADIR\luarocks\core\]]..site_config..[[.lua]])) then
942 local nname = backup(S([[$LUADIR\luarocks\core\]]..site_config..[[.lua]]), site_config..".lua.bak")
942 print("***************") 943 print("***************")
943 print("*** WARNING *** LuaRocks site_config file already exists: '"..site_config..".lua'. The old file has been renamed to '"..nname.."'") 944 print("*** WARNING *** LuaRocks site_config file already exists: '"..site_config..".lua'. The old file has been renamed to '"..nname.."'")
944 print("***************") 945 print("***************")
945end 946end
946local f = io.open(vars.LUADIR.."\\luarocks\\"..site_config..".lua", "w") 947local f = io.open(vars.LUADIR.."\\luarocks\\core\\"..site_config..".lua", "w")
947f:write(S[=[ 948f:write(S[=[
948local site_config = {} 949local site_config = {}
949site_config.LUA_INCDIR=[[$LUA_INCDIR]] 950site_config.LUA_INCDIR=[[$LUA_INCDIR]]
@@ -971,7 +972,7 @@ if vars.SYSCONFFORCE then -- only write this value when explcitly given, otherw
971end 972end
972f:write("return site_config\n") 973f:write("return site_config\n")
973f:close() 974f:close()
974print(S([[Created LuaRocks site-config file: $LUADIR\luarocks\]]..site_config..[[.lua]])) 975print(S([[Created LuaRocks site-config file: $LUADIR\luarocks\core\]]..site_config..[[.lua]]))
975 976
976-- create config file 977-- create config file
977if not exists(vars.SYSCONFDIR) then 978if not exists(vars.SYSCONFDIR) then