How To Use 'dir2xzm'

Post here if you are a new Porteus member and you're looking for some help.
WavyLinesAreNotReal
White ninja
White ninja
Posts: 21
Joined: 08 Jan 2013, 05:07
Distribution: Porteus v3.1 KDE 64-bit
Location: USA

How To Use 'dir2xzm'

Post#1 by WavyLinesAreNotReal » 21 Jun 2014, 02:25

'dir2xzm' allows Porteus to bundle files into a loadable module. So my question is: how do I control where the contents will appear when the module is activated?

Case 1:
I create a module, and I want the contents to appear in the same place where the module is activated.

Case 2:
I create a module, and I want the contents to appear in the home directory of the user, regardless of where the module is activated.

As always, any feedback/answers are appreciated. :good:

User avatar
wread
Module Guard
Module Guard
Posts: 1255
Joined: 09 Jan 2011, 18:48
Distribution: Porteus v5.0-kde-64 bits
Location: Santo Domingo
Contact:

Re: How To Use 'dir2xzm'

Post#2 by wread » 21 Jun 2014, 03:29

@WavyLines AreNotReal

Elemental Watson:
Case 1) right-click the folder and choose "Make Porteus xzm-Module"
Case 2) Do case 1) and move product to users folder.

Regards! :)
Porteus is proud of the FASTEST KDE ever made.....(take akonadi, nepomuk and soprano out and you will have a decent OS).
The Porteus Community never sleeps!

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: How To Use 'dir2xzm'

Post#3 by brokenman » 21 Jun 2014, 03:40

I'm not sure I understand your case 1) ... or perhaps you don't completely understand how modules work.

Essentially modules are a compressed archive like any other (zip,tar,bz2). You can extract them into the current folder where you are.
- right click/extract
- from terminal: xzm2dir module.xzm .

The magic of the module is that when you double click (activate) the module it is mounted into the live file system. Therefore, if you want the contents of your module to appear in the /home/guest folder then the module must be made with this file structure. A working example may help you to understand more clearly.

Code: Select all

mkdir -p /tmp/mymodule/home/guest
echo "Foo" > /tmp/mymodule/home/guest/bar.txt
dir2xzm /tmp/mymodule /tmp/mymodule.xzm
You have just created a module (/tmp/mymodule.xzm) from the folder /tmp/mymodule. This module has in its file structure: /home/guest/bar.txt

Activating it will inject the module into the system and the file bar.txt will appear in /home/guest. Deactivate the module will make the file disappear.
How do i become super user?
Wear your underpants on the outside and put on a cape.

WavyLinesAreNotReal
White ninja
White ninja
Posts: 21
Joined: 08 Jan 2013, 05:07
Distribution: Porteus v3.1 KDE 64-bit
Location: USA

Re: How To Use 'dir2xzm'

Post#4 by WavyLinesAreNotReal » 22 Jun 2014, 13:31

@brokenman

Yes! That's exactly what I was looking for. Thanks. :Bravo:

Refering to your example, when 'mymodule.xzm' is activated, the file 'bar.txt' will always appear in the home directory, regardless of where 'mymodule.xzm' is activated from. That's case 2 exactly.

Now as for case 1, I want the file 'bar.txt' to appear automatically in the same directory that 'mymodule.xzm' was activated from. If it's possible, then great! If not, no worries. I know how to create modules now. Thanks again.

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: How To Use 'dir2xzm'

Post#5 by brokenman » 22 Jun 2014, 14:20

Excellent.

For case 1) this is not possible. The module has a predetermined file structure and can not dynamically change according to which directory you are in.
How do i become super user?
Wear your underpants on the outside and put on a cape.

Post Reply