Tom*_*nor 8 package-management dpkg apt
我们在本地 Apt 存储库 (reprepro) 中有许多手工构建的(使用 fpm 和 jenkins).deb 文件。这些 .debs 包含一个 .desktop 文件,该文件将由 xdg-desktop 在 post-inst 脚本中获取。
如果我们手动安装 deb 文件,在新系统上,一切正常。
如果我们使用 apt-get install 安装新版本,则会收到此错误
xdg-desktop-menu: file '/usr/local/share/applications/customthingy.desktop' does not exist
Run Code Online (Sandbox Code Playgroud)
如果我使用 apt-get install -d customthingy 下载 deb 文件,然后运行
dpkg -i /var/cache/apt/archives/customthingy_2-r3_all.deb
Run Code Online (Sandbox Code Playgroud)
我得到了xdg-desktop
和以前一样的错误。所以这排除了apt的问题。
如果我列出下载的 deb 的内容,
tom.oconnor@charcoal-black:~$ dpkg --contents /var/cache/apt/archives/customthingy_2-r3_all.deb |grep ".desktop"
-rw-r--r-- root/root 201 2011-07-28 20:02 ./usr/local/share/applications/customthingy.desktop
Run Code Online (Sandbox Code Playgroud)
可以看到文件存在。
但是..如果我们在重新安装之前清除,
tom.oconnor@charcoal-black:~$ sudo apt-get purge customthingy
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED
customthingy*
0 upgraded, 0 newly installed, 1 to remove and 84 not upgraded.
After this operation, 0B of additional disk space will be used.
Do you want to continue [Y/n]? y
(Reading database ... 219342 files and directories currently installed.)
Removing customthingy ...
Purging configuration files for customthingy ...
Run Code Online (Sandbox Code Playgroud)
进而
tom.oconnor@charcoal-black:~$ sudo apt-get install customthingy
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed
customthingy
0 upgraded, 1 newly installed, 0 to remove and 84 not upgraded.
Need to get 0B/4,030B of archives.
After this operation, 0B of additional disk space will be used.
Selecting previously deselected package customthingy.
(Reading database ... 219319 files and directories currently installed.)
Unpacking customthingy (from .../customthingy_2-r3_all.deb) ...
Setting up customthingy (2-r3) ...
Run Code Online (Sandbox Code Playgroud)
编辑:Postinst 脚本的内容
#!/bin/sh
# Add an entry to the system menu
XDG_DESKTOP_MENU="`which xdg-desktop-menu 2> /dev/null`"
if [ ! -x "$XDG_DESKTOP_MENU" ]; then
echo "WARNING: Could not find xdg-desktop-menu" >&2
else
"$XDG_DESKTOP_MENU" install --mode system /usr/local/share/applications/customthingy.desktop
"$XDG_DESKTOP_MENU" forceupdate --mode system
fi
Run Code Online (Sandbox Code Playgroud)
没有错误。所以..问题是:
我猜您postinst
正在调用xdg-desktop-menu
将桌面文件移入/usr/share/applications
并更新 XDG 桌面数据库。这是由例如完成的google-chrome-stable
,但我无法理解为什么(继续阅读)
如果您直接将桌面文件安装到/usr/share/applications
(通过 dpkg \xe2\x80\x94 ,即通过例如将文件放在那里dh_install
,这样 中的路径.deb
就是/usr/share/applications
),许多软件包将自动“触发”更新:值得注意的gnome-menus
是 和desktop-file-utils
,但也许还有其他(取决于精确的目标操作系统版本等)
至少就我而言,这些足以实现xdg-desktop-menu
手动运行的功能(程序立即显示在我的用户菜单中)
我仍然不知道为什么google-chrome-stable
和其他(主要是第 3 方).deb
将桌面文件发送到其他/usr/share/applications
地方(在 chrome 的情况下/opt
),然后手动移动它。
归档时间: |
|
查看次数: |
1256 次 |
最近记录: |