fix: windows 11 wsl2

This commit is contained in:
Klesh Wong 2022-05-30 00:00:30 +08:00
parent a25821283c
commit 6402287cc6
3 changed files with 16 additions and 14 deletions

View File

@ -6,8 +6,8 @@ DIR=$(dirname "$(readlink -f "$0")")
log 'Setting up shell' log 'Setting up shell'
case "$UNAMEA" in case "$PM" in
*Ubuntu*) *apt*)
if ! has_cmd fish; then if ! has_cmd fish; then
sudo add-apt-repository ppa:fish-shell/release-3 -y -n sudo add-apt-repository ppa:fish-shell/release-3 -y -n
pm_update pm_update
@ -24,6 +24,9 @@ case "$UNAMEA" in
./install --all ./install --all
exitrepo exitrepo
;; ;;
esac
case "$UNAMEA" in
*artix*) *artix*)
sudo pacman -S --noconfirm --needed fish dash fzf bat the_silver_searcher sudo pacman -S --noconfirm --needed fish dash fzf bat the_silver_searcher
# prevent bash upgradation relink /bin/sh # prevent bash upgradation relink /bin/sh

View File

@ -37,10 +37,8 @@ pacman_china_mirror() {
' "$MIRRORLIST_BAK" | sudo tee "$MIRRORLIST" >/dev/null ' "$MIRRORLIST_BAK" | sudo tee "$MIRRORLIST" >/dev/null
} }
case "$PM" in
# setup package mirror for CHINA *apt*)
case "$UNAMEA" in
*Ubuntu*)
# backup original sources.list # backup original sources.list
if [ ! -f /etc/apt/sources.list.bak ]; then if [ ! -f /etc/apt/sources.list.bak ]; then
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
@ -49,6 +47,11 @@ case "$UNAMEA" in
awk '$0 ~ /^deb/ {$2="https://mirrors.aliyun.com/ubuntu/"; print}' /etc/apt/sources.list.bak \ awk '$0 ~ /^deb/ {$2="https://mirrors.aliyun.com/ubuntu/"; print}' /etc/apt/sources.list.bak \
| sudo tee /etc/apt/sources.list | sudo tee /etc/apt/sources.list
;; ;;
esac
# setup package mirror for CHINA
case "$UNAMEA" in
*artix*) *artix*)
# enable arch repo # enable arch repo
sudo pacman -S --needed --noconfirm artix-archlinux-support sudo pacman -S --needed --noconfirm artix-archlinux-support
@ -63,8 +66,8 @@ case "$UNAMEA" in
echo "[multilib]" >> sudo tee -a /etc/pacman echo "[multilib]" >> sudo tee -a /etc/pacman
echo "Include = /etc/pacman.d/mirrorlist-arch" >> sudo tee -a /etc/pacman echo "Include = /etc/pacman.d/mirrorlist-arch" >> sudo tee -a /etc/pacman
fi fi
;;
pacman_china_mirror /etc/pacman.d/mirrorlist Asia pacman_china_mirror /etc/pacman.d/mirrorlist Asia
pacman_china_mirror /etc/pacman.d/mirrorlist-arch pacman_china_mirror /etc/pacman.d/mirrorlist-arch
sudo pacman -Sy sudo pacman -Sy
;;
esac esac

View File

@ -18,7 +18,7 @@ case "$PM" in
sudo apt install -y pass sudo apt install -y pass
if [ -n "$WSL" ]; then if [ -n "$WSL" ]; then
PINENTRY=$PDIR/bin/pinentry-wsl-ps1.sh PINENTRY=$PDIR/bin/pinentry-wsl-ps1.sh
BROWSERPASS_NATIVE="$(wsl-win-path.sh %USERPROFILE%)/browser-wsl.bat" BROWSERPASS_NATIVE="$(wsl-win-path.sh %USERPROFILE%)/browserpass-wsl.bat"
echo "@echo off\r\nbash -c 'browserpass'" \ echo "@echo off\r\nbash -c 'browserpass'" \
> "$BROWSERPASS_NATIVE" > "$BROWSERPASS_NATIVE"
else else
@ -52,10 +52,6 @@ make configure
make make
sudo make install sudo make install
exitrepo exitrepo
if [ -n "$WSL" ]; then
echo "Please download browserpass-native for windows 64 and extract it to /usr/local/bin"
x-open https://github.com/browserpass/browserpass-native/releases/latest
fi
# enable browser-native for google-chrome # enable browser-native for google-chrome
#make -C /usr/lib/browserpass hosts-chrome-user #make -C /usr/lib/browserpass hosts-chrome-user
@ -79,6 +75,6 @@ fi
# configuration # configuration
if [ -n "$WSL" ]; then if [ -n "$WSL" ]; then
echo "Please update path in *-host.json file located at C:\Program Files\Browserpass to" echo 'Please update path in files "C:\Program Files\Browserpass\*-host.json" to'
echo $BROWSERPASS_NATIVE cmd.exe /c 'echo %USERPROFILE%\browserpass-wsl.bat' 2>/dev/null | sed 's/\\/\\\\/g'
fi fi