Re: Create a catalog from the rpm database
Denis Corbin <[email protected]> Wed, 29 Jan 2014 22:27:03 +0100
| Newsgroups | gmane.comp.sysutils.backup.dar.general |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 28/01/2014 23:11, gulikoza wrote:
> Hello,
>
>> The script method is, I thing, the best approach as it does not
>> put any dependency between libdar and rpm tools, thus brings a
>> robust solution against changes in libdar and changes in rpm
>> tools. It has however the drawback to need creating a faked
>> directory tree (using sparse files as you described). Another way
>> would be to have libdar be rpm aware or have rpm tool able to
>> generate a dar snapshot backup, it's not evident it would be
>> faster and it would be complicated to maintain. Last another way
>> would be to extend libdar API to let an application specifying
>> the contents to be used to generate a snapshot backup, such
>> application would also be rpm aware and could replace your script
>> without the drawback of creating temporary files ... well, so
>> far, I could not find any API simple enough to be easily
>> useable...
>
> Although I use dar for some time now already, I must say it is
> always interesting to re-read the documentation as I almost always
> find something I haven't noticed before :-). This time, I was
> looking to see if it is possible to somehow programmatically pipe
> the directory contents to dar to take as a snapshot. A simple ls
> -la listing is probably not good enough for dar to parse (not
> enough mtime resolution)
right, the stat command is probably more interesting as it has the
ability to format the output and to provide the dates (atime, ctime,
mtime) as second since January 1st, 1970.
> but it might not be a bad idea for the future to have the ability
> to somehow specify the contents of the filesystem to libdar instead
> of it checking the filesystem. I also thought of programming the
> catalogue myself (I have written a dar Total Commander (Windows)
> plugin so I do have some knowledge of the dar file structure), but
> writing a valid catalogue would be much harder than reading an
> already existing one ;-)
:-)
After a quick review of libdar classes, it should not be too much
complicated to build an empty catalogue object, that would get filled
up using the catalogue::add() method.
This method receives objects of different classes:
- - plain file (class file)
- - symlinks (class lien)
- - directories (class directory)
and so on.
Those classes have constructors that receive as argument the different
metadata of inodes to be added (name, ownership, permission, dates, etc.)
However this part lack documentation in particular the way/order to
add objects into the catalogue object.
Next what is missing is a new constructor for the class archive in
order to receive that catalogue object as input, as well as the
different layers parameters (compression, encryption, slicing, etc.).
All the rest can and should be done from an external application: This
includes the parsing of an input file which format has to be defined.
Tool that translates that input file into objects to be added to a
catalogue a object which at the end of the processing would be used to
build an archive object thanks to that new constructor. And finally a
tool that would dump the archive to its target slice(s) (yes, another
new method to be added to class archive).
That's the way I see it. To me the biggest point to address is the
input file format. For reference, follows the expected parameters for
each inode type:
file: uid, gid, permission,
last_access, last_modif, last_change,
path, name,
size
door: uid, gid, permission,
last_access, last_modif, last_change,
path, name
symlink: uid, gid, permission,
last_access, last_modif, last_change,
path, name,
target
directory: uid, gid, permission,
last_access, last_modif, last_change,
path, name
chardev: uid, gid, permission,
last_access, last_modif, last_change,
path, name,
major, minor
blockdev: uid, gid, permission,
last_access, last_modif, last_change,
path, name,
major, minor
named_pipe: uid, gid, permission,
last_access, last_modif, last_change,
path, name
unix_socket: uid, gid, permission,
last_access, last_modif, last_change,
path, name, major, minor
A first solution could be to define a complete grammar and use
flex/bison for the input file parsing... well, that probably a bit
overkill but it stays feasible.
Another way would be using a XML format, but I don't known which tools
would help for such a parsing...
Any other idea is welcome...
>
>> If you want, I can add your script with other existing ones in
>> dar documentation (
>> http://dar.linux.free.fr/doc/samples/index.html ). Else I can
>> also add a link in external tools toward an URL where you could
>> maintain and keep up to date your script eventually adding
>> features, and so on.
>
> I don't have the URL for the script, just what I sent to the list,
> I wanted first to get some feedback and see if the idea is
> feasible. I'll do more tests and see how the archives end up
> eventually...
OK, no problem.
>
> Thanks,
>
> Regards, gulikoza
>
>
Regards,
Denis.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQIVAwUBUulyJggxsL0D2LGCAQIysQ//TXk18OhwSrCez8yN1HzFWVBaoGtzsa05
8EMayCZ7asiuoz6stHAa/roMeffjIyN3ymlAEotkau0geqc9g7aDkhEWiYzS0EhE
jODeeXsTgCxi21SGycbhUj/KihW1HySwiTCGISQuw4hIuvt84xDPujPdzj49+biT
VNFKOQ88pBylGm/8gALmwSYiGtl/HKfGmR0J4+2DUvRsRc1gtE9NZ91HSXVBQ4Vh
mCL58JC71PMxY7b/yWeMPKav0bE5wNid3lDfJ3qZrsgjf5oa6U+dXsVXxj+7GKIT
iY1yEAElvX4wNOzMe8Nl8rLiANBtDI+din0cjyjJ1xOQ+w0b5ykNeJxTXHfDlKXB
cqnzP81k0Q2NGMebQxDqMhiyS9sweCBTk9lUXCq7Ob4bIDsDGJEQVLjOHE7h0hNh
VZ2D/Uu3qhbp5Me+K7BAQDJu47FOzaJkMiMTMWW7UTHnFJ1N70NzeD4+9+ZL7PJb
q57KUgWfuaW8JRzVwm8Bffzh3NORhYYsKXfBqwzkhz9m9IzMUu8dtAxc1bZ+Y+RH
QUI7jLhtgtX4kPQBXRThif6CNKJY5blxSnn3NZRubqCjMnXBRLLgpOMILafjBl9r
iBEwI0dEWrRpmMMgCLOVkDFtD2EOIdGbM6agmZ4TYVBA9zb98xM+K99h4uisUUgw
aiVtL3U7Ypg=
=TDVg
-----END PGP SIGNATURE-----
------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable
security intelligence. It gives you real-time visual feedback on key
security issues and trends. Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk