deb 打包技巧 软件安装完成后显示用户手册【更新】
Tofloor
poster avatar
jzc
deepin
2020-07-05 22:22
Author
本帖最后由 jzc 于 2020-7-6 10:32 编辑

有时安装软件后需要告诉用户如何使用这个软件。
一个简单的方法是:在 postinst 中调用 deepin-editor 打开软件文档(用户手册)。


但是,deepin软件安装器在安装软件时调用dpkg,环境变量没有正确设置导致无法在 postinst 中直接运行GUI程序,这不是BUG,而是设计如此。


解决方案如下: postinst 中加载桌面用户 .xAuthority 文件,设置DISPLAY环境变量。然后就可以调用GUI程序了。
在DEBIAN文件夹 postinst 文件中加入:

#!/bin/bash


export DISPLAY=:0
export XAUTHORITY=/home/`id -un 1000`/.Xauthority
sudo -u `id -un 1000` deepin-editor /opt/xxx-ext4/readme.txt


exit 0



Reply Favorite View the author
Comments
poster avatar
shenmo
2020-07-06 03:16
非常感谢,收下了~
All Replies
avatar
jzc
deepin
2020-07-05 22:23
#1
Reply View the author
avatar
jzc
deepin
2020-07-05 22:24
#2
社区商店维护团队可以看看,这是很实用的一个技巧
Reply View the author
avatar
Maicss
deepin
2020-07-06 00:09
#3
非常感谢!
Reply View the author
avatar
神末shenmo
deepin
Spark-App
Q&A Team
2020-07-06 03:16
#4
https://bbs.deepin.org/post/196746
社区商店维护团队可以看看,这是很实用的一个技巧

我们用的好像是apt吧https://bbs.deepin.org/user/90159
Reply View the author
avatar
jzc
deepin
2020-07-06 05:56
#5
https://bbs.deepin.org/post/196746
我们用的好像是apt吧@maicss

这个方案兼容性很好,dpkg  apt 都可以用。
Reply View the author
avatar
神末shenmo
deepin
Spark-App
Q&A Team
2022-10-20 01:38
#6

非常感谢,采用了

Reply View the author