swupdate.inc 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. PACKAGES =+ "${PN}-www"
  15. FILES_${PN}-www = "/www/*"
  16. FILES_${PN}-dev = "${includedir}"
  17. FILES_${PN}-staticdev = "${libdir}"
  18. FILES_${PN} = "${bindir}/* /etc"
  19. S = "${WORKDIR}/git/"
  20. EXTRA_OEMAKE += "V=1 ARCH=${TARGET_ARCH} CROSS_COMPILE=${TARGET_PREFIX} SKIP_STRIP=y"
  21. python () {
  22. try:
  23. defconfig = bb.fetch2.localpath('file://defconfig', d)
  24. except bb.fetch2.FetchError:
  25. return
  26. try:
  27. configfile = open(defconfig)
  28. except IOError:
  29. return
  30. features = configfile.readlines()
  31. configfile.close()
  32. if 'CONFIG_REMOTE_HANDLER=y\n' in features:
  33. depends = d.getVar('DEPENDS', False)
  34. d.setVar('DEPENDS', depends + ' zeromq')
  35. if 'CONFIG_JSON=y\n' in features:
  36. depends = d.getVar('DEPENDS', False)
  37. d.setVar('DEPENDS', depends + ' json-c')
  38. if 'CONFIG_ARCHIVE=y\n' in features:
  39. depends = d.getVar('DEPENDS', False)
  40. d.setVar('DEPENDS', depends + ' libarchive')
  41. if 'CONFIG_LUA=y\n' in features:
  42. depends = d.getVar('DEPENDS', False)
  43. d.setVar('DEPENDS', depends + ' lua')
  44. if 'CONFIG_UBOOT=y\n' in features:
  45. depends = d.getVar('DEPENDS', False)
  46. d.setVar('DEPENDS', depends + ' u-boot-fw-utils')
  47. if 'CONFIG_DOWNLOAD=y\n' in features or 'CONFIG_SURICATTA=y\n' in features:
  48. depends = d.getVar('DEPENDS', False)
  49. d.setVar('DEPENDS', depends + ' curl')
  50. if 'CONFIG_MTD=y\n' in features:
  51. depends = d.getVar('DEPENDS', False)
  52. d.setVar('DEPENDS', depends + ' mtd-utils')
  53. }
  54. do_configure () {
  55. cp ${WORKDIR}/defconfig ${S}/.config
  56. cml1_do_configure
  57. }
  58. do_compile() {
  59. unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
  60. oe_runmake swupdate_unstripped
  61. cp swupdate_unstripped swupdate
  62. }
  63. do_install () {
  64. install -d ${D}${bindir}/
  65. install -m 0755 swupdate ${D}${bindir}/
  66. install -m 0755 -d ${D}/www
  67. install -m 0755 ${S}www/* ${D}/www
  68. install -d ${D}${libdir}/
  69. install -d ${D}${includedir}/
  70. install -m 0644 ${S}include/network_ipc.h ${D}${includedir}
  71. install -m 0644 ${S}include/swupdate_status.h ${D}${includedir}
  72. install -m 0644 ${S}include/progress.h ${D}${includedir}
  73. install -m 0755 ${S}ipc/lib.a ${D}${libdir}/libswupdate.a
  74. install -d ${D}${sysconfdir}/init.d
  75. install -m 755 ${WORKDIR}/swupdate ${D}${sysconfdir}/init.d
  76. install -d ${D}${systemd_unitdir}/system
  77. install -m 644 ${WORKDIR}/swupdate.service ${D}${systemd_unitdir}/system
  78. }
  79. INITSCRIPT_NAME = "swupdate"
  80. INITSCRIPT_PARAMS = "defaults 70"
  81. SYSTEMD_SERVICE_${PN} = "swupdate.service"