1SUMMARY = "Compiles a set of authorized_keys files into a single file"
2PR = "r1"
3LICENSE = "Apache-2.0"
4LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
5
6inherit systemd
7
8SRC_URI += " \
9  file://authorized-keys-comp.service \
10  file://authorized-keys-comp.sh \
11  "
12
13S = "${WORKDIR}/sources"
14UNPACKDIR = "${S}"
15
16RDEPENDS:${PN} += "bash"
17
18SYSTEMD_SERVICE:${PN} += "authorized-keys-comp.service"
19
20FILES:${PN} += "/home"
21
22AUTHORIZED_KEYS_COMP_USERS ?= "root"
23
24do_install:append() {
25  install -d -m0755 ${D}${libexecdir}
26  install -m0755 authorized-keys-comp.sh ${D}${libexecdir}/
27
28  install -d -m0755 ${D}${systemd_system_unitdir}
29  install -m0644 authorized-keys-comp.service ${D}${systemd_system_unitdir}/
30
31  for user in ${AUTHORIZED_KEYS_COMP_USERS}; do
32    install -d -m0755 ${D}/home/$user/.ssh
33    ln -sv /run/authorized_keys/$user ${D}/home/$user/.ssh/authorized_keys
34  done
35}
36