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 | |
Willy Tu | 4dd03ca | 2021-08-06 09:37:35 -0700 | [diff] [blame] | 15 | RDEPENDS:${PN} += "bash" |
William A. Kennington III | 920f3c0 | 2021-03-31 03:16:39 -0700 | [diff] [blame] | 16 | |
Willy Tu | 4dd03ca | 2021-08-06 09:37:35 -0700 | [diff] [blame] | 17 | SYSTEMD_SERVICE:${PN} += "authorized-keys-comp.service" |
William A. Kennington III | 920f3c0 | 2021-03-31 03:16:39 -0700 | [diff] [blame] | 18 | |
Willy Tu | 4dd03ca | 2021-08-06 09:37:35 -0700 | [diff] [blame] | 19 | FILES:${PN} += "/home" |
William A. Kennington III | 920f3c0 | 2021-03-31 03:16:39 -0700 | [diff] [blame] | 20 | |
| 21 | AUTHORIZED_KEYS_COMP_USERS ?= "root" |
| 22 | |
Willy Tu | 4dd03ca | 2021-08-06 09:37:35 -0700 | [diff] [blame] | 23 | do_install:append() { |
William A. Kennington III | 920f3c0 | 2021-03-31 03:16:39 -0700 | [diff] [blame] | 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 | } |