jdeb icon indicating copy to clipboard operation
jdeb copied to clipboard

Improve documentation on dirmode

Open Sami32 opened this issue 6 years ago • 23 comments

Sorry, i've tried to use <dirmode> without any success:

<data>
	<src>${project.external-resources}</src>
	<type>directory</type>
	<includes>*.conf, *.webfilters</includes>
	<mapper>
		<type>perm</type>
		<filemode>666</filemode>
                <dirmode>777</dirmode>
		<strip>1</strip>
		<prefix>/usr/lib/${project.name.camel}/examples</prefix>
	</mapper>
</data>

Could you please add an example in your documentation? Thank you.

Sami32 avatar Aug 27 '18 01:08 Sami32

No more chance using the template type: (I tried with the 1.5 and 1.6 version of this plugin)

<data>
	<type>template</type>
	<paths>
		<path>/usr/lib/${project.name.camel}/plugins</path>
		<path>/usr/lib/${project.name.camel}/renderers</path>
	</paths>
	<mapper>
		<type>perm</type>
		<dirmode>0777</dirmode>
	</mapper>
</data>

Sami32 avatar Aug 27 '18 14:08 Sami32

Would be great if you could provide a bit more information. "without success" let's me only assume you are seeing the default permissions.

tcurdt avatar Aug 27 '18 14:08 tcurdt

You are right, i only get the default directory permissions value 0755.

Sami32 avatar Aug 27 '18 15:08 Sami32

Do you see those permissions after install or did you check the deb itself?

tcurdt avatar Aug 27 '18 15:08 tcurdt

After install, to verify that the expected result has been done.

Sami32 avatar Aug 27 '18 16:08 Sami32

@Sami32 could you either check the deb yourself or provide it?

tcurdt avatar Aug 27 '18 16:08 tcurdt

https://dl.bintray.com/sami32/Testing/0.3/DMS-0.3.0-SNAPSHOT-7_all.deb

Sami32 avatar Aug 27 '18 17:08 Sami32

@Sami32 That's the dir in question?

drwxr-xr-x  0 root   root        0 Aug 27 16:14 ./usr/lib/DigitalMediaServer/examples/
-rw-rw-rw-  0 root   root    57463 Aug 27 16:14 ./usr/lib/DigitalMediaServer/examples/DMS.conf
-rw-rw-rw-  0 root   root      222 Aug 27 16:14 ./usr/lib/DigitalMediaServer/examples/VirtualFolders.conf
-rw-rw-rw-  0 root   root     4024 Aug 27 16:14 ./usr/lib/DigitalMediaServer/examples/WEB.conf
-rw-rw-rw-  0 root   root     1292 Aug 27 16:14 ./usr/lib/DigitalMediaServer/examples/ffmpeg.webfilters

tcurdt avatar Aug 27 '18 17:08 tcurdt

In this build is was these 2 directories: /usr/lib/DigitalMediaServer/plugins /usr/lib/DigitalMediaServer/renderers

Sami32 avatar Aug 27 '18 17:08 Sami32

Without looking at it more closely I would expect the following: The data producer emits only matched files - and prefixes them. There are no dirs involved at all - so the dirmode does not have any effect.

You can confirm this by creating and matching a sub directory. I assume it will then have the expected permissions.

tcurdt avatar Aug 27 '18 18:08 tcurdt

Could you make some example from my above ones? Thank you.

Sami32 avatar Aug 27 '18 19:08 Sami32

I have added the usage of permissions to the maven example. I hope that helps.

drwxr-xr-x  0 loader loader      0 Aug 27 21:54 ./usr/
drwxr-xr-x  0 loader loader      0 Aug 27 21:54 ./usr/share/
drwxr-xr-x  0 loader loader      0 Aug 27 21:54 ./usr/share/jdeb/
drwxr-xr-x  0 loader loader      0 Aug 27 21:54 ./usr/share/jdeb/lib/
-rw-r-----  0 loader loader   2920 Aug 27 21:54 ./usr/share/jdeb/lib/jdeb-example-1.0-SNAPSHOT.jar
drwxr-xr-x  0 root   root        0 Aug 27 21:54 ./usr/share/java/
lrw-r--r--  0 root   root        0 Aug 27 21:54 ./usr/share/java/jdeb.jar -> /usr/share/jdeb/lib/jdeb-example-1.0-SNAPSHOT.jar
drwxr-xr-x  0 loader loader      0 Aug 27 21:54 ./etc/
drwxr-xr-x  0 loader loader      0 Aug 27 21:54 ./etc/init.d/
-rw-r--r--  0 loader loader      0 Aug 27 21:54 ./etc/init.d/myservice
drwxr-x---  0 loader loader      0 Aug 27 21:54 ./etc/jdeb-example/
drwxr-xr-x  0 loader loader      0 Aug 27 21:54 ./var/
drwxr-xr-x  0 loader loader      0 Aug 27 21:54 ./var/lib/
drwxr-x---  0 loader loader      0 Aug 27 21:54 ./var/lib/jdeb-example/
drwxr-xr-x  0 loader loader      0 Aug 27 21:54 ./var/log/
drwxr-x---  0 loader loader      0 Aug 27 21:54 ./var/log/jdeb-example/
drwxr-xr-x  0 loader loader      0 Aug 27 21:54 ./var/run/
drwxr-x---  0 loader loader      0 Aug 27 21:54 ./var/run/jdeb-example/

