jeffrey0606 / flutter_to_debian

A simple command-line application to help you easily bundle your flutter app build into a debian package ready for production.
MIT License
38 stars 11 forks source link

Symlink support #22

Closed tmpfs closed 7 months ago

tmpfs commented 1 year ago

Hi,

Thanks for the package, it's working quite well so far but I would like to get the final executable into PATH, looking at the code I can't see any easy way to do this as the final executable path after install is:

<parent>/<package>/<command>

Is there a way to add a symbolic link in say /usr/local/bin to the installed executable. I tried using debian/package.links (described in man dh_links) but it doesn't appear to work.

Any pointers much appreciated, thanks!

ynyBonfennil commented 7 months ago

Since current flutter_to_debian supports postinst and prerm, I could successfully create and remove a symlink to /usr/bin when installing and uninstalling the debian package.

For example, write postinst like

#!/bin/sh
ln -s /usr/local/lib/mega-cool-app/mega_cool_app /usr/bin/mega-cool-app

and prerm like

#!/bin/sh
rm -f /usr/bin/mega-cool-app

and store them in debian/scripts. These files will be packed and executed when installing and uninstalling a debian package.

In addition, I changed the permission of them to 755 (chmod 755 postinst and chmod 755 prerm) because in my case the default permission was 664 and it could not be packed in debian package.

tmpfs commented 7 months ago

Thanks for the pointer @ynyBonfennil, I had already done the postinst script but it was a good reminder to add the pre-removal script!