I'm working on a embedded Yocto Linux project that runs QT applications.
Here are my requirements:
I need to deploy binaries and all of their systemd units as well as a custom target for some of those units.
I need to simlink some of those units as wants for other already installed targets on the OS.
I need to set the default.target as a newly deployed target.
Maybe do a systemctl daemon-reload.
Currently I have something working but it's very much coupled between OS build and QT build systems and I was hoping to have more separation. QT deploys to correct folder however the simlinking is done by a bash script that's part of OS and bitbake starts it as part of OPKG postinst instructions.
Qmake code for handling systemd units:
TEMPLATE = aux
UNIT_FILES += \
./Targets/main.target \
./Targets/additional.target \
./Units/unit1.service \
./Units/unit2.service \
./Units/additional.service \
./Units/neededByOSTarget.service
boot2qt: {
deploy_unit.files = $$unit.files
deploy_unit.path = /usr/lib/systemd/system
INSTALLS += deploy_unit
}
OTHER_FILES = $$UNIT_FILES
Bitbake code for installing and enabling
pkg_postinst_${PN} () {
# Simlink systemd units
${PKG_ROOT}/usr/bin/autoInstallHandler.sh -i ${PKG_ROOT}
# Change the default target
ln -sf /lib/systemd/system/main.target ${PKG_ROOT}/etc/systemd/system/default.target
/bin/systemctl daemon-reload
/bin/systemctl start default.target &
autoInstallHandler.sh simply simlinks all of the units to proper locations
My question is can QT have something like what's in postinst? If not is there a better approach for this that maybe utilizes a different method?