Tom Joseph | 1562bbc | 2017-02-20 12:01:43 +0530 | [diff] [blame] | 1 | # Common code for recipes that implement Phosphor IPMI Whitelist |
| 2 | # packages |
| 3 | |
| 4 | WHITELIST ?= "${PN}.conf" |
Patrick Williams | 43b61b7 | 2017-02-24 13:04:06 -0600 | [diff] [blame] | 5 | INSTALLDIR = "${D}${datadir}/phosphor-ipmi-host/" |
Tom Joseph | 1562bbc | 2017-02-20 12:01:43 +0530 | [diff] [blame] | 6 | |
| 7 | python phosphor_ipmi_host_whitelist_postinstall() { |
| 8 | def install_whitelist(d): |
| 9 | # Create the install directory if needed |
| 10 | whitelist_file = d.getVar('WHITELIST', True) |
| 11 | install_dir = d.getVar('INSTALLDIR', True) |
| 12 | if not os.path.exists(install_dir): |
| 13 | os.makedirs(install_dir) |
| 14 | install_file = os.path.join(install_dir, whitelist_file) |
| 15 | |
| 16 | # Search for conf file in FILESPATH |
| 17 | searchpaths = d.getVar('FILESPATH', True) |
| 18 | path = bb.utils.which(searchpaths, whitelist_file) |
| 19 | if not os.path.isfile(path): |
| 20 | bb.fatal('Did not find conf file "%s"' % whitelist_file) |
| 21 | |
| 22 | # Copy the conf file into install directory |
| 23 | bb.utils.copyfile(path, install_file) |
| 24 | |
| 25 | install_whitelist(d) |
| 26 | } |
Patrick Williams | 43b61b7 | 2017-02-24 13:04:06 -0600 | [diff] [blame] | 27 | do_install[postfuncs] += "phosphor_ipmi_host_whitelist_postinstall" |