blob: bb93374fa2246edc5cadaa5a5a8e1db3b0838b37 [file] [log] [blame]
Richard Marian Thomaiyar14fddef2018-07-13 23:55:56 +05301SUMMARY = "SWTPM - OpenEmbedded wrapper scripts for native swtpm tools"
2LICENSE = "MIT"
Patrick Williams53961c22022-01-20 11:06:23 -06003DEPENDS = "swtpm-native"
Richard Marian Thomaiyar14fddef2018-07-13 23:55:56 +05304
5inherit native
6
7# The whole point of the recipe is to make files available
8# for use after the build is done, so don't clean up...
9RM_WORK_EXCLUDE += "${PN}"
10
11do_create_wrapper () {
12 # Wrap (almost) all swtpm binaries. Some get special wrappers and some
13 # are not needed.
14 for i in `find ${bindir} ${base_bindir} ${sbindir} ${base_sbindir} -name 'swtpm*' -perm /+x -type f`; do
15 exe=`basename $i`
16 case $exe in
Patrick Williams53961c22022-01-20 11:06:23 -060017 swtpm_setup)
Richard Marian Thomaiyar14fddef2018-07-13 23:55:56 +053018 cat >${WORKDIR}/swtpm_setup_oe.sh <<EOF
19#! /bin/sh
20#
Patrick Williams53961c22022-01-20 11:06:23 -060021# Wrapper around swtpm_setup which adds parameters required to
Richard Marian Thomaiyar14fddef2018-07-13 23:55:56 +053022# run the setup as non-root directly from the native sysroot.
23
24PATH="${bindir}:${base_bindir}:${sbindir}:${base_sbindir}:\$PATH"
25export PATH
26
Patrick Williams53961c22022-01-20 11:06:23 -060027exec swtpm_setup --config ${STAGING_DIR_NATIVE}/etc/swtpm_setup.conf "\$@"
Richard Marian Thomaiyar14fddef2018-07-13 23:55:56 +053028EOF
29 ;;
Richard Marian Thomaiyar14fddef2018-07-13 23:55:56 +053030 *)
31 cat >${WORKDIR}/${exe}_oe.sh <<EOF
32#! /bin/sh
33#
34# Wrapper around $exe which makes it easier to invoke
35# the right binary.
36
37PATH="${bindir}:${base_bindir}:${sbindir}:${base_sbindir}:\$PATH"
38export PATH
39
40exec ${exe} "\$@"
41EOF
42 ;;
43 esac
44 done
45
46 chmod a+rx ${WORKDIR}/*.sh
47}
48
49addtask do_create_wrapper before do_build after do_prepare_recipe_sysroot