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}"
14
15RDEPENDS:${PN} += "bash"
16
17SYSTEMD_SERVICE:${PN} += "authorized-keys-comp.service"
18
19FILES:${PN} += "/home"
20
21AUTHORIZED_KEYS_COMP_USERS ?= "root"
22
23do_install:append() {
24  install -d -m0755 ${D}${libexecdir}
25  install -m0755 authorized-keys-comp.sh ${D}${libexecdir}/
26
27  install -d -m0755 ${D}${systemd_system_unitdir}
28  install -m0644 authorized-keys-comp.service ${D}${systemd_system_unitdir}/
29
30  for user in ${AUTHORIZED_KEYS_COMP_USERS}; do
31    install -d -m0755 ${D}/home/$user/.ssh
32    ln -sv /run/authorized_keys/$user ${D}/home/$user/.ssh/authorized_keys
33  done
34}
35