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

Be able to use the "customize" and "require-scripts" options #3

Open
Sami32 opened this issue Jun 13, 2018 · 22 comments
Open

Be able to use the "customize" and "require-scripts" options #3

Sami32 opened this issue Jun 13, 2018 · 22 comments
Assignees

Comments

@Sami32
Copy link

Sami32 commented Jun 13, 2018

Any way to use these options?

new Options(Options.Customize.NEVER, false),

https://github.com/gino0631/pkg/blob/616d9ae68a1df5193e362d7ac15002ab6c752465/pkg-core/src/main/java/com/github/gino0631/pkg/jaxb/distribution/Options.java

Maybe something like that:

<installer-script>
	<options>
		<customize>allow</customize>
		<require-scripts>false</require-scripts>
	</options>
</installer-script>

or

<customize>allow</customize>
<require-scripts>false</require-scripts>
@Sami32 Sami32 changed the title Any way to use the "customize" and "require-scripts" options? Is there is a way to use the "customize" and "require-scripts" options from the pom.xml? Jun 13, 2018
@Sami32
Copy link
Author

Sami32 commented Jun 13, 2018

I see that Scripts and RunAtStartup optional files could be added inside the flat-pkg/base.pkg folder as well.
It seem useful for applications running as a service.

Scripts Optional This is an archive of scripts and additional resources. The hierarchy is saved as cpio archive compressed with gzip. See cpio(1), ditto(1), gzip(1). This file is optional.
RunAtStartup Optional This is a shell script that will be supposedly invoked on the next Mac OS X startup.

EDIT:
It seem that then the following informations should be added inside the PackageInfo file:

    <scripts>
        <preinstall file="./preinstall"/>
        <postinstall file="./postinstall"/>
    </scripts>
    <install-at-startup>
        <file path="/usr/libexec/oah/translate"/>
        ...
    </install-at-startup>

@Sami32 Sami32 changed the title Is there is a way to use the "customize" and "require-scripts" options from the pom.xml? Be able to use the "customize" and "require-scripts" options Jun 13, 2018
@Sami32
Copy link
Author

Sami32 commented Jun 13, 2018

I just discovered a new attribute that is not related to the options above but could be useful in some cases.
The pkg-info element can have the following optional boolean attribute: preserve-xattr.
Set it to true by default appear to me as a good thing.

@gino0631 gino0631 self-assigned this Jul 19, 2018
@gino0631
Copy link
Owner

gino0631 commented Jul 27, 2018

I could not relate these change requests to a meaningful use case. What exactly are you trying to achieve?

For instance:

  1. customize specifies whether the user can customise the installation by selecting or deselecting installation choices. Since I generate just one default choice, it is not clear how you are going to make use of this option.
  2. require-scripts indicates whether the distribution uses JavaScript code. Definitely not sure where and how you are going to use it.
  3. Even if RunAtStartup script were executed on the next system startup, it is not clear what it has to do with services (though I'm not sure what does it mean "applications running as a service" in macOS).
  4. What does the preserve-xattr attribute mean, and why it would be useful to set it to true?

Ability to run pre- and post-install scripts seems to be the only clear request. As for the other ideas, I would suggest to clarify the use cases, and do some testing to confirm the options work as intended.

@Sami32
Copy link
Author

Sami32 commented Jul 28, 2018

As a total macOS noobs that could have not be relevant.

  1. Indeed, if only one choice is available that doesn't make sens to be able to set this value to true.
  2. My idea was to use it for the same purpose as 3, just hoping that at least one of these possibility could do the job and in doubt having the two available increse the chance, or not ;-)
  3. My idea was related to run a media server on the background without GUI and without logging if possible. Maybe it could also be used for firewall or network interface configuration. Service seem called LauchDaemon on macOS.
    I was naively try to be able to fix some issues like these:
    https://forums.plex.tv/t/i-really-need-the-ability-to-launch-plex-media-server-on-boot-up/76684
    https://superuser.com/questions/71017/mac-os-x-running-a-service-specifically-apachectl-in-another-location
    https://serverfault.com/questions/194832/how-to-start-stop-restart-launchd-services-from-the-command-line
  4. It preserve the extended attributes. I was thinking that if this was set to true that could have avoided some quarantine flag to the user that have to remove them manually.
    But as i said it was just an idea as i'm not in known territory.

@Sami32
Copy link
Author

Sami32 commented Jul 28, 2018

I was hoping use pre-install script to set the Java heap memory size depending on the user's computer total RAM available.

EDIT:
I would like the macOS installer be able to get these value before the install:
sysctl hw.memsize as first choice or vm_stat or system_profiler SPHardwareDataType

For being able to use the computer RAM size to determine the Java heap memory size to be set at install time.

@Sami32
Copy link
Author

