2016-11-16 16:46:50 +01:00
|
|
|
@echo off
|
2016-09-14 14:55:14 +02:00
|
|
|
|
2017-05-19 22:19:20 +02:00
|
|
|
set refinstalldir=%%LOCALAPPDATA%%\wsltty
|
|
|
|
set refconfigdir=%%APPDATA%%\wsltty
|
2022-02-28 00:00:00 +01:00
|
|
|
if "%installdir%" == "" set installdir="%LOCALAPPDATA%\wsltty"
|
|
|
|
if "%configdir%" == "" set configdir="%APPDATA%\wsltty"
|
2020-04-02 14:44:32 +02:00
|
|
|
call dequote installdir
|
|
|
|
call dequote configdir
|
2020-01-20 00:00:00 +01:00
|
|
|
set oldroot="%installdir%"
|
|
|
|
set oldhomedir="%installdir%\home\%USERNAME%"
|
2020-04-02 14:44:32 +02:00
|
|
|
call dequote oldroot
|
|
|
|
call dequote oldhomedir
|
2020-01-20 00:00:00 +01:00
|
|
|
set oldconfigdir="%oldhomedir%\.config\mintty"
|
2020-04-02 14:44:32 +02:00
|
|
|
call dequote oldconfigdir
|
2024-11-23 00:00:00 +01:00
|
|
|
|
2024-11-22 00:00:00 +01:00
|
|
|
rem override installdir, configdir if parameters given
|
|
|
|
set arg1=%1
|
2024-11-23 00:00:00 +01:00
|
|
|
echo %arg1%
|
2024-11-22 00:00:00 +01:00
|
|
|
call dequote arg1
|
2024-11-23 00:00:00 +01:00
|
|
|
echo %arg1%
|
|
|
|
if "%arg1%" == "%%arg1%%" goto deploy
|
|
|
|
set refinstalldir=%arg1%
|
|
|
|
set installdir=%arg1%
|
|
|
|
set arg2=%2
|
2024-11-22 00:00:00 +01:00
|
|
|
call dequote arg2
|
2024-11-23 00:00:00 +01:00
|
|
|
if "%arg2%" == "%%arg2%%" goto deploy
|
|
|
|
set refconfigdir=%arg2%
|
|
|
|
set configdir=%arg2%
|
2016-09-16 13:58:30 +02:00
|
|
|
|
2016-10-16 21:31:56 +02:00
|
|
|
:deploy
|
2016-09-14 14:55:14 +02:00
|
|
|
|
2020-04-02 14:44:32 +02:00
|
|
|
mkdir "%installdir%" 2> nul:
|
2016-10-15 21:59:53 +02:00
|
|
|
|
2017-10-23 08:14:40 +02:00
|
|
|
rem clean up previous installation artefacts
|
|
|
|
del /Q "%installdir%\*.bat"
|
|
|
|
del /Q "%installdir%\*.lnk"
|
2017-07-28 14:14:51 +02:00
|
|
|
|
2017-10-23 08:14:40 +02:00
|
|
|
copy LICENSE.mintty "%installdir%"
|
2019-10-02 00:57:48 +02:00
|
|
|
copy LICENSE.wslbridge2 "%installdir%"
|
2017-05-19 22:19:20 +02:00
|
|
|
|
2016-11-18 00:17:56 +01:00
|
|
|
copy "add to context menu.lnk" "%installdir%"
|
2017-10-29 16:47:04 +01:00
|
|
|
copy "add default to context menu.lnk" "%installdir%"
|
2016-11-18 00:17:56 +01:00
|
|
|
copy "remove from context menu.lnk" "%installdir%"
|
2017-07-28 14:14:51 +02:00
|
|
|
copy "configure WSL shortcuts.lnk" "%installdir%"
|
2019-01-20 19:49:49 +01:00
|
|
|
rem copy "WSL Terminal.lnk" "%installdir%"
|
|
|
|
rem copy "WSL Terminal %%.lnk" "%installdir%"
|
2017-07-28 14:14:51 +02:00
|
|
|
copy config-distros.sh "%installdir%"
|
2019-08-07 00:00:00 +02:00
|
|
|
|
2019-08-07 23:48:03 +02:00
|
|
|
copy mkshortcut.vbs "%installdir%"
|
2020-04-02 14:44:32 +02:00
|
|
|
copy cmd2.bat "%installdir%"
|
|
|
|
copy dequote.bat "%installdir%"
|
2019-08-07 00:00:00 +02:00
|
|
|
|
2019-01-01 14:53:48 +01:00
|
|
|
rem allow persistent customization of default icon:
|
2019-01-20 19:49:49 +01:00
|
|
|
if not exist "%installdir%\wsl.ico" copy tux.ico "%installdir%\wsl.ico"
|
2016-09-19 00:46:51 +02:00
|
|
|
|
2019-08-07 00:00:00 +02:00
|
|
|
copy uninstall.bat "%installdir%"
|
|
|
|
|
2017-12-05 20:45:02 +01:00
|
|
|
if not exist "%installdir%\bin" goto instbin
|
|
|
|
rem move previous programs possibly in use out of the way
|
2020-04-02 14:44:32 +02:00
|
|
|
del /Q "%installdir%\bin\*.old" 2> nul:
|
2017-12-05 20:45:02 +01:00
|
|
|
ren "%installdir%\bin\cygwin1.dll" cygwin1.dll.old
|
|
|
|
ren "%installdir%\bin\cygwin-console-helper.exe" cygwin-console-helper.exe.old
|
|
|
|
ren "%installdir%\bin\mintty.exe" mintty.exe.old
|
2019-10-02 00:57:48 +02:00
|
|
|
ren "%installdir%\bin\wslbridge2.exe" wslbridge2.exe.old
|
|
|
|
ren "%installdir%\bin\wslbridge2-backend" wslbridge2-backend.old
|
2020-04-02 14:44:32 +02:00
|
|
|
del /Q "%installdir%\bin\*.old" 2> nul:
|
2017-12-05 20:45:02 +01:00
|
|
|
|
|
|
|
:instbin
|
2020-04-02 14:44:32 +02:00
|
|
|
mkdir "%installdir%\bin" 2> nul:
|
2016-10-15 21:59:53 +02:00
|
|
|
copy cygwin1.dll "%installdir%\bin"
|
|
|
|
copy cygwin-console-helper.exe "%installdir%\bin"
|
|
|
|
copy mintty.exe "%installdir%\bin"
|
2019-10-02 00:57:48 +02:00
|
|
|
copy wslbridge2.exe "%installdir%\bin"
|
|
|
|
copy wslbridge2-backend "%installdir%\bin"
|
2016-09-14 14:55:14 +02:00
|
|
|
|
2017-12-05 20:45:02 +01:00
|
|
|
copy dash.exe "%installdir%\bin"
|
|
|
|
copy regtool.exe "%installdir%\bin"
|
|
|
|
copy zoo.exe "%installdir%\bin"
|
|
|
|
|
2019-08-07 23:48:03 +02:00
|
|
|
rem copy mkshortcut.exe "%installdir%"\bin
|
|
|
|
rem copy cygpopt-0.dll "%installdir%"\bin
|
|
|
|
rem copy cygiconv-2.dll "%installdir%"\bin
|
|
|
|
rem copy cygintl-8.dll "%installdir%"\bin
|
2019-08-07 20:37:08 +02:00
|
|
|
|
2023-03-24 00:00:00 +01:00
|
|
|
rem create system config directory and copy config archive and scripts
|
2020-04-02 14:44:32 +02:00
|
|
|
mkdir "%installdir%\usr\share\mintty\lang" 2> nul:
|
2017-11-09 17:08:29 +01:00
|
|
|
copy lang.zoo "%installdir%\usr\share\mintty\lang"
|
2020-04-02 14:44:32 +02:00
|
|
|
mkdir "%installdir%\usr\share\mintty\themes" 2> nul:
|
2017-11-09 17:08:29 +01:00
|
|
|
copy themes.zoo "%installdir%\usr\share\mintty\themes"
|
2020-04-02 14:44:32 +02:00
|
|
|
mkdir "%installdir%\usr\share\mintty\sounds" 2> nul:
|
2019-05-03 05:01:28 +02:00
|
|
|
copy sounds.zoo "%installdir%\usr\share\mintty\sounds"
|
2020-04-02 14:44:32 +02:00
|
|
|
mkdir "%installdir%\usr\share\mintty\info" 2> nul:
|
2018-04-02 23:35:40 +02:00
|
|
|
copy charnames.txt "%installdir%\usr\share\mintty\info"
|
2020-04-02 14:44:32 +02:00
|
|
|
mkdir "%installdir%\usr\share\mintty\icon" 2> nul:
|
2019-01-20 19:49:49 +01:00
|
|
|
copy tux.ico "%installdir%\usr\share\mintty\icon"
|
|
|
|
copy mintty.ico "%installdir%\usr\share\mintty\icon"
|
2023-03-24 00:00:00 +01:00
|
|
|
mkdir "%installdir%\usr\share\mintty\emojis" 2> nul:
|
|
|
|
copy getemojis "%installdir%\usr\share\mintty\emojis" 2> nul:
|
|
|
|
copy getflags "%installdir%\usr\share\mintty\emojis" 2> nul:
|
2016-09-14 14:55:14 +02:00
|
|
|
|
2017-01-06 16:47:13 +01:00
|
|
|
|
2016-11-16 16:46:50 +01:00
|
|
|
rem create Start Menu Folder
|
2020-01-20 00:00:00 +01:00
|
|
|
set smf="%APPDATA%\Microsoft\Windows\Start Menu\Programs\WSLtty"
|
2020-04-02 14:44:32 +02:00
|
|
|
call dequote smf
|
|
|
|
mkdir "%smf%" 2> nul:
|
2017-10-23 08:14:40 +02:00
|
|
|
|
|
|
|
rem clean up previous installation
|
|
|
|
del /Q "%smf%\*.lnk"
|
|
|
|
|
2016-11-16 16:46:50 +01:00
|
|
|
copy "wsltty home & help.url" "%smf%"
|
2017-07-28 14:14:51 +02:00
|
|
|
copy "add to context menu.lnk" "%smf%"
|
2017-10-29 16:47:04 +01:00
|
|
|
copy "add default to context menu.lnk" "%smf%"
|
2017-07-28 14:14:51 +02:00
|
|
|
copy "remove from context menu.lnk" "%smf%"
|
|
|
|
copy "configure WSL shortcuts.lnk" "%smf%"
|
2019-01-20 19:49:49 +01:00
|
|
|
rem copy "WSL Terminal.lnk" "%smf%"
|
|
|
|
rem copy "WSL Terminal %%.lnk" "%smf%"
|
2017-07-28 14:14:51 +02:00
|
|
|
rem clean up previous installation
|
2020-04-02 14:44:32 +02:00
|
|
|
rmdir /S /Q "%smf%\context menu shortcuts" 2> nul:
|
2017-07-28 14:14:51 +02:00
|
|
|
|
2017-05-19 22:19:20 +02:00
|
|
|
rem unpack config files in system config directory
|
|
|
|
cd /D "%installdir%\usr\share\mintty\lang"
|
2017-11-09 17:08:29 +01:00
|
|
|
"%installdir%\bin\zoo" xO lang
|
|
|
|
cd /D "%installdir%\usr\share\mintty\themes"
|
|
|
|
"%installdir%\bin\zoo" xO themes
|
2019-05-03 05:01:28 +02:00
|
|
|
cd /D "%installdir%\usr\share\mintty\sounds"
|
|
|
|
"%installdir%\bin\zoo" xO sounds
|
2020-04-02 14:44:32 +02:00
|
|
|
cd /D "%installdir%"
|
2017-05-19 22:19:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
:migrate configuration
|
|
|
|
|
|
|
|
rem migrate old config resource files to new config dir
|
|
|
|
if exist "%configdir%" goto configfile
|
|
|
|
if not exist "%oldconfigdir%" goto configfile
|
|
|
|
if exist "%oldhomedir%\.minttyrc" copy "%oldhomedir%\.minttyrc" "%oldconfigdir%\config" && del "%oldhomedir%\.minttyrc"
|
|
|
|
xcopy /E /I /Y "%oldconfigdir%" "%configdir%" && rmdir /S /Q "%oldconfigdir%"
|
|
|
|
rmdir "%oldhomedir%\.config"
|
|
|
|
:configfile
|
|
|
|
if exist "%configdir%\config" goto deloldhome
|
|
|
|
if exist "%oldhomedir%\.minttyrc" copy "%oldhomedir%\.minttyrc" "%configdir%\config" && del "%oldhomedir%\.minttyrc"
|
|
|
|
:deloldhome
|
2020-04-02 14:44:32 +02:00
|
|
|
rmdir "%oldhomedir%" 2> nul:
|
|
|
|
rmdir "%oldroot%\home" 2> nul:
|
2017-05-19 22:19:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
:userconfig
|
2017-01-06 16:47:13 +01:00
|
|
|
|
2023-03-24 00:00:00 +01:00
|
|
|
rem create user config directory and subfolders, copy scripts
|
2020-04-02 14:44:32 +02:00
|
|
|
mkdir "%configdir%\lang" 2> nul:
|
|
|
|
mkdir "%configdir%\themes" 2> nul:
|
|
|
|
mkdir "%configdir%\sounds" 2> nul:
|
2023-03-24 00:00:00 +01:00
|
|
|
mkdir "%configdir%\emojis" 2> nul:
|
|
|
|
copy "%installdir%\usr\share\mintty\emojis\getemojis" "%configdir%\emojis" 2> nul:
|
|
|
|
copy "%installdir%\usr\share\mintty\emojis\getflags" "%configdir%\emojis" 2> nul:
|
2017-01-06 16:47:13 +01:00
|
|
|
|
2017-05-25 18:07:10 +02:00
|
|
|
rem create config file if it does not yet exist
|
2022-03-22 00:00:00 +01:00
|
|
|
if exist "%configdir%\config" goto appconfig
|
|
|
|
echo # To use common configuration in %%APPDATA%%\mintty, simply remove this file>"%configdir%\config"
|
|
|
|
if "%3" == "/P" echo # Do not remove this file for WSLtty Portable>>"%configdir%\config"
|
2017-05-25 18:07:10 +02:00
|
|
|
|
2020-04-02 14:44:32 +02:00
|
|
|
|
|
|
|
:appconfig
|
|
|
|
|
2022-03-22 00:00:00 +01:00
|
|
|
rem skip configuration for WSLtty Portable
|
|
|
|
if "%3" == "/P" goto end
|
|
|
|
|
2017-07-28 14:14:51 +02:00
|
|
|
rem distro-specific stuff: shortcuts and launch scripts
|
2020-03-05 00:00:00 +01:00
|
|
|
cd /D "%installdir%"
|
2020-04-02 14:44:32 +02:00
|
|
|
echo Configuring for WSL distributions
|
|
|
|
bin\dash.exe "config-distros.sh"
|
|
|
|
rem rem bin\dash.exe "config-distros.sh" -contextmenu
|
2017-07-28 14:14:51 +02:00
|
|
|
|
2017-01-06 16:47:13 +01:00
|
|
|
|
2016-09-16 13:58:30 +02:00
|
|
|
:end
|