From ae637e4645537fda3d12abdea27f4664f7cae506 Mon Sep 17 00:00:00 2001 From: Thomas Wolff Date: Wed, 16 Nov 2016 16:46:50 +0100 Subject: [PATCH] updates for release 0.7.0 --- LICENSE.wslbridge | 42 ++++++------- README.md | 39 +++++++----- ... in Mintty.lnk => WSL Bash % in Mintty.lnk | Bin 1903 -> 1889 bytes ...in Mintty.lnk => WSL Bash -l in Mintty.lnk | Bin WSL Bash ~ in Mintty.lnk | Bin 0 -> 1897 bytes add to context menu.bat | 39 ++++++++++++ install.bat | 59 +++++------------- makefile | 12 ++-- makewinx.cfg | 22 +++++-- remove from context menu.bat | 12 ++++ uninstall.bat | 39 ++++++------ wsl-l.bat | 12 ++++ wsl.bat | 2 +- wsltty home & help.url | 2 + wsl~.bat | 2 +- 15 files changed, 167 insertions(+), 115 deletions(-) rename Bash ~ on UoW in Mintty.lnk => WSL Bash % in Mintty.lnk (67%) rename Bash on UoW in Mintty.lnk => WSL Bash -l in Mintty.lnk (100%) create mode 100755 WSL Bash ~ in Mintty.lnk create mode 100644 add to context menu.bat create mode 100644 remove from context menu.bat create mode 100755 wsl-l.bat create mode 100644 wsltty home & help.url diff --git a/LICENSE.wslbridge b/LICENSE.wslbridge index 3079562..2b27652 100644 --- a/LICENSE.wslbridge +++ b/LICENSE.wslbridge @@ -1,21 +1,21 @@ -The MIT License (MIT) - -Copyright (c) 2016 Ryan Prichard - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -IN THE SOFTWARE. +The MIT License (MIT) + +Copyright (c) 2016 Ryan Prichard + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/README.md b/README.md index 75cad68..fc5d7bb 100644 --- a/README.md +++ b/README.md @@ -3,31 +3,36 @@ Mintty as a terminal for Bash on Ubuntu on Windows / WSL. ### Overview ### Run the [installer](https://github.com/mintty/wsltty/releases) to install -* wsltty package components (see below) in the user’s application directory (where WSL is also installed) +* wsltty package components (see below) in the user’s application folder (where WSL is also installed) * an empty wsltty “home directory” to enable storage of a mintty config file -* a Desktop Shortcut and a Start Menu Shortcut to start WSL with a login bash in the *Windows user profile* directory; to start in the Linux home directory instead, add a `cd` command to your Linux `$HOME/.profile` script -* context menu entries for Windows Explorer to start WSL with a bash in the respective directory -* a script `wsl.bat` to invoke wsltty manually; copy the script from `%LOCALAPPDATA%\wsltty` to `%SYSTEMROOT%\System32` if desired +* Start Menu and Desktop shortcuts to start a WSL bash (with some variations, see below) +* optional context menu entries for Windows Explorer to start a WSL bash in the respective folder, installable from the Start Menu subfolder +* `wsl*.bat` scripts to invoke wsltty manually (with some variations and invocation options, see below) * an uninstall script that can be invoked manually to remove shortcuts and context menu entries ### Configuration ### -#### Command line scripts wsl.bat and wsl~.bat #### +#### Command line scripts wsl*.bat #### -* To enable invocation of this script from WIN+R or from cmd.exe, - copy it from `%LOCALAPPDATA%\wsltty` into `%SYSTEMROOT%\System32`. - (The package does not do this to avoid trouble with missing admin privileges.) -* To start the terminal in the current directory when calling the script from the command line, - modify it (or a copy for this purpose) and remove the final `-l` parameter. -* To enforce starting in your Linux home directory, do *either* of: - * On Linux side, add a `cd` command to your `$HOME/.profile`. - * Use `wsl~.bat` instead of `wsl.bat` (or rename it as desired). +WSLtty installs the following scripts in its application folder `%LOCALAPPDATA%\wsltty`: +* `wsl.bat` to start a WSL bash in the current folder/directory +* `wsl~.bat` to start a WSL bash in the WSL user home +* `wsl-l.bat` to start a WSL login bash -#### Desktop shortcut and Start menu shortcut #### +To enable invocation of these scripts from WIN+R or from cmd.exe, +copy them from `%LOCALAPPDATA%\wsltty` into `%SYSTEMROOT%\System32`, +renaming them as desired. +(The package does not do this to avoid trouble with missing admin privileges.) -To enforce starting in your Linux home directory, do *either* of: -* On Linux side, add a `cd` command to your `$HOME/.profile`. -* Use the shortcut `Bash ~ on UoW in Mintty` instead. +#### Start Menu and Desktop shortcuts #### + +The Start Menu subfolder WSLtty offers three shortcuts: +* `WSL Bash % in Mintty` to start a WSL bash in the Windows %USERPROFILE% home +* `WSL Bash ~ in Mintty` to start a WSL bash in the WSL user home +* `WSL Bash -l in Mintty` to start a WSL login bash + +To ensure a login bash to start in your Linux home directory, +add a `cd` command to your `$HOME/.profile` on Linux side. #### Mintty settings #### diff --git a/Bash ~ on UoW in Mintty.lnk b/WSL Bash % in Mintty.lnk similarity index 67% rename from Bash ~ on UoW in Mintty.lnk rename to WSL Bash % in Mintty.lnk index 97bf13cc153d377c203c6a3675ae0641cf1382d7..4a1c3d7493dfebee4155f517a34e92ad8e58a780 100755 GIT binary patch delta 46 zcmaFQ_mFSHT_#4m$@iGj#Y-3z81xyE7&001z;q%*F+&D}%;a?}@|!!EpD_afN^cDv delta 38 ucmaFJ_nvRVT_#4?$@iGjnVlKxCOa@ovnw#@GUPDGOkThuzqy+E88ZO*^9!8- diff --git a/Bash on UoW in Mintty.lnk b/WSL Bash -l in Mintty.lnk similarity index 100% rename from Bash on UoW in Mintty.lnk rename to WSL Bash -l in Mintty.lnk diff --git a/WSL Bash ~ in Mintty.lnk b/WSL Bash ~ in Mintty.lnk new file mode 100755 index 0000000000000000000000000000000000000000..23ddad7467703d114e202a14aa4e1c28ffad151a GIT binary patch literal 1897 zcmd^I1q%{OsdONY*h8*D-!B2lae z!zc`b1d%YJOM{ZIK)NX}v~Ic)y6EFZA@BPBpMA&_t9yG6&vVXu-sk+zbDrnCuLMA$ zPNM~8Vix8VK596wHJo@{sG3&{?r}{FXU!`R{Z?`+ll@&~%u^BfU$v^V8tgUI=cl*! zAH8pi&Nkip*}Z?M2nrNo`B^soS|jfukuW|u72ZyAvR7jWAr!!9c9?Tf86)bf4<>V< z@9Q(ULN3mP@>|<)FD_WFckVtoy;S^U_Vw4rd!5btX#MQV?wP5J$B+pn_t9C^lVWW- z*C=lY)D~e0^jZ2Y>hE=AyEgNoMFRIt@ z%xxmVAD;w9C(Jr=!-rnZ<)8xxAnK^I>ZdgD`+6B&xi{hk%qheY>!A@rtokfKg~F^8 ze~cK9upC}Qs6alolUhI(w?y<+R3T@ndDL`jYgDyW+>1~k9PkHyFxJRTL2rLh787!! z_HwKiay)}F4=tyLyA4`2!GSt7vV@JW@c>qqqK@+hl(EH=sNpC8O-hlxsD+U;@p&V< zSh{{D+{<*=lIbL=j0x7D0`bIEBv@|x`EZ6u^v2d3aUs@+*7&-~3zAyENF>H(eabgvMIf z3rYTF;!nVk%{Q8He&5OQFORyy1D=U1FCJb~L_X}i)2x~wF>G1**ZX3EGRYS)R66XA Y_g7oY(^9qZ>GxeXi$?u($$dos8xH6Nk^lez literal 0 HcmV?d00001 diff --git a/add to context menu.bat b/add to context menu.bat new file mode 100644 index 0000000..dc6ef8f --- /dev/null +++ b/add to context menu.bat @@ -0,0 +1,39 @@ +@echo off + +rem See comments in install.bat about changing the installation directory. + +set installdir=%LOCALAPPDATA%\wsltty + +rem Explorer context menu +set userdirname=HKEY_CURRENT_USER\Software\Classes\Directory\shell +set userdirpane=HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell + +rem WSL in Mintty +set label=WSL in Mintty +rem set here=in this directory +set here=Here + +rem WSL icon +set icon=%LOCALAPPDATA%\lxss\bash.ico + +rem WSL target shell +set shell=/bin/bash + +rem Mintty invocation +set cmd=%installdir%\bin\mintty.exe +set cset=-o Locale=C -o Charset=UTF-8 +set opts=--wsl +set arg=/bin/wslbridge -t %shell% +set target0=\"%cmd%\" %opts% %cset% -i \"%icon%\" %arg% +rem set target1=\"%cmd%\" %opts% %cset% -i \"%icon%\" /bin/dash -c \"cd '%%1'; exec %arg%\" +set target1=\"%cmd%\" %opts% %cset% -i \"%icon%\" --dir \"%%1\" %arg% + +rem Registry entries +reg add "%userdirname%\wsltty" /d "%label% %here%" /f +reg add "%userdirname%\wsltty" /v Icon /d "%icon%" /f +reg add "%userdirname%\wsltty\command" /d "%target1%" /f +reg add "%userdirpane%\wsltty" /d "%label% %here%" /f +reg add "%userdirpane%\wsltty" /v Icon /d "%icon%" /f +reg add "%userdirpane%\wsltty\command" /d "%target0%" /f + +:end diff --git a/install.bat b/install.bat index 248d831..e4be2f9 100755 --- a/install.bat +++ b/install.bat @@ -1,9 +1,10 @@ -rem @echo off +@echo off rem If you change the installation directory, rem it also needs to be adapted in rem - the Shortcut links *.lnk rem - the cmd invocation scripts wsl*.bat + set installdir=%LOCALAPPDATA%\wsltty @@ -16,9 +17,13 @@ copy uninstall.bat "%installdir%" copy wsl.bat "%installdir%" copy wsl~.bat "%installdir%" +copy wsl-l.bat "%installdir%" +copy "add to context menu.bat" "%installdir%" +copy "remove from context menu.bat" "%installdir%" rem does not work without admin rights: rem copy wsl.bat "%SYSTEMROOT%\System32" rem copy wsl~.bat "%SYSTEMROOT%\System32" +rem copy wsl-l.bat "%SYSTEMROOT%\System32" mkdir "%installdir%\bin" copy cygwin1.dll "%installdir%\bin" @@ -35,48 +40,18 @@ mkdir "%installdir%\home\%USERNAME%" :shortcuts -rem create Desktop Shorcut -copy "Bash on UoW in Mintty.lnk" "%USERPROFILE%\Desktop" -copy "Bash ~ on UoW in Mintty.lnk" "%USERPROFILE%\Desktop" +rem create Start Menu Folder +set smf=%APPDATA%\Microsoft\Windows\Start Menu\Programs\WSLtty +mkdir "%smf%" +copy "wsltty home & help.url" "%smf%" +copy "WSL Bash % in Mintty.lnk" "%smf%" +copy "WSL Bash ~ in Mintty.lnk" "%smf%" +copy "WSL Bash -l in Mintty.lnk" "%smf%" +mkdir "%smf%\context menu shortcuts" -rem create Start Menu Shortcut -copy "Bash on UoW in Mintty.lnk" "%APPDATA%\Microsoft\Windows\Start Menu" -copy "Bash ~ on UoW in Mintty.lnk" "%APPDATA%\Microsoft\Windows\Start Menu" - - -:explorer - -rem Explorer context menu -set userdirname=HKEY_CURRENT_USER\Software\Classes\Directory\shell -set userdirpane=HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell - -rem WSL in Mintty -set label=WSL in Mintty -rem set here=in this directory -set here=Here - -rem WSL icon -set icon=%LOCALAPPDATA%\lxss\bash.ico - -rem WSL target shell -set shell=/bin/bash - -rem Mintty invocation -set cmd=%installdir%\bin\mintty.exe -set cset=-o Locale=C -o Charset=UTF-8 -set opts=--wsl -set arg=/bin/wslbridge -t %shell% -set target0=\"%cmd%\" %opts% %cset% -i \"%icon%\" %arg% -rem set target1=\"%cmd%\" %opts% %cset% -i \"%icon%\" /bin/dash -c \"cd '%%1'; exec %arg%\" -set target1=\"%cmd%\" %opts% %cset% -i \"%icon%\" --dir \"%%1\" %arg% - -rem Registry entries -reg add "%userdirname%\wsltty" /d "%label% %here%" /f -reg add "%userdirname%\wsltty" /v Icon /d "%icon%" /f -reg add "%userdirname%\wsltty\command" /d "%target1%" /f -reg add "%userdirpane%\wsltty" /d "%label% %here%" /f -reg add "%userdirpane%\wsltty" /v Icon /d "%icon%" /f -reg add "%userdirpane%\wsltty\command" /d "%target0%" /f +rem create Desktop Shorcuts +copy "WSL Bash % in Mintty.lnk" "%USERPROFILE%\Desktop" +copy "WSL Bash ~ in Mintty.lnk" "%USERPROFILE%\Desktop" :end diff --git a/makefile b/makefile index b36eabd..5b13b00 100644 --- a/makefile +++ b/makefile @@ -97,14 +97,10 @@ pkg: wslbridge mintty cygwin wsltty cp bin/mintty.exe rel/ cp bin/wslbridge.exe rel/ cp bin/wslbridge-backend rel/ - cp LICENSE.mintty rel/ - cp LICENSE.wslbridge rel/ - cp "Bash on UoW in Mintty.lnk" rel/ - cp "Bash ~ on UoW in Mintty.lnk" rel/ - cp wsl.bat rel/ - cp wsl~.bat rel/ - cp install.bat rel/ - cp uninstall.bat rel/ + cp LICENSE.* rel/ + cp *.lnk rel/ + cp *.url rel/ + cp *.bat rel/ cd rel; iexpress /n wsltty.SED ############################################################################# diff --git a/makewinx.cfg b/makewinx.cfg index c57904c..759d716 100644 --- a/makewinx.cfg +++ b/makewinx.cfg @@ -39,12 +39,17 @@ FILE3="wslbridge.exe" FILE4="wslbridge-backend" FILE5="LICENSE.mintty" FILE6="LICENSE.wslbridge" -FILE7="Bash on UoW in Mintty.lnk" -FILE8="Bash ~ on UoW in Mintty.lnk" -FILE9="wsl.bat" -FILE10="wsl~.bat" -FILE11="install.bat" -FILE12="uninstall.bat" +FILE7="WSL Bash % in Mintty.lnk" +FILE8="WSL Bash ~ in Mintty.lnk" +FILE9="WSL Bash -l in Mintty.lnk" +FILE10="wsl.bat" +FILE11="wsl~.bat" +FILE12="wsl-l.bat" +FILE13="install.bat" +FILE14="uninstall.bat" +FILE15="add to context menu.bat" +FILE16="remove from context menu.bat" +FILE17="wsltty home & help.url" [SourceFiles] SourceFiles0=. @@ -63,4 +68,9 @@ SourceFiles0=. %FILE10%= %FILE11%= %FILE12%= +%FILE13%= +%FILE14%= +%FILE15%= +%FILE16%= +%FILE17%= diff --git a/remove from context menu.bat b/remove from context menu.bat new file mode 100644 index 0000000..e939697 --- /dev/null +++ b/remove from context menu.bat @@ -0,0 +1,12 @@ +@echo off + +:explorer context menu + +rem delete Explorer context menu +set userdirname=HKEY_CURRENT_USER\Software\Classes\Directory\shell +set userdirpane=HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell + +reg delete "%userdirname%\wsltty" /f +reg delete "%userdirpane%\wsltty" /f + +:end diff --git a/uninstall.bat b/uninstall.bat index 8540565..96e5bea 100755 --- a/uninstall.bat +++ b/uninstall.bat @@ -1,5 +1,25 @@ @echo off +rem See comments in install.bat about changing the installation directory. + +set installdir=%LOCALAPPDATA%\wsltty + + +:shortcuts + +rem delete Start Menu Folder +set smf=%APPDATA%\Microsoft\Windows\Start Menu\Programs\WSLtty +rmdir /S /Q "%smf%" + +rem delete Desktop Shortcuts +del "%USERPROFILE%\Desktop\WSL Bash % in Mintty.lnk" +del "%USERPROFILE%\Desktop\WSL Bash ~ in Mintty.lnk" + + +:explorer context menu + +call "%installdir%\remove from context menu.bat" + :undeploy @@ -7,23 +27,4 @@ rem currently not removing software rem in any case, at least the config file (home\...) should not be removed -:shortcuts - -rem delete Desktop Shortcut and Start Menu Shortcut -del "%USERPROFILE%\Desktop\Bash on UoW in Mintty.lnk" -del "%USERPROFILE%\Desktop\Bash ~ on UoW in Mintty.lnk" -del "%APPDATA%\Microsoft\Windows\Start Menu\Bash on UoW in Mintty.lnk" -del "%APPDATA%\Microsoft\Windows\Start Menu\Bash ~ on UoW in Mintty.lnk" - - -:explorer - -rem delete Explorer context menu -set userdirname=HKEY_CURRENT_USER\Software\Classes\Directory\shell -set userdirpane=HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell - -reg delete "%userdirname%\wsltty" /f -reg delete "%userdirpane%\wsltty" /f - - :end diff --git a/wsl-l.bat b/wsl-l.bat new file mode 100755 index 0000000..a284789 --- /dev/null +++ b/wsl-l.bat @@ -0,0 +1,12 @@ +@echo off + +rem Start mintty terminal for WSL in home directory + +rem To enable invocation of this script from WIN+R or from cmd.exe, +rem you may want to copy this script into "%SYSTEMROOT%\System32" + +rem You may want a variant of this script without trailing "-l" +rem to start in the current directory from cmd.exe + +"%LOCALAPPDATA%\wsltty\bin\mintty.exe" --wsl -o Locale=C -o Charset=UTF-8 -i "%LOCALAPPDATA%\lxss\bash.ico" /bin/wslbridge -t /bin/bash -l + diff --git a/wsl.bat b/wsl.bat index a284789..27415bb 100755 --- a/wsl.bat +++ b/wsl.bat @@ -8,5 +8,5 @@ rem you may want to copy this script into "%SYSTEMROOT%\System32" rem You may want a variant of this script without trailing "-l" rem to start in the current directory from cmd.exe -"%LOCALAPPDATA%\wsltty\bin\mintty.exe" --wsl -o Locale=C -o Charset=UTF-8 -i "%LOCALAPPDATA%\lxss\bash.ico" /bin/wslbridge -t /bin/bash -l +"%LOCALAPPDATA%\wsltty\bin\mintty.exe" --wsl -o Locale=C -o Charset=UTF-8 -i "%LOCALAPPDATA%\lxss\bash.ico" /bin/wslbridge -t /bin/bash diff --git a/wsltty home & help.url b/wsltty home & help.url new file mode 100644 index 0000000..264d446 --- /dev/null +++ b/wsltty home & help.url @@ -0,0 +1,2 @@ +[InternetShortcut] +URL=https://github.com/mintty/wsltty \ No newline at end of file diff --git a/wsl~.bat b/wsl~.bat index 29c562e..878027b 100755 --- a/wsl~.bat +++ b/wsl~.bat @@ -8,5 +8,5 @@ rem you may want to copy this script into "%SYSTEMROOT%\System32" rem You may want a variant of this script without trailing "-l" rem to start in the current directory from cmd.exe -"%LOCALAPPDATA%\wsltty\bin\mintty.exe" --wsl -o Locale=C -o Charset=UTF-8 -i "%LOCALAPPDATA%\lxss\bash.ico" /bin/wslbridge -C~ -t /bin/bash -l +"%LOCALAPPDATA%\wsltty\bin\mintty.exe" --wsl -o Locale=C -o Charset=UTF-8 -i "%LOCALAPPDATA%\lxss\bash.ico" /bin/wslbridge -C~ -t /bin/bash