That said: It seems like there is a bug in the template data producer. Despite being directories one has to use filemode instead of dirmode in that case.

tcurdt avatar Aug 27 '18 19:08 tcurdt

I do not see anything in the maven.md file. Only a commit adding filemode lines. That's said it should be more useful in the maven.md file IMO. I will try your workaround using template for now.

Sami32 avatar Aug 27 '18 21:08 Sami32

Nope, the template workaround didn't worked for me, using <filemode>0777</filemode> didn't changed anything in the permissions.

Sami32 avatar Aug 27 '18 21:08 Sami32

I changed it in the example https://github.com/tcurdt/jdeb/blob/master/src/examples/maven/pom.xml and seems to work fine there. See the above output. That's the 750:

drwxr-x---  0 loader loader      0 Aug 27 21:54 ./var/lib/jdeb-example/

So I am not quite sure I can help any further.

tcurdt avatar Aug 27 '18 21:08 tcurdt

Ok, i will wait until some dirmode documentation is added, perhaps i will understand how you was able to do that. https://github.com/tcurdt/jdeb/blob/6dc9aa15e952a57a46d13725545017b1ddfde253/docs/maven.md

Thank you for having tried at least.

Sami32 avatar Aug 27 '18 22:08 Sami32

That is weird that your template trick doesn't work for me but work for you. None example use dirmode, but i don't see how the first example could apply to my case writed above with multiple files. Maybe it doesn't work on collect case? anyway it seem that only filemode work and trick can be done using that, though i'm not sure i want go that way yet.

Sami32 avatar Aug 27 '18 23:08 Sami32

@Sami32 You don't have dirs but just files. That's why it doesn't work for you. I am not sure further docs on dirmode will help with that. If you wrap your files in a directory it should work.

tcurdt avatar Aug 27 '18 23:08 tcurdt

Ok, so it seem that your documentation is unclear only to me then:

dirmode Dir permissions as octet No; defaults to 755

Probably that my weak english doesn't help much. But i still think that if the example given was working it will be far more intuitive and efficient as it will avoid addind more lines of configuration, at least from point of view.

<data>
	<src>${project.external-resources}</src>
	<type>directory</type>
	<includes>*.conf, *.webfilters</includes>
	<mapper>
		<type>perm</type>
		<filemode>666</filemode>
                <dirmode>777</dirmode>
		<strip>1</strip>
		<prefix>/usr/lib/${project.name.camel}/examples</prefix>
	</mapper>
</data>

Sami32 avatar Aug 28 '18 12:08 Sami32

@Sami32 Sorry, but your data configuration cannot work like this. As I said - you are referencing only files.

Imagine you remove the prefix which is entirely optional. Where would there be a directory? And with the prefix: Why should the dirmode only be for the examples dir and not /usr/lib.

This is not about the dirmod documentation but rather understanding what the individual data producer do. We can argue and maybe improve that - but that's a different story. As for now you have use a different approach.

tcurdt avatar Aug 28 '18 13:08 tcurdt

As i said it seem only for me. I was naively thinking that it have to apply the directory permission only on the latest, the receiver folder. I do not see why it should apply to any others directories, not my logic at least ;)

I understand that your view is different, but from my point of view it only make the configuration longer to write ;)

Hopefully for me it was only a plugin testing case.

Sami32 avatar Aug 28 '18 13:08 Sami32

If you had your configs in a dedicated folder to begin with it's a non-issue. Instead your are picking individual files placing them in a target directory inside the deb. That's where it gets problematic.

One could argue the directory data producer should include the pointed at directory - but seems like that'd be an incompatible change. And while it seems like the obvious thing to do from your config I am still not sure it's the best way to go about it.

This is a general problem that I fear only version 2.0 could solve properly. But so far there hasn't been enough support to warrant the amount of development needed to establish the new version.

tcurdt avatar Aug 28 '18 13:08 tcurdt

No problem, i can understand that.

Remember, at the beginnning as i was only begging an add of <dirmode> example in the Maven markdown documentation to share your logic, as the logic is not necessarely shared identically by all ;)

As usually we only write for request or complain, i should have started to said that your plugin is overall a nice piece of code very useful ;)

Sami32 avatar Aug 28 '18 14:08 Sami32