aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/upgrade
blob: b2170f7be508df26c3a9f38f5e478ba1148c8b79 (plain) (blame)
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
#!/usr/bin/env sh

# Description: Check and update to latest version of nnn manually on Debian 9 Stretch
#
# Note: This script installs a package, should be issued with admin privilege
#
# Shell: POSIX-compliant
# Author: Arun Prakash Jana

cur="$(nnn -v)"
new="$(curl -s "https://github.com/jarun/nnn/releases/latest" | grep -Eo "[0-9]+\.[0-9]+")"

if [ "$cur" = "$new" ]; then
    echo 'Already at latest version'
    exit 0
fi

# get the package
curl -Ls -O "https://github.com/jarun/nnn/releases/download/v$new/nnn_$new-1_debian9.amd64.deb"

# install it
sudo dpkg -i nnn_"$new"-1_debian9.amd64.deb

# remove the file
rm -rf nnn_"$new"-1_debian9.amd64.deb