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