![]() |
How to create dialog to pop up on package install?
Hello,
is it possible to show user a dialog window asking yes / no question when he install a package via HAM? I would like to make a theme package that will include some optional stuff and I'd like to ask user if he wants to install those extras or not. And if user presses "yes" then some shell commands are ran in the background, and if he answers no then other actions are taken. Can someone provide some help? Thanks in advance! |
Re: How to create dialog to pop up on package install?
Or as an plan b; is it possible to run shell script after contents of deb have been extracted (postinst)? It would be easy to make a script that asks user to make the choise. If it's possible, then what will happen if the package is installed via HAM? Will the terminal window pop up and execute that script?
|
Re: How to create dialog to pop up on package install?
postinst is what you're looking for, you can run xterm from there, but popping up a dialog is much more user friendly. You can do that by writing a program to handle the dialog and executing it from the postinst script.
|
Re: How to create dialog to pop up on package install?
Quote:
I found that HAM supports displaying licence agreement pop-up with custom text + title which has OK and CANCELL -buttons, could I use that? I know how to lauch the agreement window but I don't know how to read the return value in postinst and so on. I'm pretty n00b when coming down to debian packaging or Unix in general so detailed help would be highly appreciated! :) |
Re: How to create dialog to pop up on package install?
okay.. I got it working when installing package @ Xterm with dpkg -command. I simply wrote simple script to postinst -file which asks y / n and then simple if / else to do the action (in my case rename two files). But it won't work when installing via HAM, it just does not open the xterm so that user could give his input :/
What should I do? |
Re: How to create dialog to pop up on package install?
Talked about this with tswindell but since he's offline I guess I'll post this.
Use zenity (I already had it installed, not sure if it comes preinstalled, if not just Depend on it) to display a dialog, see what the exit code is (if the user accepts it's 0, otherwise it's 1). http://maemo.org/packages/view/zenity/ Code:
zenity --question --text="Install custom transitions?" --ok-label=Yes To see the exit code (again, thanks to tswindell) add ;echo $? to the end. If that works, thank his post above :p |
Re: How to create dialog to pop up on package install?
Quote:
|
Re: How to create dialog to pop up on package install?
Quote:
To be more clear, would this be workable (the postinst -file): Code:
#! /bin/sh -e |
Re: How to create dialog to pop up on package install?
Quote:
Edit: only "downside" is that zenity window is ugly when it's ran by root (uses GTK default graphics instead of Hildon), but I guess there's nothing that can be done? |
Re: How to create dialog to pop up on package install?
Or then not... the "yes" answer is working and correct action is taken, but "no" answer is not working. It always runs the "yes" option even if user clicks "No" (tapping outside the dialog window). I checked the output by echoing the $? and it shows "1" when use has tapped "No" but my script still runs the option #1 and HAM says that package cannot be installed because postinst exitted with code 1.
Any ideas? |
All times are GMT. The time now is 14:45. |
vBulletin® Version 3.8.8