blob: ef0379286f903493c734fa9880826aed8b7568f9 [file] [log] [blame]
William A. Kennington III920f3c02021-03-31 03:16:39 -07001SUMMARY = "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
Willy Tu4dd03ca2021-08-06 09:37:35 -070015RDEPENDS:${PN} += "bash"
William A. Kennington III920f3c02021-03-31 03:16:39 -070016
Willy Tu4dd03ca2021-08-06 09:37:35 -070017SYSTEMD_SERVICE:${PN} += "authorized-keys-comp.service"
William A. Kennington III920f3c02021-03-31 03:16:39 -070018
Willy Tu4dd03ca2021-08-06 09:37:35 -070019FILES:${PN} += "/home"
William A. Kennington III920f3c02021-03-31 03:16:39 -070020
21AUTHORIZED_KEYS_COMP_USERS ?= "root"
22
Willy Tu4dd03ca2021-08-06 09:37:35 -070023do_install:append() {
William A. Kennington III920f3c02021-03-31 03:16:39 -070024 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}