Sami32 commented Jul 28, 2018

Do you think that my macOS goals are possible?

@gino0631
Copy link
Owner

For services, you should take a look at launchd. Once you create a job definition that works for you, configure the installer to copy it to the appropriate location.

I will implement support for pre- and post-install scripts (though, as for Java, it has good memory defaults nowadays).

As for the preserve-xattr, since I do not include extended attributes so it is not clear how this option is supposed to work, and there are no known problems related to the attributes, I would keep the current behaviour.

@Sami32
Copy link
Author

Sami32 commented Jul 29, 2018

Thank you very much for your help and advice 👍

though, as for Java, it has good memory defaults nowadays

Yes, but du to our memory issue flawed by design and huge database to be handled (until 50 000 media by some users)and images or thumbnails, artwork to be displayed, for now we need to use this ugly trick before a huge refactoring that mean most all the code done since the beginning years ago by the original developpers so it will take time and skill...

I only read extended attributes users quarantine issue reports related to DMG, perhaps Safari did changed one extended attribute value while downloading the package?, so i just naively wanted try to avoid future similar issue.
But as i saw that it was in the XAR specifications i thought that it could have some more use eventually.
I get this documentation from there.

@Sami32
Copy link
Author

Sami32 commented Jul 31, 2018

As a side note, i should have said that i will also use this script ability to move our configurations files to the macOS user's default local folder ~/Library/Application Support/, as the /etc/skel/ is not used like in Linux.

@gino0631
Copy link
Owner

also use this script ability to move our configurations files

Just wondering - why not just installing the configuration files to the appropriate location?

@Sami32
Copy link
Author

Sami32 commented Jul 31, 2018

Because i didn't found a way to do that on macOS.
I only know how to do that with absolute paths like /etc/skel on Linux (or in the relative user folder using script) or or using NSIS script to install them in the user configuration folder on Windows.

@Sami32
Copy link
Author

Sami32 commented Jul 31, 2018

Do defining NSApplicationSupportDirectory to point to our program configuration folder, and modify our Java code to use that value, will work?

@Nadahar
Copy link
Contributor

Nadahar commented Aug 1, 2018

@Sami32 I tried to tell you before that you can place anywhere in the filesystem simply by placing them in the correct path in the PKG.

@Sami32
Copy link
Author

Sami32 commented Sep 1, 2018

One other use case will be to detect the Java version installed, because Java 9 and above removed some classes that make some applications relying on LookAndFeel, for example, to fail.
So when Java is not embedded in the package, the appriopriate selection of the JVM on the macOS with many versions installed can make the application work.

@Sami32
Copy link
Author

Sami32 commented Sep 1, 2018

Do this plugin have a mean to offer a customized menu to offer complememt applications download or ask the users if they want do a clean install or choose the memory heap size?

@gino0631
Copy link
Owner

This plugin is for building of certain kind of macOS packages in a cross-platform way. It can't control the installation experience, it can only enable features supported by the packages.

@Sami32
Copy link
Author

Sami32 commented Sep 12, 2018

Oh i see. Thank you for having taked the time to answer me 👍

@gino0631
Copy link
Owner

No problem. Sorry for being slow.

As for Java, I would definitely recommend to embed it; it is even required to do so for App Store apps.

Support for pre- and post-install scripts should be finished within 2-4 weeks, but as for heap size adjustments I would consider implementing this logic in your application, as the amount of available memory as well as the requirements probably may change after the application is installed.

@Sami32
Copy link
Author

Sami32 commented Sep 18, 2018

No problem, i'm not faster ;)
Great 😃

You are correct that it is not a perfect solution but it should do the trick for most users using it in daemon mode until that issue get natively properly fixed.

I saw that some NS function seem to be able to handle heap memory so i will also look into that possibility.

@Sami32
Copy link
Author

Sami32 commented Oct 7, 2018

After consideration i will adopt your suggestion and remove the JVM memory settings and leave it handle it automatically. It shouldn't be worse anyway ;)

While testing the daemon that i've created, i tried to remember an option that i've found some weeks ago to change the default agreement window after the License but i cannot remember well and find it again. I remember having discovered that somewhere into your code and that made the license agreement confirmation done on the same page down instead of a separate window after.
Do i've dreamed it or could you give me an hand on that?

@Sami32
Copy link
Author

Sami32 commented Oct 9, 2018

I just share my discovery about a media server called Serviio is using install Scripts in its macOS build:
http://download.serviio.org/releases/serviio-1.9.2-osx.tar.gz

I hope that it is not for win only 4 MB that he have archived its package into an tar.gz...

@Sami32
Copy link
Author

Sami32 commented Oct 11, 2018

Can we create user and group without the installer scripts?
BTW thank you for the Launchd link ;)

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

3 participants