diff options
Diffstat (limited to 'install.bat')
-rw-r--r-- | install.bat | 38 |
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]]) |
495 | end | 494 | end |
496 | 495 | ||
497 | -- restore previously backed up config files | 496 | -- restore previously backed up config files |
498 | local function restore_config_files() | 497 | local 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 | |||
610 | end | 609 | end |
611 | 610 | ||
612 | vars.PREFIX = vars.PREFIX or os.getenv("PROGRAMFILES")..[[\LuaRocks]] | 611 | vars.PREFIX = vars.PREFIX or os.getenv("PROGRAMFILES")..[[\LuaRocks]] |
613 | vars.FULL_PREFIX = S"$PREFIX\\$VERSION" | 612 | vars.BINDIR = vars.PREFIX |
614 | vars.BINDIR = vars.FULL_PREFIX | 613 | vars.LIBDIR = vars.PREFIX |
615 | vars.LIBDIR = vars.FULL_PREFIX | 614 | vars.LUADIR = S"$PREFIX\\lua" |
616 | vars.LUADIR = S"$FULL_PREFIX\\lua" | 615 | vars.INCDIR = S"$PREFIX\\include" |
617 | vars.INCDIR = S"$FULL_PREFIX\\include" | ||
618 | vars.LUA_SHORTV = vars.LUA_VERSION:gsub("%.", "") | 616 | vars.LUA_SHORTV = vars.LUA_VERSION:gsub("%.", "") |
619 | 617 | ||
620 | if INSTALL_LUA then | 618 | if INSTALL_LUA then |
@@ -659,7 +657,7 @@ print(S[[ | |||
659 | ========================== | 657 | ========================== |
660 | 658 | ||
661 | Will configure LuaRocks with the following paths: | 659 | Will configure LuaRocks with the following paths: |
662 | LuaRocks : $FULL_PREFIX | 660 | LuaRocks : $PREFIX |
663 | Config file : $CONFIG_FILE | 661 | Config file : $CONFIG_FILE |
664 | Rocktree : $TREE_ROOT | 662 | Rocktree : $TREE_ROOT |
665 | 663 | ||
@@ -689,18 +687,18 @@ print([[ | |||
689 | -- Install LuaRocks files | 687 | -- Install LuaRocks files |
690 | -- *********************************************************** | 688 | -- *********************************************************** |
691 | 689 | ||
692 | if exists(vars.FULL_PREFIX) then | 690 | if 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 |
701 | end | 699 | end |
702 | 700 | ||
703 | print(S"Installing LuaRocks in $FULL_PREFIX...") | 701 | print(S"Installing LuaRocks in $PREFIX...") |
704 | if not exists(vars.BINDIR) then | 702 | if 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"]] ) |
921 | end | 919 | end |
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 |
927 | exec( S[[del "$FULL_PREFIX\LuaRocks.reg.*" >NUL]] ) | 925 | exec( S[[del "$PREFIX\LuaRocks.reg.*" >NUL]] ) |
928 | -- remove pe-parser module | 926 | -- remove pe-parser module |
929 | exec( S[[del "$FULL_PREFIX\pe-parser.lua" >NUL]] ) | 927 | exec( 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 |
948 | LuaRocks; | 946 | LuaRocks; |
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 |
951 | Local user rocktree (Note: %APPDATA% is user dependent); | 949 | Local 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 |