mirror of
https://github.com/mintty/wsltty.git
synced 2025-01-31 10:11:02 +00:00
consider custom $installdir (#180);
introduce mkshortcut.exe, preparing to drop mkshortcut.vbs (incomplete), under the assumption that this may cause false virus alerts (#181, #182)
This commit is contained in:
parent
5136d7e878
commit
0a38ed1126
@ -1,6 +1,19 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
|
# set some paths; capital variables are for the mkshortcut.exe case,
|
||||||
|
# not for the (deprecated) mkshortcut.vbs case
|
||||||
|
|
||||||
|
INSTDIR=${installdir:-$LOCALAPPDATA/wsltty}
|
||||||
|
INSTDIR=`cd "$INSTDIR"; pwd`
|
||||||
installdir=${installdir:-'%LOCALAPPDATA%\wsltty'}
|
installdir=${installdir:-'%LOCALAPPDATA%\wsltty'}
|
||||||
|
|
||||||
|
target="$installdir"'\bin\mintty.exe'
|
||||||
|
case "$INSTDIR" in
|
||||||
|
*/) TARGETPATH="$INSTDIR"bin/mintty.exe;;
|
||||||
|
*) TARGETPATH="$INSTDIR"/bin/mintty.exe;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CONFDIR=${configdir:-$APPDATA/wsltty}
|
||||||
configdir=${configdir:-'%APPDATA%\wsltty'}
|
configdir=${configdir:-'%APPDATA%\wsltty'}
|
||||||
|
|
||||||
PATH=/bin:"$PATH":$SYSTEMROOT/System32
|
PATH=/bin:"$PATH":$SYSTEMROOT/System32
|
||||||
@ -163,8 +176,9 @@ config () {
|
|||||||
root="$basepath"
|
root="$basepath"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
minttyargs='--wsl --rootfs="'"$root"'" --configdir="'"$configdir"'" -o Locale=C -o Charset=UTF-8 /bin/wslbridge '
|
#minttyargs='--wsl --rootfs="'"$root"'" --configdir="'"$configdir"'" -o Locale=C -o Charset=UTF-8 /bin/wslbridge '
|
||||||
minttyargs='--WSL="'"$distro"'" --configdir="'"$configdir"'"'
|
minttyargs='--WSL="'"$distro"'" --configdir="'"$configdir"'"'
|
||||||
|
MINTARGS='--WSL="'"$distro"'" --configdir="'"$CONFDIR"'"'
|
||||||
#if [ -z "$launch" ]
|
#if [ -z "$launch" ]
|
||||||
#then bridgeargs='-t /bin/bash'
|
#then bridgeargs='-t /bin/bash'
|
||||||
#else bridgeargs='-l "'"$launch"'" -t /bin/bash'
|
#else bridgeargs='-l "'"$launch"'" -t /bin/bash'
|
||||||
@ -178,6 +192,7 @@ config () {
|
|||||||
name=WSL
|
name=WSL
|
||||||
icon="$installdir"'\wsl.ico'
|
icon="$installdir"'\wsl.ico'
|
||||||
minttyargs='--WSL= --configdir="'"$configdir"'"'
|
minttyargs='--WSL= --configdir="'"$configdir"'"'
|
||||||
|
MINTARGS='--WSL= --configdir="'"$CONFDIR"'"'
|
||||||
bridgeargs='-t'
|
bridgeargs='-t'
|
||||||
|
|
||||||
ok=true;;
|
ok=true;;
|
||||||
@ -188,14 +203,14 @@ config () {
|
|||||||
echoc "- (launcher $launcher)"
|
echoc "- (launcher $launcher)"
|
||||||
echoc "- icon $icon"
|
echoc "- icon $icon"
|
||||||
echoc "- root $root"
|
echoc "- root $root"
|
||||||
target="$installdir"'\bin\mintty.exe'
|
|
||||||
bridgeargs=" " # deprecated
|
bridgeargs=" " # deprecated
|
||||||
|
|
||||||
if $ok && [ -n "$distro" ]
|
if $ok && [ -n "$distro" ]
|
||||||
then # fix #163: backend missing +x with certain mount options
|
then # fix #163: backend missing +x with certain mount options
|
||||||
echo Setting +x wslbridge-backend for distro "'$distro'"
|
echo Setting +x wslbridge-backend for distro "'$distro'"
|
||||||
(cd "$LOCALAPPDATA/wsltty/bin"; wsl.exe -d "$distro" chmod +x wslbridge-backend)
|
(cd "$INSTDIR"; cd bin; wsl.exe -d "$distro" chmod +x wslbridge-backend)
|
||||||
# (cd "$LOCALAPPDATA/wsltty/bin"; "$SYSTEMROOT/System32/bash.exe" "$guid" -c chmod +x wslbridge-backend)
|
# (cd "$LOCALAPPDATA/wsltty/bin"; wsl.exe -d "$distro" chmod +x wslbridge-backend)
|
||||||
|
# (cd ... ; "$SYSTEMROOT/System32/bash.exe" "$guid" -c chmod +x wslbridge-backend)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if $ok && $config
|
if $ok && $config
|
||||||
@ -229,7 +244,8 @@ config () {
|
|||||||
cmd /C del "%LOCALAPPDATA%\\Microsoft\\WindowsApps\\$name~.bat"
|
cmd /C del "%LOCALAPPDATA%\\Microsoft\\WindowsApps\\$name~.bat"
|
||||||
else
|
else
|
||||||
# desktop shortcut in %USERPROFILE% -> Start Menu - WSLtty
|
# desktop shortcut in %USERPROFILE% -> Start Menu - WSLtty
|
||||||
cscript /nologo mkshortcut.vbs "/name:$name Terminal %"
|
##cscript /nologo mkshortcut.vbs "/name:$name Terminal %"
|
||||||
|
mkshortcut.exe -n "$name Terminal %" -i "$icon" "$TARGETPATH" -a "$MINTARGS" -d "" -w %USERPROFILE%
|
||||||
cmd /C copy "$name Terminal %.lnk" "%APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\WSLtty"
|
cmd /C copy "$name Terminal %.lnk" "%APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\WSLtty"
|
||||||
|
|
||||||
# launch script in . -> WSLtty home, WindowsApps launch folder
|
# launch script in . -> WSLtty home, WindowsApps launch folder
|
||||||
@ -240,9 +256,11 @@ config () {
|
|||||||
# prepare versions to target WSL home directory
|
# prepare versions to target WSL home directory
|
||||||
#bridgeargs="-C~ $bridgeargs"
|
#bridgeargs="-C~ $bridgeargs"
|
||||||
minttyargs="$minttyargs -~"
|
minttyargs="$minttyargs -~"
|
||||||
|
MINTARGS="$MINTARGS -~"
|
||||||
|
|
||||||
# desktop shortcut in ~ -> Start Menu
|
# desktop shortcut in ~ -> Start Menu
|
||||||
cscript /nologo mkshortcut.vbs "/name:$name Terminal"
|
##cscript /nologo mkshortcut.vbs "/name:$name Terminal"
|
||||||
|
mkshortcut.exe -n "$name Terminal" -i "$icon" "$TARGETPATH" -a "$MINTARGS" -d "" -w %USERPROFILE%
|
||||||
cmd /C copy "$name Terminal.lnk" "%APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs"
|
cmd /C copy "$name Terminal.lnk" "%APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs"
|
||||||
|
|
||||||
# default desktop shortcut in ~ -> Desktop
|
# default desktop shortcut in ~ -> Desktop
|
||||||
|
Loading…
x
Reference in New Issue
Block a user