|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
#!/bin/bash
|
|
|
|
|
cd "$(dirname "$(readlink -e "$0")")"
|
|
|
|
|
cd "$(dirname "$(readlink --canonicalize "$0")")"
|
|
|
|
|
root_win="$(wslpath -w .)"
|
|
|
|
|
root_win_slash="$(wslpath -m .)"
|
|
|
|
|
while :; do
|
|
|
|
@ -16,52 +16,52 @@ while :; do
|
|
|
|
|
--notags --default-item "$action" 3>&2 2>&1 1>&3-)"
|
|
|
|
|
case "$action" in
|
|
|
|
|
wsl-resolvconf)
|
|
|
|
|
wsl.exe -d $WSL_DISTRO_NAME -u $(id -un 0) -- rm /etc/resolv.conf
|
|
|
|
|
wsl.exe -d $WSL_DISTRO_NAME -u $(id -un 0) -- echo $'nameserver 1.1.1.1\nnameserver 1.0.0.1' \> /etc/resolv.conf
|
|
|
|
|
wsl.exe --distribution $WSL_DISTRO_NAME --user $(id --name --user 0) -- rm /etc/resolv.conf
|
|
|
|
|
wsl.exe --distribution $WSL_DISTRO_NAME --user $(id --name --user 0) -- echo $'nameserver 1.1.1.1\nnameserver 1.0.0.1' \> /etc/resolv.conf
|
|
|
|
|
;;
|
|
|
|
|
wsl-hosts)
|
|
|
|
|
wsl.exe -d $WSL_DISTRO_NAME -u $(id -un 0) -- ln -frs "$(wslpath "$(wslvar WINDIR)")"/System32/drivers/etc/hosts /etc/hosts
|
|
|
|
|
wsl.exe --distribution $WSL_DISTRO_NAME --user $(id --name --user 0) -- ln --force --relative --symbolic "$(wslpath "$(wslvar WINDIR)")"/System32/drivers/etc/hosts /etc/hosts
|
|
|
|
|
;;
|
|
|
|
|
wsl-elevate)
|
|
|
|
|
wsl.exe -d $WSL_DISTRO_NAME -u $(id -un 0) -- ln -frs wsl/wsl-elevate /usr/local/bin/wsl-elevate
|
|
|
|
|
wsl.exe --distribution $WSL_DISTRO_NAME --user $(id --name --user 0) -- ln --force --relative --symbolic wsl/wsl-elevate /usr/local/bin/wsl-elevate
|
|
|
|
|
;;
|
|
|
|
|
wsl-scripts)
|
|
|
|
|
bash/scripts/2path.sh wsl/scripts
|
|
|
|
|
;;
|
|
|
|
|
wsl-win)
|
|
|
|
|
rm -rf ~/win &&
|
|
|
|
|
ln -rs "$(wslpath "$(wslvar USERPROFILE)")" ~/win
|
|
|
|
|
rm --force --recursive ~/win &&
|
|
|
|
|
ln --relative --symbolic "$(wslpath "$(wslvar USERPROFILE)")" ~/win
|
|
|
|
|
;;
|
|
|
|
|
wsl-wsltty)
|
|
|
|
|
(cmd.exe /c rmdir /s /q "%APPDATA%\wsltty" 2\> nul; cmd.exe /c mklink /d "%APPDATA%\wsltty" "$root_win\wsl\wsltty")
|
|
|
|
|
;;
|
|
|
|
|
bash-profile)
|
|
|
|
|
ln -frs bash/.profile ~/.profile
|
|
|
|
|
ln --force --relative --symbolic bash/.profile ~/.profile
|
|
|
|
|
;;
|
|
|
|
|
bash-scripts)
|
|
|
|
|
bash/scripts/2path.sh bash/scripts
|
|
|
|
|
;;
|
|
|
|
|
ssh)
|
|
|
|
|
rm -rf ~/.ssh &&
|
|
|
|
|
ln -rs ssh/config ~/.ssh &&
|
|
|
|
|
rm --force --recursive ~/.ssh &&
|
|
|
|
|
ln --relative --symbolic ssh/config ~/.ssh &&
|
|
|
|
|
chmod 600 ~/.ssh/*
|
|
|
|
|
;;
|
|
|
|
|
ssh-win)
|
|
|
|
|
(cmd.exe /c rmdir /s /q "%USERPROFILE%\.ssh" 2\> nul; cmd.exe /c mklink /d "%USERPROFILE%\.ssh" "$root_win\ssh\config")
|
|
|
|
|
;;
|
|
|
|
|
git)
|
|
|
|
|
ln -frs git/.gitconfig ~/.gitconfig
|
|
|
|
|
ln --force --relative --symbolic git/.gitconfig ~/.gitconfig
|
|
|
|
|
;;
|
|
|
|
|
git-win)
|
|
|
|
|
(cmd.exe /c del "%USERPROFILE%\.gitconfig" 2\> nul; cmd.exe /c mklink "%USERPROFILE%\.gitconfig" "$root_win\git\.gitconfig")
|
|
|
|
|
;;
|
|
|
|
|
git-delta)
|
|
|
|
|
mkdir -p ~/.bin &&
|
|
|
|
|
wget https://github.com"$(curl -s https://github.com/dandavison/delta/releases | grep -m1 -o '[^\"]*x86_64-unknown-linux-gnu[^\"]*')" -O- | tar xzO --strip-components=1 --no-anchored delta > ~/.bin/git-delta &&
|
|
|
|
|
mkdir --parents ~/.bin &&
|
|
|
|
|
wget https://github.com"$(curl --silent https://github.com/dandavison/delta/releases | grep --max-count=1 --only-matching '[^\"]*x86_64-unknown-linux-gnu[^\"]*')" --output-document=- | tar --extract --gzip --no-anchored --strip-components=1 --to-stdout delta > ~/.bin/git-delta &&
|
|
|
|
|
chmod +x ~/.bin/git-delta
|
|
|
|
|
;;
|
|
|
|
|
git-filter-repo)
|
|
|
|
|
([ -d ~/.bin/git-filter-repo ] || (mkdir -p ~/.bin && git clone https://github.com/newren/git-filter-repo ~/.bin/git-filter-repo)) &&
|
|
|
|
|
([ -d ~/.bin/git-filter-repo ] || (mkdir --parents ~/.bin && git clone https://github.com/newren/git-filter-repo ~/.bin/git-filter-repo)) &&
|
|
|
|
|
bash/scripts/2path.sh ~/.bin/git-filter-repo/git-filter-repo
|
|
|
|
|
;;
|
|
|
|
|
git-scripts)
|
|
|
|
@ -71,9 +71,9 @@ while :; do
|
|
|
|
|
code --install-extension dbaeumer.vscode-eslint --install-extension eamodio.gitlens --install-extension esbenp.prettier-vscode --install-extension ms-vscode-remote.vscode-remote-extensionpack --install-extension pkief.material-icon-theme --install-extension streetsidesoftware.code-spell-checker --install-extension svelte.svelte-vscode
|
|
|
|
|
;;
|
|
|
|
|
vscode-linux)
|
|
|
|
|
mkdir -p ~/.config/Code/User &&
|
|
|
|
|
ln -frs vscode/keybindings.json ~/.config/Code/User/keybindings.json &&
|
|
|
|
|
ln -frs vscode/settings.json ~/.config/Code/User/settings.json
|
|
|
|
|
mkdir --parents ~/.config/Code/User &&
|
|
|
|
|
ln --force --relative --symbolic vscode/keybindings.json ~/.config/Code/User/keybindings.json &&
|
|
|
|
|
ln --force --relative --symbolic vscode/settings.json ~/.config/Code/User/settings.json
|
|
|
|
|
;;
|
|
|
|
|
vscode-win)
|
|
|
|
|
(cmd.exe /c del "%APPDATA%\Code\User\keybindings.json" 2\> nul; cmd.exe /c mklink "%APPDATA%\Code\User\keybindings.json" "$root_win\vscode\keybindings.json") &&
|
|
|
|
@ -84,32 +84,32 @@ while :; do
|
|
|
|
|
bash/scripts/2path.sh ~/.volta/bin
|
|
|
|
|
;;
|
|
|
|
|
nodejs-npmrc)
|
|
|
|
|
ln -frs nodejs/.npmrc ~/.npmrc
|
|
|
|
|
ln --force --relative --symbolic nodejs/.npmrc ~/.npmrc
|
|
|
|
|
;;
|
|
|
|
|
nodejs-config)
|
|
|
|
|
mkdir -p ~/dev &&
|
|
|
|
|
mkdir --parents ~/dev &&
|
|
|
|
|
for file in nodejs/config/{.*,*}; do
|
|
|
|
|
[[ "$file" == */. ]] || [[ "$file" == */.. ]] || ln -frs "$file" ~/dev/"$(basename "$file")"
|
|
|
|
|
[[ "$file" == */. ]] || [[ "$file" == */.. ]] || ln --force --relative --symbolic "$file" ~/dev/"$(basename "$file")"
|
|
|
|
|
done
|
|
|
|
|
;;
|
|
|
|
|
nodejs-scripts)
|
|
|
|
|
bash/scripts/2path.sh nodejs/scripts
|
|
|
|
|
;;
|
|
|
|
|
gcloud)
|
|
|
|
|
([ -d ~/.bin/gcloud ] || (mkdir -p ~/.bin/gcloud && wget "$(curl -s https://cloud.google.com/sdk/docs/downloads-versioned-archives | grep -o 'https[^\"]*linux-x86_64.tar.gz')" -O- | tar xzC ~/.bin/gcloud --strip-components=1)) &&
|
|
|
|
|
([ -d ~/.bin/gcloud ] || (mkdir --parents ~/.bin/gcloud && wget "$(curl --silent https://cloud.google.com/sdk/docs/downloads-versioned-archives | grep --only-matching 'https[^\"]*linux-x86_64.tar.gz')" --output-document=- | tar --extract --directory ~/.bin/gcloud --gzip --strip-components=1)) &&
|
|
|
|
|
bash/scripts/2path.sh ~/.bin/gcloud/bin/gcloud
|
|
|
|
|
;;
|
|
|
|
|
gcloud-config)
|
|
|
|
|
mkdir -p ~/.config &&
|
|
|
|
|
rm -rf ~/.config/gcloud &&
|
|
|
|
|
ln -rs gcloud/config ~/.config/gcloud
|
|
|
|
|
mkdir --parents ~/.config &&
|
|
|
|
|
rm --force --recursive ~/.config/gcloud &&
|
|
|
|
|
ln --relative --symbolic gcloud/config ~/.config/gcloud
|
|
|
|
|
;;
|
|
|
|
|
tmux)
|
|
|
|
|
ln -frs tmux/.tmux.conf ~/.tmux.conf
|
|
|
|
|
ln --force --relative --symbolic tmux/.tmux.conf ~/.tmux.conf
|
|
|
|
|
;;
|
|
|
|
|
firefox-rebuild-win)
|
|
|
|
|
ls firefox/*+* | cut -c9- | while read config; do
|
|
|
|
|
truncate -s0 firefox/"$config"
|
|
|
|
|
ls firefox/*+* | cut --characters=9- | while read config; do
|
|
|
|
|
truncate --size=0 firefox/"$config"
|
|
|
|
|
IFS='+' read -a pieces <<< "$config"
|
|
|
|
|
for piece in "${pieces[@]}"; do
|
|
|
|
|
[ -f firefox/"$piece" ] && cat firefox/"$piece" >> firefox/"$config"
|
|
|
|
@ -123,7 +123,7 @@ while :; do
|
|
|
|
|
mapfile -t profiles < <(ls "$profile_dir")
|
|
|
|
|
profiles_args=()
|
|
|
|
|
for ((i=0; i < ${#profiles[@]}; i++)); do profiles_args[2*i]="${profiles[$i]}"; profiles_args[2*i+1]="${profiles[$i]}"; done
|
|
|
|
|
mapfile -t configs < <(ls firefox/*+* | cut -c9-)
|
|
|
|
|
mapfile -t configs < <(ls firefox/*+* | cut --characters=9-)
|
|
|
|
|
configs_args=()
|
|
|
|
|
for ((i=0; i < ${#configs[@]}; i++)); do configs_args[2*i]="${configs[$i]}"; configs_args[2*i+1]="${configs[$i]}"; done
|
|
|
|
|
while :; do
|
|
|
|
@ -131,7 +131,7 @@ while :; do
|
|
|
|
|
[ "$profile" = '' ] && break
|
|
|
|
|
config="$(whiptail --title "Link $profile to config" --menu '' 22 60 15 "${configs_args[@]}" --notags --default-item "$config" 3>&2 2>&1 1>&3-)"
|
|
|
|
|
[ "$config" = '' ] && break
|
|
|
|
|
rm -f "$profile_dir"/"$profile"/user.js
|
|
|
|
|
rm --force "$profile_dir"/"$profile"/user.js
|
|
|
|
|
cmd.exe /c mklink %APPDATA%\\Mozilla\\Firefox\\Profiles\\"$profile"\\user.js "$root_win"\\firefox\\"$config"
|
|
|
|
|
done
|
|
|
|
|
;;
|
|
|
|
|