swupdate.inc 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. SUMMARY="Image updater for Yocto projects"
  2. DESCRIPTION = "Application for automatic software update from USB Pen"
  3. SECTION="swupdate"
  4. DEPENDS = "libconfig openssl gnutls"
  5. LICENSE = "GPLv2+"
  6. LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3"
  7. inherit cml1 update-rc.d systemd
  8. SRC_URI = "git://github.com/sbabic/swupdate.git;protocol=git \
  9. file://defconfig \
  10. file://swupdate \
  11. file://swupdate.service \
  12. "
  13. SRCREV = "${AUTOREV}"
  14. INSANE_SKIP_${PN} = "ldflags"
  15. PACKAGES =+ "${PN}-www"
  16. FILES_${PN}-www = "/www/*"
  17. FILES_${PN}-dev = "${includedir}"
  18. FILES_${PN}-staticdev = "${libdir}"
  19. FILES_${PN} = "${bindir}/* /etc"
  20. S = "${WORKDIR}/git/"
  21. EXTRA_OEMAKE += "V=1 ARCH=${TARGET_ARCH} CROSS_COMPILE=${TARGET_PREFIX} SKIP_STRIP=y"
  22. python () {
  23. try:
  24. defconfig = bb.fetch2.localpath('file://defconfig', d)
  25. except bb.fetch2.FetchError:
  26. return
  27. try:
  28. configfile = open(defconfig)
  29. except IOError:
  30. return
  31. features = configfile.readlines()
  32. configfile.close()
  33. if 'CONFIG_REMOTE_HANDLER=y\n' in features:
  34. depends = d.getVar('DEPENDS', False)
  35. d.setVar('DEPENDS', depends + ' zeromq')
  36. if 'CONFIG_JSON=y\n' in features:
  37. depends = d.getVar('DEPENDS', False)
  38. d.setVar('DEPENDS', depends + ' json-c')
  39. if 'CONFIG_ARCHIVE=y\n' in features:
  40. depends = d.getVar('DEPENDS', False)
  41. d.setVar('DEPENDS', depends + ' libarchive')
  42. if 'CONFIG_LUA=y\n' in features:
  43. depends = d.getVar('DEPENDS', False)
  44. d.setVar('DEPENDS', depends + ' lua')
  45. if 'CONFIG_UBOOT=y\n' in features:
  46. depends = d.getVar('DEPENDS', False)
  47. d.setVar('DEPENDS', depends + ' u-boot-fw-utils')
  48. if 'CONFIG_DOWNLOAD=y\n' in features or 'CONFIG_SURICATTA=y\n' in features:
  49. depends = d.getVar('DEPENDS', False)
  50. d.setVar('DEPENDS', depends + ' curl')
  51. if 'CONFIG_MTD=y\n' in features:
  52. depends = d.getVar('DEPENDS', False)
  53. d.setVar('DEPENDS', depends + ' mtd-utils')
  54. }
  55. do_configure () {
  56. cp ${WORKDIR}/defconfig ${S}/.config
  57. cml1_do_configure
  58. }
  59. do_compile() {
  60. unset LDFLAGS
  61. oe_runmake swupdate_unstripped
  62. cp swupdate_unstripped swupdate
  63. if [ "${@bb.utils.vercmp_string('${PV}', '2016.07')}" = "1" ]; then
  64. oe_runmake progress_unstripped
  65. cp progress_unstripped progress
  66. fi
  67. }
  68. do_install () {
  69. install -d ${D}${bindir}/
  70. install -m 0755 swupdate ${D}${bindir}/
  71. install -m 0755 -d ${D}/www
  72. install -m 0755 ${S}www/* ${D}/www
  73. install -d ${D}${libdir}/
  74. install -d ${D}${includedir}/
  75. install -m 0644 ${S}include/network_ipc.h ${D}${includedir}
  76. install -m 0644 ${S}include/swupdate_status.h ${D}${includedir}
  77. install -m 0644 ${S}include/progress.h ${D}${includedir}
  78. install -m 0755 ${S}ipc/lib.a ${D}${libdir}/libswupdate.a
  79. install -d ${D}${sysconfdir}/init.d
  80. install -m 755 ${WORKDIR}/swupdate ${D}${sysconfdir}/init.d
  81. install -d ${D}${systemd_unitdir}/system
  82. install -m 644 ${WORKDIR}/swupdate.service ${D}${systemd_unitdir}/system
  83. }
  84. INITSCRIPT_NAME = "swupdate"
  85. INITSCRIPT_PARAMS = "defaults 70"
  86. SYSTEMD_SERVICE_${PN} = "swupdate.service"