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]) |
| 23 | os.chdir(install_dir) |
| 24 | source = "../ipmid-providers/" + file |
| 25 | |
| 26 | # create the symlink |
| 27 | os.symlink(source, file) |
| 28 | |
| 29 | for libname in listvar_to_list(d, 'HOSTIPMI_PROVIDER_LIBRARY'): |
| 30 | install_dir = d.getVar('HOSTIPMI_LIBDIR', True) |
| 31 | install_symlink(d, libname, install_dir) |
| 32 | |
| 33 | for libname in listvar_to_list(d, 'NETIPMI_PROVIDER_LIBRARY'): |
| 34 | install_dir = d.getVar('NETIPMI_LIBDIR', True) |
| 35 | install_symlink(d, libname, install_dir) |
| 36 | } |
| 37 | do_install[postfuncs] += "symlink_create_postinstall" |