Skip to contentSkip to conversation

user service autostart

yocto Joel Winarske 1 participant 1 message Jul 29, 2022 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

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
}

Quoted 32 lines · Joel Winarske via lists.yoctoproject.org

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 (#57679):
https://lists.yoctoproject.org/g/yocto/message/57679
Mute This Topic: https://lists.yoctoproject.org/mt/92684003/2167248
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-