Skip to content

jelaas/bar

Repository files navigation

Create and extract RPM archives.

Supports extracting gzip, xz and zstd compressed archives.
Can only generate MD5 checksums.
Reads and verifies both MD5 and SHA256 checksums.

bar [-hriclxv] archive-file [path ..]
 h -- help
 r -- recursive
 c -- create
 x -- extract
 l -- list
 i -- show header info
 v -- verbose

 Overriding default tag values:
 --arch <archname>      [from uname]
 --buildtime <unixtime> [current time]
 --description <string> [None]
 --fgroup <groupname>   [file owner]
 --fuser <username>     [file owner]
 --group <packagegroup> [None]
 --license <string>     [GPLv2+]
 --name <string>        [from archive-file name]
 --os <osname>          [from uname]
 --prein <string>       pre install script
 --preun <string>       pre uninstall script
 --pretrans <string>    pre transaction script
 --postin <string>      post install script
 --postun <string>      post uninstall script
 --posttrans <string>   post transaction script
 --release <string>     [current date and time YYYYMMDD.HHMMSS]
 --require <pkgname> <pkgversion>
 --summary <string>     [None]
 --version <string>     [0]

 Create/extract options:
 --prefix <path>        add prefix <path> to all filepaths
 --nosum                ignore checksums
 --nosync               do not sync to disk while writing
 --quotechar <char>     [%] used for inserting special chars
 --printtag <tag number>

 Package handler information:
 --pkginfo

 Examples:
 --examples

 'path' can be prefixed with one or more of:
 config::               Mark as configfile
 noreplace::            Mark as configfile and not to be replaced
 missingok::            Mark as missingok
 override::             Override one previous file with same name
 owner@USER:GROUP::     Specify owner of files
 prefix/PATH::          Add path prefix
 r::                    Recursive descent into path
 nor::                  No recursive descent into path

Examples: 
 Listing contents:
  $ bar -lv archive.rpm
 Creating an archive:
  $ bar -cr archive.rpm /file/path
 Advanced archive creation:
  $ bar	\
     --license=GPLv2+\
     --summary "My archive named 'archive'"\
     --group=Applications/Internet\
     --description "Text%nSecond line.%nThird line"\
     --prefix=/path/to/prepend\
     --fuser=myuser --fgroup=users\
     --version=3.0.0\
     --release=1\
     --arch=noarch\
     --name=archive\
     --postin "echo post_install%necho line2%n"\
     -cr archive-3.0.0-1.noarch.rpm path1 path2
 Marking a configuration file:
  $ bar -c archive.rpm config::etc/config
 Specifying owner:
  $ bar -c archive.rpm owner@wheel:wheel::etc/config

Dependencies:
- zlib
- xz (liblzma)
- zstd
- C compiler
Thats all!

Link statically and enjoy.

STATUS
Creating, listing and extracting archives work.
MD5sum is now calculated and written into the signature.
The SIGTAG MD5sum is verified.
MD5 and SHA256 file checksums are verified.
You can now override: arch, license, name, os, release, version, summary, description, group.
Recursive selection of files supported.
Verification of per file (checksum), done.

PERFORMANCE
time bar -cr kernel-source.rpm /src/kernel-3.6.0/
real 2m10.042s

du -hs /src/kernel-3.6.0/
535M   /src/kernel-3.6.0/
find /src/kernel-3.6.0/|wc -l
42211
bar -l kernel-source.rpm |wc -l
42211
du -hs kernel-source.rpm 
105M   kernel-source.rpm

About

Extract and create RPM archive files. Reimplementation of archive parts of rpmbuild-/rpm command into single binary with no external dependencies

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors