blob: b7fa67d026fd03acedec9a7fa95d803e29c17cc1 (
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
26
27
28
29
30
31
32
33
34
|
#!/usr/bin/env sh
# Description: Update nnn plugins
#
# Shell: POSIX compliant
# Author: Arun Prakash Jana
CONFIG_DIR=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/
PLUGIN_DIR=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins
is_cmd_exists () {
which "$1" > /dev/null 2>&1
echo $?
}
if [ "$(is_cmd_exists sudo)" -eq "0" ]; then
sucmd=sudo
elif [ "$(is_cmd_exists doas)" -eq "0" ]; then
sucmd=doas
else
sucmd=: # noop
fi
# backup any earlier plugins
if [ -d $PLUGIN_DIR ]; then
tar -C $CONFIG_DIR -czf $CONFIG_DIR"plugins-$(date '+%Y%m%d%H%M').tar.gz" plugins/
fi
cd $CONFIG_DIR
curl -Ls -O https://github.com/jarun/nnn/archive/master.tar.gz
tar -zxf master.tar.gz
cp -vRf nnn-master/plugins .
$sucmd mv -vf nnn-master/misc/nlaunch/nlaunch /usr/local/bin/
rm -rf nnn-master/ master.tar.gz README.md
|