aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-06-05 17:52:33 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-06-05 17:52:33 +0530
commitd970a7416fcfd514a9dbd7db921e4fc03864ff3a (patch)
tree5402140d6e2680179b8b58d47f9b0ec631dde32c
parentdd42726c5b5683f5ecea2224b64d27fbcf04941c (diff)
downloadnnn-d970a7416fcfd514a9dbd7db921e4fc03864ff3a.tar.gz
getplugs: backup earlier plugins
-rw-r--r--plugins/README.md2
-rwxr-xr-xplugins/getplugs5
2 files changed, 6 insertions, 1 deletions
diff --git a/plugins/README.md b/plugins/README.md
index 79abca1..f04d4a0 100644
--- a/plugins/README.md
+++ b/plugins/README.md
@@ -24,7 +24,7 @@
#### Installing plugins
-Download the `getplugs` plugin and execute it anywhere to get all the plugins installed to `~/.config/nnn/plugins`. You can run it again later to update the plugins.
+Download the `getplugs` plugin and execute it anywhere to get all the plugins installed to `~/.config/nnn/plugins`. You can run it again later to update the plugins. It backs up earlier plugins.
**NOTE:** `getplugs` also downloads the launcher `nlaunch` and tries to place it at `/usr/local/bin/` using `sudo`. If it fails you have to place `nlauch` manually somewhere in your `$PATH`.
diff --git a/plugins/getplugs b/plugins/getplugs
index 14184c3..a42bab1 100755
--- a/plugins/getplugs
+++ b/plugins/getplugs
@@ -5,6 +5,11 @@
# Shell: POSIX compliant
# Author: Arun Prakash Jana
+# backup any earlier plugins
+if [ -d ~/.config/nnn/plugins ]; then
+ tar -C ~/.config/nnn/ -cf ~/.config/nnn/"plugins-$(date '+%Y%m%d%H%M').tar.bz2" plugins/
+fi
+
mkdir -p ~/.config/nnn/plugins
cd ~/.config/nnn/plugins
wget -nv --show-progress https://github.com/jarun/nnn/archive/master.tar.gz