Added some tests and implemented packing/unpacking of the patch dirs

WIP
[endlessm/eos-shell#2711]