aboutsummaryrefslogtreecommitdiff
path: root/install.bat
diff options
context:
space:
mode:
Diffstat (limited to 'install.bat')
-rw-r--r--install.bat38
1 files changed, 18 insertions, 20 deletions
diff --git a/install.bat b/install.bat
index 398a64eb..33453c65 100644
--- a/install.bat
+++ b/install.bat
@@ -487,18 +487,17 @@ local function backup_config_files()
487 temppath = os.getenv("temp").."\\LR-config-backup-"..tostring(math.random(10000)) 487 temppath = os.getenv("temp").."\\LR-config-backup-"..tostring(math.random(10000))
488 if exists(temppath) then temppath = nil end 488 if exists(temppath) then temppath = nil end
489 end 489 end
490 print("'"..temppath.."'")
491 vars.CONFBACKUPDIR = temppath 490 vars.CONFBACKUPDIR = temppath
492 mkdir(vars.CONFBACKUPDIR) 491 mkdir(vars.CONFBACKUPDIR)
493 exec(S[[COPY "$PREFIX\config*.*" "$CONFBACKUPDIR" >NUL]]) 492 exec(S[[COPY "$PREFIX\config*.*" "$CONFBACKUPDIR" >NUL]])
494 exec(S[[COPY "$FULL_PREFIX\lua\luarocks\site_config*.*" "$CONFBACKUPDIR" >NUL]]) 493 exec(S[[COPY "$PREFIX\lua\luarocks\site_config*.*" "$CONFBACKUPDIR" >NUL]])
495end 494end
496 495
497-- restore previously backed up config files 496-- restore previously backed up config files
498local function restore_config_files() 497local function restore_config_files()
499 if not vars.CONFBACKUPDIR then return end -- there is no backup to restore 498 if not vars.CONFBACKUPDIR then return end -- there is no backup to restore
500 exec(S[[COPY "$CONFBACKUPDIR\config*.*" "$PREFIX" >NUL]]) 499 exec(S[[COPY "$CONFBACKUPDIR\config*.*" "$PREFIX" >NUL]])
501 exec(S[[COPY "$CONFBACKUPDIR\site_config*.*" "$FULL_PREFIX\lua\luarocks" >NUL]]) 500 exec(S[[COPY "$CONFBACKUPDIR\site_config*.*" "$PREFIX\lua\luarocks" >NUL]])
502 -- cleanup 501 -- cleanup
503 exec(S[[RD /S /Q "$CONFBACKUPDIR"]]) 502 exec(S[[RD /S /Q "$CONFBACKUPDIR"]])
504 vars.CONFBACKUPDIR = nil 503 vars.CONFBACKUPDIR = nil
@@ -610,11 +609,10 @@ else
610end 609end
611 610
612vars.PREFIX = vars.PREFIX or os.getenv("PROGRAMFILES")..[[\LuaRocks]] 611vars.PREFIX = vars.PREFIX or os.getenv("PROGRAMFILES")..[[\LuaRocks]]
613vars.FULL_PREFIX = S"$PREFIX\\$VERSION" 612vars.BINDIR = vars.PREFIX
614vars.BINDIR = vars.FULL_PREFIX 613vars.LIBDIR = vars.PREFIX
615vars.LIBDIR = vars.FULL_PREFIX 614vars.LUADIR = S"$PREFIX\\lua"
616vars.LUADIR = S"$FULL_PREFIX\\lua" 615vars.INCDIR = S"$PREFIX\\include"
617vars.INCDIR = S"$FULL_PREFIX\\include"
618vars.LUA_SHORTV = vars.LUA_VERSION:gsub("%.", "") 616vars.LUA_SHORTV = vars.LUA_VERSION:gsub("%.", "")
619 617
620if INSTALL_LUA then 618if INSTALL_LUA then
@@ -659,7 +657,7 @@ print(S[[
659========================== 657==========================
660 658
661Will configure LuaRocks with the following paths: 659Will configure LuaRocks with the following paths:
662LuaRocks : $FULL_PREFIX 660LuaRocks : $PREFIX
663Config file : $CONFIG_FILE 661Config file : $CONFIG_FILE
664Rocktree : $TREE_ROOT 662Rocktree : $TREE_ROOT
665 663
@@ -689,18 +687,18 @@ print([[
689-- Install LuaRocks files 687-- Install LuaRocks files
690-- *********************************************************** 688-- ***********************************************************
691 689
692if exists(vars.FULL_PREFIX) then 690if exists(vars.PREFIX) then
693 if not FORCE then 691 if not FORCE then
694 die(S"$FULL_PREFIX exists. Use /F to force removal and reinstallation.") 692 die(S"$PREFIX exists. Use /F to force removal and reinstallation.")
695 else 693 else
696 backup_config_files() 694 backup_config_files()
697 print(S"Removing $FULL_PREFIX...") 695 print(S"Removing $PREFIX...")
698 exec(S[[RD /S /Q "$FULL_PREFIX"]]) 696 exec(S[[RD /S /Q "$PREFIX"]])
699 print() 697 print()
700 end 698 end
701end 699end
702 700
703print(S"Installing LuaRocks in $FULL_PREFIX...") 701print(S"Installing LuaRocks in $PREFIX...")
704if not exists(vars.BINDIR) then 702if not exists(vars.BINDIR) then
705 if not mkdir(vars.BINDIR) then 703 if not mkdir(vars.BINDIR) then
706 die() 704 die()
@@ -916,17 +914,17 @@ if REGISTRY then
916 -- expand template with correct path information 914 -- expand template with correct path information
917 print() 915 print()
918 print([[Loading registry information for ".rockspec" files]]) 916 print([[Loading registry information for ".rockspec" files]])
919 exec( S[[win32\lua5.1\bin\lua5.1.exe "$FULL_PREFIX\LuaRocks.reg.lua" "$FULL_PREFIX\LuaRocks.reg.template"]] ) 917 exec( S[[win32\lua5.1\bin\lua5.1.exe "$PREFIX\LuaRocks.reg.lua" "$PREFIX\LuaRocks.reg.template"]] )
920 exec( S[[regedit /S "$FULL_PREFIX\\LuaRocks.reg"]] ) 918 exec( S[[regedit /S "$PREFIX\\LuaRocks.reg"]] )
921end 919end
922 920
923-- *********************************************************** 921-- ***********************************************************
924-- Cleanup 922-- Cleanup
925-- *********************************************************** 923-- ***********************************************************
926-- remove regsitry related files, no longer needed 924-- remove regsitry related files, no longer needed
927exec( S[[del "$FULL_PREFIX\LuaRocks.reg.*" >NUL]] ) 925exec( S[[del "$PREFIX\LuaRocks.reg.*" >NUL]] )
928-- remove pe-parser module 926-- remove pe-parser module
929exec( S[[del "$FULL_PREFIX\pe-parser.lua" >NUL]] ) 927exec( S[[del "$PREFIX\pe-parser.lua" >NUL]] )
930 928
931-- *********************************************************** 929-- ***********************************************************
932-- Exit handlers 930-- Exit handlers
@@ -946,8 +944,8 @@ Lua interpreter;
946 PATH : $LUA_BINDIR 944 PATH : $LUA_BINDIR
947 PATHEXT : .LUA 945 PATHEXT : .LUA
948LuaRocks; 946LuaRocks;
949 PATH : $FULL_PREFIX 947 PATH : $PREFIX
950 LUA_PATH : $FULL_PREFIX\lua\?.lua;$FULL_PREFIX\lua\?\init.lua 948 LUA_PATH : $PREFIX\lua\?.lua;$PREFIX\lua\?\init.lua
951Local user rocktree (Note: %APPDATA% is user dependent); 949Local user rocktree (Note: %APPDATA% is user dependent);
952 PATH : %APPDATA%\LuaRocks\bin 950 PATH : %APPDATA%\LuaRocks\bin
953 LUA_PATH : %APPDATA%\LuaRocks\share\lua\$LUA_VERSION\?.lua;%APPDATA%\LuaRocks\share\lua\$LUA_VERSION\?\init.lua 951 LUA_PATH : %APPDATA%\LuaRocks\share\lua\$LUA_VERSION\?.lua;%APPDATA%\LuaRocks\share\lua\$LUA_VERSION\?\init.lua