I wanted to find a solution using DBUS from the application but apparently I do not have the expertise to work with the torizoncore builder to modify the policy files. Tried for about a week.
Instead I took the following approach:
- create a script that runs in the background for checking a shutdown signal file, if the file is found, the script executes
dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.PowerOff" boolean:true
from a bash shell. apparently if this message is sent from a bash shell, it is sent as root. if sent from the application, it is sent as user id 1000.
- modify the dockerfile.debug to execute the shutdown-script and the CMD [ “/usr/sbin/sshd”, “-D” ] from a startup script.
Everything works as expected.
Further Questions:
-
I am sharing the ~/appdata folder from host with the container from the compose file. I have to manually set the permissions of the forder using chmod -R 777 /home/torizon/appdata to be able to write to it from the app (the container bash works fine without modifying permissions). even if i use the :rw tag in the compose file. My question is: would I have to deal with torizoncore builder to create/set permissions for this folder when it is to be production ready?
-
So far, I understand I need to deal with torizoncore builder to setup ota related docker settings for a private repository, auto starting of the container when powered on. Are there any video/animated tutorials for a novice like me on the lines of a post by @matheus.tx : ApolloX TorizonCore Builder project template support for 'tcb bundle' - #3 by matheus.castello