summaryrefslogtreecommitdiff
path: root/meta-google/recipes-google/ssh/authorized-keys-comp.bb
blob: 81ee868a8781fc366ceeae605174c3eec9e23dae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
SUMMARY = "Compiles a set of authorized_keys files into a single file"
PR = "r1"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"

inherit systemd

SRC_URI += " \
  file://authorized-keys-comp.service \
  file://authorized-keys-comp.sh \
  "

S = "${WORKDIR}"

RDEPENDS_${PN} += "bash"

SYSTEMD_SERVICE_${PN} += "authorized-keys-comp.service"

FILES_${PN} += "/home"

AUTHORIZED_KEYS_COMP_USERS ?= "root"

do_install_append() {
  install -d -m0755 ${D}${libexecdir}
  install -m0755 authorized-keys-comp.sh ${D}${libexecdir}/

  install -d -m0755 ${D}${systemd_system_unitdir}
  install -m0644 authorized-keys-comp.service ${D}${systemd_system_unitdir}/

  for user in ${AUTHORIZED_KEYS_COMP_USERS}; do
    install -d -m0755 ${D}/home/$user/.ssh
    ln -sv /run/authorized_keys/$user ${D}/home/$user/.ssh/authorized_keys
  done
}