Compare commits

..

3 Commits

Author SHA1 Message Date
e95ccf042b
lazynvim WIP 2024-11-22 09:32:36 +08:00
1a912bf645
frkn tool -- toggle ipv6 on (dis)connect 2024-11-22 09:32:22 +08:00
1c2abec8a7
Helpers fixes 2024-11-22 09:31:53 +08:00
4 changed files with 91 additions and 5 deletions

View File

@ -9,7 +9,7 @@ installed2() {
}
apt_install() {
sudo apt install -y --autoremove "$*"
sudo apt install -y --autoremove $*
}
require() {
@ -21,7 +21,7 @@ require() {
done
if [ ${#sw[@]} -gt 0 ]; then
info "This packages will be installed in your system:\n${sw[*]}"
apt_install "${sw[*]}"
apt_install ${sw[*]}
[ $? -gt 0 ] && die "installation cancelled" 201
fi
}

64
install/lazynvim Executable file
View File

@ -0,0 +1,64 @@
#!/bin/bash
# https://www.devas.life/effective-neovim-setup-for-web-development-towards-2024/
set -eo pipefail
trap ontrap SIGINT SIGTERM SIGSTOP
ontrap() {
echo
echo "[!] Interrupted"
exit
}
[ -z "$1" ] && version=0.10.1 || version="$1"
filedir="$HOME/install/neovim-$version"
filename="nvim-linux64.tar.gz"
filepath="$filedir/$filename"
configdir="$HOME/.config/nvim"
localdir="$HOME/.local"
echo "[*] Installing neovim v$version"
if [ -d $configdir ]; then
mv $configdir "$configdir.bak-$(date +'%Y%m%d_%H%M%S')"
fi
mkdir -p $filedir $configdir $localdir/{bin,lib,share}
if [ ! -f $filepath ]; then
echo "[*] Downloading to $filepath..."
wget -q https://github.com/neovim/neovim/releases/download/v$version/nvim-linux64.tar.gz \
-O $filepath \
--show-progress
fi
echo "[*] Unpacking: $filepath..."
tar -zxf $filepath -C $filedir
cp -rf $filedir/nvim-linux64/bin/nvim $localdir/bin/
cp -rf $filedir/nvim-linux64/lib/nvim $localdir/lib/
cp -rf $filedir/nvim-linux64/share $localdir/share
rm -rf $filedir/nvim-linux64
echo "[*] Reinit git repo..."
git clone https://github.com/LazyVim/starter \
$configdir \
--depth=1 \
--single-branch
cd $configdir
rm -rf .git
git init -q

View File

@ -1,13 +1,19 @@
#!/bin/bash
function disconnect() {
echo "Connecting to $1"
echo "Disconnecting: $1"
sudo wg-quick down "$1"
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1
echo
}
function connect() {
echo "Disconnecting frkn-$1"
echo "Connecting: frkn-$1"
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=0
sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0
sudo wg-quick up "frkn-$1"
echo
}
@ -55,7 +61,7 @@ Endpoint = $peer_endpoint
PersistentKeepalive = 25
EOF
done
sudo mv ./frkn-*.conf /etc/wireguard/
sudo mv -f ./frkn-*.conf /etc/wireguard/
}
command="$1"

16
uninstall/lazynvim Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
set -eo pipefail
trap ontrap SIGINT SIGTERM SIGSTOP
ontrap() {
echo
echo "[!] Interrupted"
exit
}
echo "[*] Uninstalling neovim"
find "$HOME/.config" -type f -path "*/nvim*" -exec rm -rfv {} +
find "$HOME/.local" -type f -path "*/nvim*" -exec rm -rfv {} +
echo "[*] Finish"