开发者

Displaying instructions to user after .deb installer completes

开发者 https://www.devze.com 2022-12-11 23:20 出处:网络
Is the开发者_StackOverflow社区re a commonly used approach for displaying \'how to get started\' instructions to a user after a .deb installer has finished installing a package?

Is the开发者_StackOverflow社区re a commonly used approach for displaying 'how to get started' instructions to a user after a .deb installer has finished installing a package?

I need an approach that works for users working via a terminal as well as from a desktop environment.

Server admins will probably know to check for a README file but many others won't.


I'd suggest running the "tty" command from your postinstall script. That will tell you if you have a tty and are running as a terminal program. Once you know that you could either "more" a readme file if you're running in terminal mode or you could call "gnome-text-editor" if not. You might also want to put in some detection to check "/etc/lsb-release" so that you know what distribution your .deb is being installed on and which editors will be suitable.


I use the tty command like Benj suggested, but I use the dialog command to display post install chatter if its available on the system.

Try this command:

dialog --backtitle "All done" --title "Installation complete" --textbox /etc/passwd 0 0

... but replace /etc/passwd with your README of choice. Its a much nicer way to scroll through information.


After a bit of experimentation it looks like I can detect how the .deb package has been installed by checking the value of the DEBIAN_FRONTEND variable in the postint.sh script. When run from the desktop it contains the value 'gnome', but when run via dpkg from the command-line it isn't set, so something like this might work:

HELP_URL="http://mysite.com/help.html"
if [ "$DEBIAN_FRONTEND" = "gnome" ]; then
    nohup gnome-www-browser $HELP_URL &
else 
    echo For help visit $HELP_URL
fi
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号