我们在本地Apt存储库(reprepro)中有许多手工构建(带有fpm和jenkins)的.deb文件。这些.deb包含一个.desktop文件,该文件将由xdg-desktop在安装后脚本中拾取。
如果我们手动在新系统上安装deb文件,则一切正常。
如果我们使用apt-get install安装新版本,则会出现此错误
xdg-desktop-menu: file '/usr/local/share/applications/customthingy.desktop' does not exist
如果我使用apt-get install -d customthingy下载deb文件,然后运行
dpkg -i /var/cache/apt/archives/customthingy_2-r3_all.deb
我得到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
您可以看到该文件存在。
但是..如果在重新安装之前清除,
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 ...
然后
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) ...
编辑: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
没有错 所以..问题是这些:
- 这是预期的行为,还是apt / dpkg中的错误?
- 我们是否具有customthingy.deb的格式错误的软件包,导致以后无法进行重新安装?
- 是否可以安全地假定后插入总是在安装结束时发生,并且我们可以安全地假定所有文件都将在此时间点之前被提取出来?
- 我们正在做一些奇怪的事情吗?
postinst
吗?
dpkg -D101 -i <package>
(或什至dpkg -D1101
)是否产生任何不同的结果?它可能会抛出不同的执行顺序。