summaryrefslogtreecommitdiff
path: root/meta-unit-core/dynamic-layers/virtualization-layer/recipes-users/useradd/add-user-unitexe.bbappend
blob: 5fab9f033b9bf8d4f95e3fc610ef9aedd94a311c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
do_install:append() {
    # If linger is not enabled then rootless podman 
    # commands will complain with number of warnings.
    # Enabling linger does two effects for systemd user units:
    #   1. Units are automatically started after a reboot
    #   2. Units are not automatically stopped after a log out
    install -d ${D}${localstatedir}/lib/systemd/linger
    touch ${D}${localstatedir}/lib/systemd/linger/${USER_TO_ADD_NAME}

    # Note: Use of .profile here assumes busybox shell.
    # Podman uses these (if defined) for overriding
    # default configuration file locations. This is
    # explained here:
    #   https://github.com/containers/podman/blob/main/docs/tutorials/rootless_tutorial.md#user-configuration-files
    cat > ${D}/home/${USER_TO_ADD_NAME}/.profile << 'EOF'
export XDG_RUNTIME_DIR=/run/user/$(id -u)
export XDG_CONFIG_HOME=$HOME/.config
EOF
}

FILES:${PN}:append = " ${localstatedir}/lib/systemd/linger/${USER_TO_ADD_NAME}"