Like maybe simply:
systemd_postinst_ontarget () {
if [ "${SYSTEMD_AUTO_ENABLE}" = "enable" ]; then
for service in ${FLUTTER_USER_SERVICE_ESCAPED}; do
su <desired user>
systemctl --user enable "$service"
systemctl --user start "$service"
done
fi
}
On Thu, Jul 28, 2022 at 8:00 PM Joel Winarske via lists.yoctoproject.org
<[email protected]> wrote:
> How does one enable a user service for a specific user at postinst?
>
> User service in question is located in ${system_user_unitdir}.
>
> Seems the problem is related to determining what user, which makes sense
> why this combo is not allowed: "systemctl --user --root=..."
>
> I'm figuring this run as root? Is there a way to have it run for a
> specific user?
> systemd_postinst_ontarget () {
> if [ "${SYSTEMD_AUTO_ENABLE}" = "enable" ]; then
> for service in ${FLUTTER_USER_SERVICE_ESCAPED}; do
> systemctl --user enable "$service"
> systemctl --user start "$service"
> done
> fi
> }
>
> Thanks,
> Joel
>
>
>
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#57680): https://lists.yoctoproject.org/g/yocto/message/57680
Mute This Topic: https://lists.yoctoproject.org/mt/92684003/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-