mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-25 20:34:52 +03:00
Support unraring source files
This commit is contained in:
parent
8fbc082d1f
commit
4631afc21e
@ -23,6 +23,7 @@ let inherit (builtins) head tail trace; in
|
|||||||
else if hasSuffixHack ".tar.Z" s then "tZ"
|
else if hasSuffixHack ".tar.Z" s then "tZ"
|
||||||
else if hasSuffixHack ".tar.lzma" s then "tar.lzma"
|
else if hasSuffixHack ".tar.lzma" s then "tar.lzma"
|
||||||
else if hasSuffixHack ".tar.xz" s then "tar.xz"
|
else if hasSuffixHack ".tar.xz" s then "tar.xz"
|
||||||
|
else if hasSuffixHack ".rar" s then "rar"
|
||||||
else if (hasSuffixHack ".zip" s) || (hasSuffixHack ".ZIP" s) then "zip"
|
else if (hasSuffixHack ".zip" s) || (hasSuffixHack ".ZIP" s) then "zip"
|
||||||
else if hasSuffixHack "-cvs-export" s then "cvs-dir"
|
else if hasSuffixHack "-cvs-export" s then "cvs-dir"
|
||||||
else if hasSuffixHack "-git-export" s then "git-dir"
|
else if hasSuffixHack "-git-export" s then "git-dir"
|
||||||
@ -213,6 +214,9 @@ let inherit (builtins) head tail trace; in
|
|||||||
" else if (archiveType s) == "tar.xz" then "
|
" else if (archiveType s) == "tar.xz" then "
|
||||||
xz -d -c <'${s}' | tar xv
|
xz -d -c <'${s}' | tar xv
|
||||||
cd \"\$(xz -d -c <'${s}' | tar t | head -1 | sed -e 's@/.*@@' )\"
|
cd \"\$(xz -d -c <'${s}' | tar t | head -1 | sed -e 's@/.*@@' )\"
|
||||||
|
" else if (archiveType s) == "rar" then "
|
||||||
|
unrar x '${s}'
|
||||||
|
cd \"$(unrar lb '${s}' | tail -1 | sed -e 's@/.*@@' )\"
|
||||||
" else if (archiveType s) == "zip" then "
|
" else if (archiveType s) == "zip" then "
|
||||||
unzip '${s}'
|
unzip '${s}'
|
||||||
cd \"$( unzip -lqq '${s}' | tail -1 |
|
cd \"$( unzip -lqq '${s}' | tail -1 |
|
||||||
|
@ -23,6 +23,8 @@ stdenv.mkDerivation {
|
|||||||
$out/share/doc/unrar
|
$out/share/doc/unrar
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
setupHook = ./setup-hook.sh;
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
description = "Utility for RAR archives";
|
description = "Utility for RAR archives";
|
||||||
homepage = http://www.rarlab.com/;
|
homepage = http://www.rarlab.com/;
|
||||||
|
5
pkgs/tools/archivers/unrar/setup-hook.sh
Normal file
5
pkgs/tools/archivers/unrar/setup-hook.sh
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
unpackCmdHooks+=(_tryUnrar)
|
||||||
|
_tryUnrar() {
|
||||||
|
if ! [[ "$curSrc" =~ \.rar$ ]]; then return 1; fi
|
||||||
|
unrar x "$curSrc" >/dev/null
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user