Configuring Wine Application Packages for Autostart and Desktop Shortcuts

Background

Current Wine packaging tools can succesfully generate .deb files for installation and use, but lack built-in support for configuring autostart functionality.

Implementation Process

After investigating Wine packaging tools, the initial approach involved modifying the generated .deb file post-creation. The process includes:

  1. Genertaing the initial .deb package
  2. Extracting and modifying package contents
  3. Repackaging with updated configurations

Solution Architecture

The modified .deb package structure includes DEBIAN directory with hook scripts:

preinst Script (Pre-installation)

#!/bin/bash
echo 'Preparing to install <application_name>'
# Pre-installation commands here

postinst Script (Post-installation)

#!/bin/bash
# Configure autostart
cp /path/to/desktop_file.desktop /etc/xdg/autostart/

# Update desktop database
update-desktop-database /usr/share/applications || true

# Handle desktop shortcuts
username=`getent passwd \`who\` | head -n 1 | cut -d : -f 1`
if [ -d "/home/${username}/Desktop" ]; then
    cp /path/to/desktop_file.desktop /home/${username}/Desktop
else
    cp /path/to/desktop_file.desktop /home/${username}/桌面
fi

prerm Script (Pre-uninstallation)

#!/bin/bash
echo 'Preparing to uninstall <application_name>'
# Pre-uninstallation commands here

postrm Script (Post-uninstallation)

#!/bin/bash
# Cleanup commands
rm -rf /path/to/created/symlinks
echo '<application_name> has been uninstalled'

Packaging Command

dpkg-deb -b . <package_name>.deb

Troubleshooting

Error: Invalid permissions for control directory (777)

Solution: Set correct permissions for DEBIAN directory

chmod 755 -R '/path/to/package/DEBIAN'

Tags: wine deb-package autostart desktop-shortcuts linux-packaging

Posted on Mon, 27 Jul 2026 16:56:41 +0000 by hollyspringer