Another half a day spent on figuring out how to package my daemon properly, fortunately with help from friends over at #harmattan IRC channel as well as cckwes, I finally get the deb package generated properly. So just a quick reminder on what my daemon does, it is just a quick hack that toggles the ‘allow background connections’ on and off depending which kind of data network a user is connected to. Apparently I am not the only one who are looking for this, as a feature request was filed long long time ago.
Preparing an Upstart Configuration File
After spending much time reading through the Upstart Cookbook and a brief explanation on how to develop a daemon for harmattan, all I could vomit was (reads: still need time to actually understand the whole document):
author "Choon-Siang Lai
description "My workaround for enhancement
exec /usr/bin/aegis-exec -s -u user /opt/restricted-mode-toggler/bin/control.py start
Just a quick note on the execution at startup, it would typically take minutes before the daemon is executed after the GUI is started. Not sure why this is, but don’t worry if the daemon is not executed right after startup, it takes time. 🙂
Packaging using Qt Creator under OS X
The reason why OS X is mentioned is because apparently the package building process is bugged. To fix the problem, edit dh_installdeb located at $QtSdkRoot/Madde/madbin according to the comments to the above mentioned bug report.
To make sure Qt Creator is building the package properly, I was told to add a line at the top of the .pro file as I am building a package that consists only python scripts.
TEMPLATE = lib
TL;DR The Final Product
The final product of my daemon can be downloaded here. Currently it is set to update the setting every 60-65 seconds. A GUI may probably be done if I feel like doing it. 🙂
Please note that I provide no support or whatsoever to the script and hold no responsibility if it kills your phone. I didn’t have time to add in dependency check in it, in order to run this properly, you need python-gconf, python-pyside and python-qtmobility installed. For instructions on how to enable the developer repository, read this wiki for more information.