From 68c4c06283739cc0c7f619172b35544e88921308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20P=C3=B6ttler?= Date: Tue, 19 Nov 2019 17:00:53 +0100 Subject: [PATCH] extract: add RPM archive support (#8347) Also more quiet extraction. -D for cpio was not used due to additional output. --- plugins/extract/README.md | 1 + plugins/extract/_extract | 2 +- plugins/extract/extract.plugin.zsh | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/extract/README.md b/plugins/extract/README.md index 83b878c32..41b6a61f1 100644 --- a/plugins/extract/README.md +++ b/plugins/extract/README.md @@ -27,6 +27,7 @@ plugins=(... extract) | `jar` | Java Archive | | `lzma` | LZMA archive | | `rar` | WinRAR archive | +| `rpm` | RPM package | | `sublime-package` | Sublime Text package | | `tar` | Tarball | | `tar.bz2` | Tarball with bzip2 compression | diff --git a/plugins/extract/_extract b/plugins/extract/_extract index 33d49fcc5..0257ce231 100644 --- a/plugins/extract/_extract +++ b/plugins/extract/_extract @@ -3,5 +3,5 @@ _arguments \ '(-r --remove)'{-r,--remove}'[Remove archive.]' \ - "*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|deb|gz|ipsw|jar|lzma|rar|sublime-package|tar|tar.bz2|tar.gz|tar.xz|tar.zma|tbz|tbz2|tgz|tlz|txz|war|whl|xpi|xz|zip)(-.)'" \ + "*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|deb|gz|ipsw|jar|lzma|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.xz|tar.zma|tbz|tbz2|tgz|tlz|txz|war|whl|xpi|xz|zip)(-.)'" \ && return 0 diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index d3d847daf..27b9e50f1 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -48,6 +48,7 @@ extract() { (*.z) uncompress "$1" ;; (*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d $extract_dir ;; (*.rar) unrar x -ad "$1" ;; + (*.rpm) mkdir "$extract_dir" && cd "$extract_dir" && rpm2cpio "../$1" | cpio --quiet -id && cd .. ;; (*.7z) 7za x "$1" ;; (*.deb) mkdir -p "$extract_dir/control"