16d57a889SPotin LaiFILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
26d57a889SPotin Lai
36d57a889SPotin Laiinherit obmc-phosphor-systemd
46d57a889SPotin Lai
56d57a889SPotin Lai# Add service file link
66d57a889SPotin LaiTMPL_PRESENT = "phosphor-gpio-presence@.service"
76d57a889SPotin LaiINSTFMT_PRESENT = "phosphor-gpio-presence@presence-sled{0}.service"
86d57a889SPotin LaiPRESENT_TGT = "multi-user.target"
96d57a889SPotin LaiFMT_PRESENT = "../${TMPL_PRESENT}:${PRESENT_TGT}.requires/${INSTFMT_PRESENT}"
10*a2fb20c3SPatrick WilliamsSYSTEMD_LINK:${PN}-presence:append = " ${@compose_list(d, 'FMT_PRESENT', 'OBMC_HOST_INSTANCES')}"
116d57a889SPotin Lai
126d57a889SPotin Lai# Add environment file
136d57a889SPotin LaiSLED_PRESENT_ENV_FMT = "obmc/gpio/presence-sled{0}.conf"
14*a2fb20c3SPatrick WilliamsSYSTEMD_ENVIRONMENT_FILE:${PN}-presence = " ${@compose_list(d, 'SLED_PRESENT_ENV_FMT', 'OBMC_HOST_INSTANCES')}"
156d57a889SPotin Lai
166d57a889SPotin LaiGPIO_PRESENCE_SLED_CONF="/etc/default/obmc/gpio/%i.conf"
176d57a889SPotin Lai
18*a2fb20c3SPatrick Williamsdo_install:append(){
196d57a889SPotin Lai    # modify ConditionPathExists and EnvironmentFile to correct filepath
206d57a889SPotin Lai    sed -i -e "s,ConditionPathExists=.*,ConditionPathExists=${GPIO_PRESENCE_SLED_CONF},g" ${D}${systemd_system_unitdir}/phosphor-gpio-presence@.service
216d57a889SPotin Lai    sed -i -e "s,EnvironmentFile=.*,EnvironmentFile=${GPIO_PRESENCE_SLED_CONF},g" ${D}${systemd_system_unitdir}/phosphor-gpio-presence@.service
226d57a889SPotin Lai}
23