fix: wsl
This commit is contained in:
parent
e479146307
commit
454c34712d
33
bin/x-clip
Executable file
33
bin/x-clip
Executable file
|
@ -0,0 +1,33 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# xsel simulation in WSL
|
||||||
|
# usage:
|
||||||
|
# xsel -o
|
||||||
|
# xsel -i [string]
|
||||||
|
# From https://www.reddit.com/r/neovim/comments/fyj7mp/neovim_in_wsl_copy_to_windows_clipboard/fn241ig/
|
||||||
|
|
||||||
|
if command -v pwsh.exe >/dev/null 2>&1; then
|
||||||
|
pwsh="pwsh.exe"
|
||||||
|
elif command -v powershell.exe >/dev/null 2>&1; then
|
||||||
|
pwsh="powershell.exe"
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
pwsh="$pwsh -NoProfile -NoLogo -NonInteractive"
|
||||||
|
|
||||||
|
OUTPUT=
|
||||||
|
for i in "$@"
|
||||||
|
do
|
||||||
|
case "$i" in
|
||||||
|
-o|--output|-out)
|
||||||
|
OUTPUT=1
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$OUTPUT" = "1" ]; then
|
||||||
|
$pwsh -command 'Get-Clipboard'
|
||||||
|
else
|
||||||
|
clip.exe
|
||||||
|
fi
|
72
cli/fish.sh
72
cli/fish.sh
|
@ -5,41 +5,49 @@ DIR=$(dirname "$(readlink -f "$0")")
|
||||||
. "$DIR/../env.sh"
|
. "$DIR/../env.sh"
|
||||||
|
|
||||||
log 'Setting up shell'
|
log 'Setting up shell'
|
||||||
if ! has_cmd fish; then
|
|
||||||
case "$PM" in
|
case "$PM" in
|
||||||
apt)
|
apt)
|
||||||
|
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
|
||||||
sudo apt install fish silversearcher-ag -y
|
sudo apt install fish
|
||||||
echo DISTRIB_RELEASE_MAJOR: $DISTRIB_RELEASE_MAJOR
|
fi
|
||||||
echo DISTRIB_RELEASE: $DISTRIB_RELEASE
|
sudo apt install silversearcher-ag -y
|
||||||
if [ "$DISTRIB_RELEASE_MAJOR" -gt 19 ] || [ "$DISTRIB_RELEASE" = "19.10" ]; then
|
echo DISTRIB_RELEASE_MAJOR: $DISTRIB_RELEASE_MAJOR
|
||||||
sudo apt install dash bat -y
|
echo DISTRIB_RELEASE: $DISTRIB_RELEASE
|
||||||
fi
|
if [ "$DISTRIB_RELEASE_MAJOR" -gt 19 ] || [ "$DISTRIB_RELEASE" = "19.10" ]; then
|
||||||
sudo ln -sf /usr/bin/batcat /usr/bin/bat
|
sudo apt install dash bat -y
|
||||||
intorepo https://github.com/junegunn/fzf.git "$HOME/.fzf"
|
fi
|
||||||
./install --all
|
sudo ln -sf /usr/bin/batcat /usr/bin/bat
|
||||||
exitrepo
|
intorepo https://github.com/junegunn/fzf.git "$HOME/.fzf"
|
||||||
;;
|
./install --all
|
||||||
pacman)
|
exitrepo
|
||||||
sudo pacman -S --noconfirm --needed fish the_silver_searcher dash bat fzf
|
;;
|
||||||
# prevent bash upgradation relink /bin/sh
|
pacman)
|
||||||
sudo mkdir -p /etc/pacman.d/hooks
|
sudo pacman -S --noconfirm --needed fish the_silver_searcher dash bat fzf
|
||||||
echo "
|
# prevent bash upgradation relink /bin/sh
|
||||||
[Trigger]
|
sudo mkdir -p /etc/pacman.d/hooks
|
||||||
Type = Package
|
echo "
|
||||||
Operation = Install
|
[Trigger]
|
||||||
Operation = Upgrade
|
Type = Package
|
||||||
Target = bash
|
Operation = Install
|
||||||
|
Operation = Upgrade
|
||||||
|
Target = bash
|
||||||
|
|
||||||
[Action]
|
[Action]
|
||||||
Description = Re-pointing /bin/sh symlink to dash...
|
Description = Re-pointing /bin/sh symlink to dash...
|
||||||
When = PostTransaction
|
When = PostTransaction
|
||||||
Exec = /usr/bin/ln -sfT dash /usr/bin/sh
|
Exec = /usr/bin/ln -sfT dash /usr/bin/sh
|
||||||
Depends = dash
|
Depends = dash
|
||||||
" | sed 's/^ *//' | sudo tee /etc/pacman.d/sh-is-dash.hook >/dev/null
|
" | sed 's/^ *//' | sudo tee /etc/pacman.d/sh-is-dash.hook >/dev/null
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# xclip/xsel for wsl
|
||||||
|
if [ -n "$WSL" ]; then
|
||||||
|
lnsf "$PDIR/bin/x-clip" "$HOME/.local/bin/xsel"
|
||||||
|
lnsf "$PDIR/bin/x-clip" "$HOME/.local/bin/xclip"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,4 +10,4 @@ sudo timedatectl set-ntp on || true
|
||||||
. "$DIR/fish.sh"
|
. "$DIR/fish.sh"
|
||||||
. "$DIR/vim.sh"
|
. "$DIR/vim.sh"
|
||||||
. "$DIR/tmux.sh"
|
. "$DIR/tmux.sh"
|
||||||
. "$DIR/ranger.sh"
|
. "$DIR/nnn.sh"
|
||||||
|
|
28
gui/pass.sh
28
gui/pass.sh
|
@ -7,16 +7,17 @@ DIR=$(dirname "$(readlink -f "$0")")
|
||||||
if ! has_cmd go; then
|
if ! has_cmd go; then
|
||||||
"$PDIR/devel/go.sh"
|
"$PDIR/devel/go.sh"
|
||||||
fi
|
fi
|
||||||
|
GNUPG=$HOME/.gnupg
|
||||||
|
GPG_AGENT_CONF=$GNUPG/gpg-agent.conf
|
||||||
|
mkdir -p "$GNUPG"
|
||||||
|
|
||||||
# install pass
|
# install pass
|
||||||
case "$PM" in
|
case "$PM" in
|
||||||
apt)
|
apt)
|
||||||
sudo apt install -y pass
|
sudo apt install -y pass webext-browserpass
|
||||||
GNUPG=$HOME/.gnupg
|
|
||||||
GPG_AGENT_CONF=$GNUPG/gpg-agent.conf
|
|
||||||
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%)/browser-wsl.bat"
|
||||||
echo "@echo off\r\nbash -c 'browserpass'" \
|
echo "@echo off\r\nbash -c 'browserpass'" \
|
||||||
> "$BROWSERPASS_NATIVE"
|
> "$BROWSERPASS_NATIVE"
|
||||||
else
|
else
|
||||||
|
@ -24,33 +25,30 @@ case "$PM" in
|
||||||
PINENTRY=$(command -v pinentry-gtk-2)
|
PINENTRY=$(command -v pinentry-gtk-2)
|
||||||
fi
|
fi
|
||||||
SETTING="pinentry-program $PINENTRY"
|
SETTING="pinentry-program $PINENTRY"
|
||||||
mkdir -p "$GNUPG"
|
|
||||||
if ! grep -Fq "$SETTING" "$GPG_AGENT_CONF"; then
|
|
||||||
echo "$SETTING" > GPG_AGENT_CONF
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
pacman)
|
pacman)
|
||||||
sudo pacman -S --noconfirm --needed \
|
sudo pacman -S --noconfirm --needed \
|
||||||
go \
|
go \
|
||||||
browserpass
|
browserpass
|
||||||
|
# install browserpass-native
|
||||||
|
intorepo https://github.com/browserpass/browserpass-native.git "$DIR/repos/browserpass-native"
|
||||||
|
make configure
|
||||||
|
make
|
||||||
|
sudo make install
|
||||||
|
exitrepo
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# longer password caching time
|
# longer password caching time
|
||||||
cat <<EOF > ~/.gnupg/gpg-agent.conf
|
cat <<EOF > ~/.gnupg/gpg-agent.conf
|
||||||
|
$SETTING
|
||||||
default-cache-ttl 28800
|
default-cache-ttl 28800
|
||||||
max-cache-ttl 28800
|
max-cache-ttl 28800
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# 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
|
||||||
|
|
||||||
# install browserpass-native
|
|
||||||
intorepo https://github.com/browserpass/browserpass-native.git "$DIR/repos/browserpass-native"
|
|
||||||
make configure
|
|
||||||
make
|
|
||||||
sudo make install
|
|
||||||
exitrepo
|
|
||||||
|
|
||||||
# chrome extension: https://chrome.google.com/webstore/detail/browserpass/naepdomgkenhinolocfifgehidddafch
|
# chrome extension: https://chrome.google.com/webstore/detail/browserpass/naepdomgkenhinolocfifgehidddafch
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,8 @@ case "$PM" in
|
||||||
network-manager network-manager-gnome \
|
network-manager network-manager-gnome \
|
||||||
exfat-utils \
|
exfat-utils \
|
||||||
dunst \
|
dunst \
|
||||||
xclip xsel xdotool \
|
xclip xsel \
|
||||||
|
xdotool \
|
||||||
libnotify-bin \
|
libnotify-bin \
|
||||||
flameshot scrot \
|
flameshot scrot \
|
||||||
thunar gvfs-bin gvfs-backends thunar-archive-plugin file-roller tumbler
|
thunar gvfs-bin gvfs-backends thunar-archive-plugin file-roller tumbler
|
||||||
|
|
Loading…
Reference in New Issue
Block a user