diff --git a/README.md b/README.md index fa8689b..4496170 100644 --- a/README.md +++ b/README.md @@ -35,11 +35,23 @@ You may need to open the Properties of the installer first, tab “General” section “Security” (if available) and select “Unblock”, to enable the “Run anyway” button. +#### WSLtty Portable installer + +For a portable installation, e.g. on a USB stick, choose the +“-install-portable.exe” file for download. Installation will prompt +for a portable installation folder interactively. +For example, choosing `U:\opt` will create and use folder +`U:\opt\wsltty` both as installation directory and configuration directory. +Portable installation does not install any start menu or desktop shortcuts +and no context menu entries. It creates a shortcut in the selected +portable installation folder to start the default WSL distribution. + #### Installation from archive #### In case a local anti-virus guard barfs about the wsltty installer, the release also contains a `.cab` file. Download it, open it, extract its files -to some temporary deployment directory, and invoke `install.bat` from there. +to some temporary deployment directory, and invoke `install.bat` from there, +or `install-portable.bat` for a portable installation. #### Installation from source repository #### diff --git a/install-portable.bat b/install-portable.bat new file mode 100755 index 0000000..d13a91d --- /dev/null +++ b/install-portable.bat @@ -0,0 +1,27 @@ +@echo off + +set sel="Select folder to place installation of portable wsltty" + +for /f "usebackq delims=" %%f in (`powershell "(new-object -COM Shell.Application).BrowseForFolder(0, '%sel%', 0, 0).self.path"`) do set f=%%f +set instdir=%f%\wsltty + +if "%f%"=="" ( + echo no installation + exit +) else if not exist "%f%" ( + echo invalid installation folder %instdir% + exit +) + +call install "%instdir%" "%instdir%" /P + +rem create shortcut +cd /D "%instdir%" +set instpath=%instdir:~2% +set target=%%COMSPEC%% +set minttyargs=/C bin\mintty.exe --WSL= --icon=/wsl.ico --configdir=. -~ +set bridgeargs= - +set wdir=%instpath% +set icon=%instpath%\wsl.ico +cscript /nologo mkshortcut.vbs "/name:WSL Terminal Portable" + diff --git a/install.bat b/install.bat index 7120bb5..d8e8c69 100755 --- a/install.bat +++ b/install.bat @@ -137,11 +137,16 @@ mkdir "%configdir%\themes" 2> nul: mkdir "%configdir%\sounds" 2> nul: rem create config file if it does not yet exist -if not exist "%configdir%\config" echo # To use common configuration in %%APPDATA%%\mintty, simply remove this file>"%configdir%\config" +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" :appconfig +rem skip configuration for WSLtty Portable +if "%3" == "/P" goto end + rem distro-specific stuff: shortcuts and launch scripts cd /D "%installdir%" echo Configuring for WSL distributions diff --git a/makefile b/makefile index 637afbb..9b495af 100644 --- a/makefile +++ b/makefile @@ -279,7 +279,7 @@ cop: copcab mkdir -p rel cp -fl $(CAB)/* rel/ -installer: cop cab normal-installer silent-installer +installer: cop cab normal-installer silent-installer portable-installer cab: # build cab archive @@ -299,6 +299,16 @@ silent-installer: # build installer cd rel; iexpress /n wsltty-quiet.SED +InstallPrompt=Install Mintty terminal for WSL Portable? +FinishMessage=Mintty for WSL Portable installation finished + +portable-installer: + # prepare build of installer + rm -f rel/$(CAB)-install-portable.exe + cd rel; sed -e "/InstallPrompt/ s/=.*/=$(InstallPrompt)/" -e "/FinishMessage/ s/=.*/=$(FinishMessage)/" -e "/AppLaunched/ s/install/install-portable/" -e "/TargetName/ s/install.exe/install-portable.exe/" wsltty.SED > wsltty-portable.SED + # build installer + cd rel; iexpress /n wsltty-portable.SED + install: cop installbat installbat: diff --git a/makewinx.cfg b/makewinx.cfg index 6454e88..f62cd1c 100644 --- a/makewinx.cfg +++ b/makewinx.cfg @@ -60,6 +60,7 @@ FILE24="mintty.ico" FILE25="mkshortcut.vbs" FILE26="dequote.bat" FILE27="cmd2.bat" +FILE28="install-portable.bat" [SourceFiles] SourceFiles0=. @@ -93,4 +94,5 @@ SourceFiles0=. %FILE25%= %FILE26%= %FILE27%= +%FILE28%=