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

[linux] Scripts (preinst, postinst) inserted on installation resources don't execute #1766

Open
rodrigoknob opened this issue Jan 29, 2022 · 4 comments
Assignees
Labels
native distribution question Not a bug, but question or comment

Comments

@rodrigoknob
Copy link

rodrigoknob commented Jan 29, 2022

I'm trying to run script (postinst) after installing my application.
I'm able to put the scripts in the resources folder of the installation directory, but after the complete installation, they are not executed.

Follow the script instructions from this link:
http://www.embeddedlinux.org.cn/OEManual/recipes_installation_scripts.html

When I create the installer through jpackage via terminal, the scripts are executed normally, however, when I create the installer through the compose plugin, they are not executed.

I created a repository to simulate this situation, follow the link:
https://github.com/rodrigoknob/test_compose

If you run the create_package.sh script inside the jpackage_manual folder, it will create the .deb installer, and when you run the installer, the postinst scripts will run normally.

Now, if you are going to create the installer from the ./gradlew package task, the installer will be generated, however, if it is executed, no script is executed.

I don't know if some configuration is missing, or the plugin is not executing the scripts.
Then, how to run the .deb package scripts via installer created by the plugin?

@akurasov akurasov added native distribution question Not a bug, but question or comment labels Jan 31, 2022
@gabrielpaim
Copy link

Any updates on this? I'm also experiencing this issue.

@AltNico
Copy link

AltNico commented Feb 11, 2022

Looking at the .deb files produced by the packageDeb task, one can see that the files from the source's resource/ directory land in /opt/briar-desktop/lib/app/resources/ inside the data.tar.xz archive. However, one can see that the default preinst and postinst scripts land in the control.tar.xz archive.

The respective code that handles this in Compose is this:

val appResourcesRootDir = app.nativeDistributions.appResourcesRootDir
if (appResourcesRootDir.isPresent) {
from(appResourcesRootDir.dir("common"))
from(appResourcesRootDir.dir(currentOS.id))
from(appResourcesRootDir.dir(currentTarget.id))
}

val destDir = project.layout.buildDirectory.dir("compose/tmp/${app.name}/resources")
into(destDir)

https://github.com/JetBrains/compose-jb/blob/aa08279/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/configureApplication.kt#L86

@AltNico
Copy link

AltNico commented Feb 14, 2022

I think I found the problem and fixed it in #1843.

@AltNico
Copy link

AltNico commented Feb 18, 2022

Until #1843 gets merged, we're using the following code at Briar Desktop to re-package the .deb files produced by Compose, in case anyone is interested:

fakeroot sh -c '
  mkdir tmp
  dpkg-deb -R briar-desktop.original.deb tmp
  cp ../../../../../src/packagingResources/linux/postinst tmp/DEBIAN/postinst
  cp ../../../../../src/packagingResources/linux/preinst tmp/DEBIAN/preinst
  cp ../../../../../src/packagingResources/linux/prerm tmp/DEBIAN/prerm
  dpkg-deb -b tmp briar-desktop.deb
'

https://code.briarproject.org/briar/briar-desktop/-/blob/9d1a68920b52f5dd0f5764e89639e28cf0f5e837/utils/finalize-deb.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
native distribution question Not a bug, but question or comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants