nnn/plugins/upgrade

26 lines
660 B
Text
Raw Normal View History

2019-04-18 10:29:47 +05:30
#!/usr/bin/env sh
# Description: Check and update to latest version of nnn manually on Debian 9 Stretch
#
2020-05-06 10:42:29 +05:30
# Note: This script installs a package, should be issued with admin privilege
#
2019-04-18 10:29:47 +05:30
# Shell: POSIX-compliant
# Author: Arun Prakash Jana
2019-11-22 02:14:25 +05:30
cur="$(nnn -v)"
new="$(curl -s "https://github.com/jarun/nnn/releases/latest" | grep -Eo "[0-9]+\.[0-9]+")"
2019-11-22 02:14:25 +05:30
if [ "$cur" = "$new" ]; then
echo 'Already at latest version'
exit 0
fi
# get the package
2019-09-27 21:01:55 +05:30
curl -Ls -O "https://github.com/jarun/nnn/releases/download/v$new/nnn_$new-1_debian9.amd64.deb"
# install it
2019-11-22 02:14:25 +05:30
sudo dpkg -i nnn_"$new"-1_debian9.amd64.deb
# remove the file
2019-11-22 02:14:25 +05:30
rm -rf nnn_"$new"-1_debian9.amd64.deb