]> Sergey Matveev's repositories - nnn.git/commitdiff
getplugs: backup earlier plugins
authorArun Prakash Jana <engineerarun@gmail.com>
Wed, 5 Jun 2019 12:22:33 +0000 (17:52 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Wed, 5 Jun 2019 12:22:33 +0000 (17:52 +0530)
plugins/README.md
plugins/getplugs

index 79abca1577ff10db5cdaa5b9d406665f5cf21cdf..f04d4a07aea445967fe1cea30fbb54611ac5633e 100644 (file)
@@ -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`.
 
index 14184c37b9628055ecbaf4519ff165e46f397513..a42bab16521f99c5a7c23e26bd05e45ce0ebb0e5 100755 (executable)
@@ -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