To use it:
- Extract it somewhere
- Run make in the created directory
- su to root
- Run make install
Now you have a new utility, pkg_trans, and additions to existing pkg_add and pkg_delete utilities. It's highly recommended you also add pkg_trans_save_deleted_packages="YES" to /etc/rc.conf (suggestions for better placement of this configurable is welcome). To undo this, run make install from the normal build tree (at /usr/src/usr.sbin/pkg_install) and manually remove the pkg_trans utility.
The additional pkg_trans utility is called by patched pkg_add and pkg_delete, to isolate transaction functionality and minimize changes to pkg_add and pkg_delete. It also serves to query transactions and undo them. In all other aspects, pkg_add and pkg_delete behave like they did before.
The man pages are not yet updated, but the wiki page above has simple descriptions of new options. Here's what currently works:
- Recording pkg_add and pkg_delete transactions (one invocation of pkg_add/pkg_delete is one transaction, no matter how many packages it touches).
- Backing up of packages in pkg_delete transactions
- Undoing those transactions
- Querying transaction records.
The transaction records are installed in /var/db/pkgtrans and /usr/ports/pkgtrans.
To use the new facilities, run pkg_add and pkg_delete as usual and note how transactions are generated with "pkg_trans -l". You can undo the transactions with "pkg_trans -u ###", given the appropriate transaction ID.
A sample console session with the new utilities is available at the announcement. I'd be happy to hear reports of its usage!
#1 great idea
Excellent idea. Does pkg_trans play well with the "pkg_improved" changes that were made to pkg tools? pkg_improved uses a small .db (sqlite?) to speed up various pkg operations. I guess the patches are simple enough it would make little difference?
cheers,
encrypted isci howto is great too ... soon I will pxeboot and mount things via iscsi and leave nfs turned off ;-)
#2 pkg_trans and pkg_improved
I don't really agree with how "pkg_improved" was envisioned. I would be very happy if it used sqlite but instead it uses the ancient BDB databases. Much complexity could be avoided by using sqlite.
The pkg_trans work is orthogonal to the pkg_improved, but the patches are conflicting (though not much - I've avoided changes to existing pkg_* utilities and added the new functionality as an additional utility).
#3 Great
Hi Ivan
I like your idea about transactions support within pkg_* subsystem... keep going. O hope it will become in base freebsd ASAP.
Best regards, Jan
#4 Re: Great
Status update: the patch has been rejected.