I use the parchive command-line utility
par2 quite a lot. In order to improve its scriptability I found that I needed to have the ability to list the recovery (
*.par2) and source files (the files verified or repaired using the recovery data) associated with a master PAR2 file.
Admittedly I could have scraped the output from
par2 -r <somefile.par2> but as it does some progress-percentage type output to the console I thought it might be cleaner to patch the
par2 command to add a
Here’s how to download, patch & compile the par2cmdline v0.4 package to get these changes for yourself. These instructions are specifically for Ubuntu 10.04 (Lucid Lynx) but will probably work on any recent(ish) Ubuntu (or indeed Debian) install.
Optional step; if you’ve already installed par2cmdline via apt-get you’ll probably want to remove it with:
sudo apt-get remove par2
- Download the source of par2cmdline v0.4 from here (hint: you want
- Untar the archive, this will create a par2cmdline-0.4 directory with the source in.
- If you’ve got gcc version 4 on your machine (you probably have) you’ll need to apply this patch to the source directory.
- Download and apply my patch to the source directory.
- Configure, compile and install.
Or, if you’re too busy and|or lazy to follow that, just paste the following into your console:
wget -O "par2cmdline-0.4.tar.gz" "http://downloads.sourceforge.net/project/parchive/par2cmdline/0.4/par2cmdline-0.4.tar.gz?r=&ts=1351786076&use_mirror=switch" tar -xvzf par2cmdline-0.4.tar.gz wget "http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/app-arch/par2cmdline/files/par2cmdline-0.4-gcc4.patch" patch -p0 < par2cmdline-0.4-gcc4.patch wget "http://simon.aldrich.eu/download/par2cmdline/par2cmdline-0.4-list.patch" patch -p0 < par2cmdline-0.4-list.patch cd par2cmdline-0.4/ ./configure make sudo make install
If all goes well you’ll end up with a
par2 command with the following new options:
Usage: par2 c(reate) [options] [files] : Create PAR2 files par2 v(erify) [options] [files] : Verify files using PAR2 file par2 r(epair) [options] [files] : Repair files using PAR2 files par2 l(ist) [options] [files] : List files using PAR2 files You may also leave out the "c", "v", and "r" commands by using "parcreate", "par2verify", or "par2repair" instead. Options: -b : Set the Block-Count -s : Set the Block-Size (Don't use both -b and -s) -r : Level of Redundancy (%%) -c : Recovery block count (Don't use both -r and -c) -f : First Recovery-Block-Number -u : Uniform recovery file sizes -l : Limit size of recovery files (Don't use both -u and -l) -n : Number of recovery files (Don't use both -n and -l) -m : Memory (in MB) to use -v [-v]: Be more verbose -q [-q]: Be more quiet (-q -q gives silence) -e : List only recovery files -o : List only source files -- : Treat all remaining CommandLine as filenames
-l command will by default list both the recovery & source files. Use the
-o options to restrict listing to one or the other of these file types.
By my own admission this patch is pretty rough and ready (it doesn’t handle PAR v1 files for example) but I hope it’s of use to someone.
This is very useful! I made your patch work with the latest version. Would you mind if I submitted a pull request for it to the github project: https://github.com/Parchive/par2cmdline ?
Sure, feel free
Thanks for this.
I hope I’m not doing the wrong thing by reviving a dead thread, but I was wondering if the pull request ever got a response?
It’s hard to believe that it’s 5 years later, and par2cmdline (a fairly amazing piece of software) is still missing this functionality.