We have a number of hand-built (with fpm and jenkins) .deb files in a local Apt repository (reprepro). These .debs contain a .desktop file that will be picked up by xdg-desktop in a post-inst script.
If we install the deb file by hand, on a new system, everything is fine.
If we install a new version with apt-get install, we get this error
xdg-desktop-menu: file '/usr/local/share/applications/customthingy.desktop' does not exist
If I download the deb file with apt-get install -d customthingy, and run
dpkg -i /var/cache/apt/archives/customthingy_2-r3_all.deb
I get the same, xdg-desktop
error as before. So that rules out a problem with apt.
If I list the contents of the downloaded 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
You can see the file exists.
However.. If we purge before reinstalling,
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 ...
And then
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) ...
EDIT: Contents of Postinst script
#!/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
There's no error. So.. The questions are these:
- Is this expected behavior, or a bug in apt/dpkg?
- Do we have a malformed package with customthingy.deb that is preventing a future reinstall run from working?
- Is it safe to assume that post-inst will always happen at the very end of installation, and we can safely assume that all files will have been extracted before this point in time?
- Are we doing something massively weird?