Tom Joseph | dcdc8ea | 2017-02-01 19:47:27 +0530 | [diff] [blame] | 1 | # Common code for recipes that create IPMI provider libraries |
| 2 | |
| 3 | LIBDIR = "${D}/${libdir}/ipmid-providers/" |
| 4 | HOSTIPMI_LIBDIR = "${D}/${libdir}/host-ipmid/" |
| 5 | NETIPMI_LIBDIR = "${D}/${libdir}/net-ipmid/" |
| 6 | |
| 7 | python symlink_create_postinstall() { |
| 8 | def install_symlink(d, libname, install_dir): |
| 9 | import glob; |
| 10 | |
| 11 | if not os.path.exists(install_dir): |
| 12 | os.makedirs(install_dir) |
| 13 | |
| 14 | lib_dir = d.getVar('LIBDIR', True) |
| 15 | |
| 16 | # find the library extension libxxx.so.? |
| 17 | install_file = lib_dir + libname + ".?" |
| 18 | |
| 19 | filelist = glob.glob(install_file); |
| 20 | |
| 21 | # get the library name |
| 22 | path, file = os.path.split(filelist[0]) |
Tom Joseph | dcdc8ea | 2017-02-01 19:47:27 +0530 | [diff] [blame] | 23 | source = "../ipmid-providers/" + file |
| 24 | |
| 25 | # create the symlink |
Brad Bishop | 66f1f9f | 2018-02-14 22:24:55 -0500 | [diff] [blame] | 26 | os.symlink(source, os.path.join(install_dir, file)) |
Tom Joseph | dcdc8ea | 2017-02-01 19:47:27 +0530 | [diff] [blame] | 27 | |
| 28 | for libname in listvar_to_list(d, 'HOSTIPMI_PROVIDER_LIBRARY'): |
| 29 | install_dir = d.getVar('HOSTIPMI_LIBDIR', True) |
| 30 | install_symlink(d, libname, install_dir) |
| 31 | |
| 32 | for libname in listvar_to_list(d, 'NETIPMI_PROVIDER_LIBRARY'): |
| 33 | install_dir = d.getVar('NETIPMI_LIBDIR', True) |
| 34 | install_symlink(d, libname, install_dir) |
| 35 | } |
Brad Bishop | 8e5d45b | 2018-02-14 22:24:02 -0500 | [diff] [blame] | 36 | do_install[postfuncs] += "symlink_create_postinstall" |