diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2018-07-19 14:51:03 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-07-20 09:15:00 -0300 |
commit | 288db4a9e3abb6ceea2d78b82a044d2c869ad745 (patch) | |
tree | 8cf05ffdd0db463f6bd5d23434402127caa84c89 | |
parent | c2297e3ca54f96be2ee789c218b4f7e4f225370a (diff) | |
download | luarocks-288db4a9e3abb6ceea2d78b82a044d2c869ad745.tar.gz luarocks-288db4a9e3abb6ceea2d78b82a044d2c869ad745.tar.bz2 luarocks-288db4a9e3abb6ceea2d78b82a044d2c869ad745.zip |
install.bat: updates for 3.0.0-rc1
-rw-r--r-- | install.bat | 57 |
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 @@ | |||
1 | rem=rem --[[ | 1 | rem=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 |
602 | end | 602 | end |
603 | 603 | ||
604 | -- backup config[x.x].lua[.bak] and site_config[_x_x].lua | 604 | -- backup config[x.x].lua[.bak] |
605 | local function backup_config_files() | 605 | local 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]]) | ||
615 | end | 614 | end |
616 | 615 | ||
617 | -- restore previously backed up config files | 616 | -- restore previously backed up config files |
618 | local function restore_config_files() | 617 | local 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() | |||
1011 | print() | 1009 | print() |
1012 | print("Configuring LuaRocks...") | 1010 | print("Configuring LuaRocks...") |
1013 | 1011 | ||
1014 | -- Create a site-config file | 1012 | -- Create hardcoded.lua |
1015 | local site_config = S("site_config_$LUA_VERSION"):gsub("%.","_") | ||
1016 | 1013 | ||
1017 | if exists(S([[$LUADIR\luarocks\core\]]..site_config..[[.lua]])) then | 1014 | local 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("***************") | 1016 | os.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("***************") | 1018 | vars.SYSTEM = USE_MINGW and "MINGW" or "WindowsNT" |
1022 | end | 1019 | |
1023 | local f = io.open(vars.LUADIR.."\\luarocks\\core\\"..site_config..".lua", "w") | 1020 | local f = io.open(hardcoded_lua, "w") |
1024 | f:write(S[=[ | ||
1025 | local site_config = {} | ||
1026 | site_config.LUA_INCDIR=[[$LUA_INCDIR]] | ||
1027 | site_config.LUA_LIBDIR=[[$LUA_LIBDIR]] | ||
1028 | site_config.LUA_BINDIR=[[$LUA_BINDIR]] | ||
1029 | site_config.LUA_INTERPRETER=[[$LUA_INTERPRETER]] | ||
1030 | ]=]) | ||
1031 | if USE_MINGW then | ||
1032 | f:write("site_config.LUAROCKS_UNAME_S=[[MINGW]]\n") | ||
1033 | else | ||
1034 | f:write("site_config.LUAROCKS_UNAME_S=[[WindowsNT]]\n") | ||
1035 | end | ||
1036 | f:write(S[=[ | 1021 | f:write(S[=[ |
1037 | site_config.LUAROCKS_UNAME_M=[[$UNAME_M]] | 1022 | return { |
1038 | site_config.LUAROCKS_ROCKS_TREE=[[$TREE_ROOT]] | 1023 | LUA_INCDIR=[[$LUA_INCDIR]], |
1039 | site_config.LUAROCKS_PREFIX=[[$PREFIX]] | 1024 | LUA_LIBDIR=[[$LUA_LIBDIR]], |
1040 | site_config.LUAROCKS_DOWNLOADER=[[wget]] | 1025 | LUA_BINDIR=[[$LUA_BINDIR]], |
1041 | site_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 | ]=]) |
1043 | if FORCE_CONFIG then | 1032 | if FORCE_CONFIG then |
1044 | f:write("site_config.LUAROCKS_FORCE_CONFIG=true\n") | 1033 | f:write(" FORCE_CONFIG = true,\n") |
1045 | end | 1034 | end |
1046 | if vars.SYSCONFFORCE then -- only write this value when explcitly given, otherwise rely on defaults | 1035 | if 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")) |
1048 | end | 1037 | end |
1049 | f:write("return site_config\n") | 1038 | f:write("}\n") |
1050 | f:close() | 1039 | f:close() |
1051 | print(S([[Created LuaRocks site-config file: $LUADIR\luarocks\core\]]..site_config..[[.lua]])) | 1040 | print(S([[Created LuaRocks hardcoded settings file: $LUADIR\luarocks\core\hardcoded.lua]])) |
1052 | 1041 | ||
1053 | -- create config file | 1042 | -- create config file |
1054 | if not exists(vars.SYSCONFDIR) then | 1043 | if not exists(vars.SYSCONFDIR) then |