Richard Marian Thomaiyar | 14fddef | 2018-07-13 23:55:56 +0530 | [diff] [blame] | 1 | SUMMARY = "SWTPM - OpenEmbedded wrapper scripts for native swtpm tools" |
| 2 | LICENSE = "MIT" |
Patrick Williams | 53961c2 | 2022-01-20 11:06:23 -0600 | [diff] [blame] | 3 | DEPENDS = "swtpm-native" |
Richard Marian Thomaiyar | 14fddef | 2018-07-13 23:55:56 +0530 | [diff] [blame] | 4 | |
| 5 | inherit 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... |
| 9 | RM_WORK_EXCLUDE += "${PN}" |
| 10 | |
| 11 | do_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 Williams | 53961c2 | 2022-01-20 11:06:23 -0600 | [diff] [blame] | 17 | swtpm_setup) |
Richard Marian Thomaiyar | 14fddef | 2018-07-13 23:55:56 +0530 | [diff] [blame] | 18 | cat >${WORKDIR}/swtpm_setup_oe.sh <<EOF |
| 19 | #! /bin/sh |
| 20 | # |
Patrick Williams | 53961c2 | 2022-01-20 11:06:23 -0600 | [diff] [blame] | 21 | # Wrapper around swtpm_setup which adds parameters required to |
Richard Marian Thomaiyar | 14fddef | 2018-07-13 23:55:56 +0530 | [diff] [blame] | 22 | # run the setup as non-root directly from the native sysroot. |
| 23 | |
| 24 | PATH="${bindir}:${base_bindir}:${sbindir}:${base_sbindir}:\$PATH" |
| 25 | export PATH |
| 26 | |
Patrick Williams | 53961c2 | 2022-01-20 11:06:23 -0600 | [diff] [blame] | 27 | exec swtpm_setup --config ${STAGING_DIR_NATIVE}/etc/swtpm_setup.conf "\$@" |
Richard Marian Thomaiyar | 14fddef | 2018-07-13 23:55:56 +0530 | [diff] [blame] | 28 | EOF |
| 29 | ;; |
Richard Marian Thomaiyar | 14fddef | 2018-07-13 23:55:56 +0530 | [diff] [blame] | 30 | *) |
| 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 | |
| 37 | PATH="${bindir}:${base_bindir}:${sbindir}:${base_sbindir}:\$PATH" |
| 38 | export PATH |
| 39 | |
| 40 | exec ${exe} "\$@" |
| 41 | EOF |
| 42 | ;; |
| 43 | esac |
| 44 | done |
| 45 | |
| 46 | chmod a+rx ${WORKDIR}/*.sh |
| 47 | } |
| 48 | |
| 49 | addtask do_create_wrapper before do_build after do_prepare_recipe_sysroot |