William A. Kennington III | 920f3c0 | 2021-03-31 03:16:39 -0700 | [diff] [blame] | 1 | SUMMARY = "Compiles a set of authorized_keys files into a single file" |
| 2 | PR = "r1" |
| 3 | LICENSE = "Apache-2.0" |
| 4 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" |
| 5 | |
| 6 | inherit systemd |
| 7 | |
| 8 | SRC_URI += " \ |
| 9 | file://authorized-keys-comp.service \ |
| 10 | file://authorized-keys-comp.sh \ |
| 11 | " |
| 12 | |
| 13 | S = "${WORKDIR}" |
| 14 | |
| 15 | RDEPENDS_${PN} += "bash" |
| 16 | |
| 17 | SYSTEMD_SERVICE_${PN} += "authorized-keys-comp.service" |
| 18 | |
| 19 | FILES_${PN} += "/home" |
| 20 | |
| 21 | AUTHORIZED_KEYS_COMP_USERS ?= "root" |
| 22 | |
| 23 | do_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 | } |