-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathneovim-appimage-updater
executable file
·53 lines (36 loc) · 1.87 KB
/
neovim-appimage-updater
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
if ! whereis fuse | awk '{print $2}' | grep -q fuse; then
printf "\nInstalling fuse which is a dependency of AppImages..."
command -v pacman > /dev/null && sudo pacman -S --noconfirm fuse
command -v apt-get > /dev/null && sudo apt-get install -y fuse
fi
if ! command -v gcc; then
printf "\nInstalling gcc which is a dependency of Treesitter plugin of neovim..."
command -v pacman > /dev/null && sudo pacman -S --noconfirm gcc
command -v apt-get > /dev/null && sudo apt-get install -y gcc
fi
printf "\nLooking for Neovim AppImage updates..."
if command -v nvim > /dev/null; then
currentnvimversion=$(nvim -v | awk -F 'NVIM v' 'NR==1{print $2}')
latestnvimversion=$(curl -s https://github.com/neovim/neovim/releases/tag/stable | grep 'NVIM v' | awk -F 'NVIM v' 'NR==1{print $2}')
currentminorversion=$(echo $currentnvimversion | awk -F . '{print $2}')
latestminorversion=$(echo $latestnvimversion | awk -F . '{print $2}')
currentpatchversion=$(echo $currentnvimversion | awk -F . '{print $3}')
latestpatchversion=$(echo $latestnvimversion | awk -F . '{print $3}')
if [ $currentminorversion -lt $latestminorversion ] || ([ $currentminorversion -eq $latestminorversion ] && [ $currentpatchversion -lt $latestpatchversion ]); then
printf "\n\n Found a new version on Github. Installing it...\n"
sleep 1
wget https://github.com/neovim/neovim/releases/download/stable/nvim.appimage
chmod +x nvim.appimage
sudo mv nvim.appimage /usr/local/bin/nvim
else
printf "\n\n"
echo "Nothing to do. Neovim is up-to-date with version: $latestnvimversion"
fi
else
printf "\n\nNeovim is not installed. Installing now...\n"
sleep 1
wget https://github.com/neovim/neovim/releases/download/stable/nvim.appimage
chmod +x nvim.appimage
sudo mv nvim.appimage /usr/local/bin/nvim
fi