Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation on dirmode #273

Open
Sami32 opened this issue Aug 27, 2018 · 23 comments
Open

Improve documentation on dirmode #273

Sami32 opened this issue Aug 27, 2018 · 23 comments

Comments

@Sami32
Copy link

Sami32 commented Aug 27, 2018

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
Copy link
Author

Sami32 commented Aug 27, 2018

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>

@tcurdt
Copy link
Owner

tcurdt commented Aug 27, 2018

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

@Sami32
Copy link
Author

Sami32 commented Aug 27, 2018

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

@tcurdt
Copy link
Owner

tcurdt commented Aug 27, 2018

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

@Sami32
Copy link
Author

Sami32 commented Aug 27, 2018

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

@tcurdt
Copy link
Owner

tcurdt commented Aug 27, 2018

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

@Sami32
Copy link
Author

Sami32 commented Aug 27, 2018

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

@tcurdt
Copy link
Owner

tcurdt commented Aug 27, 2018

@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

@Sami32
Copy link
Author

Sami32 commented Aug 27, 2018

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

@tcurdt
Copy link
Owner

tcurdt commented Aug 27, 2018

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.

@Sami32
Copy link
Author

Sami32 commented Aug 27, 2018

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

@tcurdt
Copy link
Owner

tcurdt commented Aug 27, 2018

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.

@Sami32
Copy link
Author

Sami32 commented Aug 27, 2018

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
Copy link
Author

Sami32 commented Aug 27, 2018

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

@tcurdt
Copy link
Owner

tcurdt commented Aug 27, 2018

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.

@Sami32
Copy link
Author

Sami32 commented Aug 27, 2018

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
Copy link
Author

Sami32 commented Aug 27, 2018

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.

@tcurdt
Copy link
Owner

tcurdt commented Aug 27, 2018

@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.

@Sami32
Copy link
Author

Sami32 commented Aug 28, 2018

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>

@tcurdt
Copy link
Owner

tcurdt commented Aug 28, 2018

@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.

@Sami32
Copy link
Author

Sami32 commented Aug 28, 2018

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.

@tcurdt
Copy link
Owner

tcurdt commented Aug 28, 2018

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.

@Sami32
Copy link
Author

Sami32 commented Aug 28, 2018

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 ;)

@tcurdt tcurdt changed the title Is <dirmode> working correctly? Improve documentation on dirmode Oct 5, 2018
Repository owner deleted a comment from dan1471 Jun 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants