Makefile 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. # Copyright (C) 2018 Onion Corporation
  2. #
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=oboo-clock-base
  9. PKG_VERSION:=0.0.8
  10. PKG_RELEASE:=5
  11. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
  12. include $(INCLUDE_DIR)/package.mk
  13. # cron tool
  14. define Package/oboo-cron
  15. SECTION:=onion
  16. CATEGORY:=Onion
  17. SUBMENU:=Oboo
  18. TITLE:=Oboo Cron Daemon System
  19. endef
  20. define Package/oboo-cron/description
  21. Oboo Cron Daemon System
  22. endef
  23. # general scripts package
  24. define Package/oboo-clock-scripts
  25. SECTION:=onion
  26. CATEGORY:=Onion
  27. SUBMENU:=Oboo
  28. TITLE:=Oboo Clock scripts
  29. DEPENDS:=+url-enc-dec +coreutils-base64
  30. endef
  31. define Package/oboo-clock-scripts/description
  32. Oboo Clock scripts
  33. endef
  34. # oboo clock meta package
  35. define Package/oboo-clock-base
  36. SECTION:=onion
  37. CATEGORY:=Onion
  38. SUBMENU:=Oboo
  39. TITLE:=Oboo Clock base package
  40. DEPENDS:= +oboo-repo-keys +oboo-clock-card-manager +oboo-clock-cards +oboo-clock-mcu +oboo-clock-scripts +oboo-cron +onion-script
  41. endef
  42. define Package/oboo-clock-base/description
  43. Oboo Clock base package
  44. endef
  45. define Build/Prepare
  46. mkdir -p $(PKG_BUILD_DIR)/
  47. $(CP) ./src/* $(PKG_BUILD_DIR)/
  48. endef
  49. # installation
  50. define Package/oboo-cron/install
  51. $(INSTALL_DIR) $(1)/usr/bin $(1)/etc/crontabs/
  52. # install the cron script and crontabs
  53. $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/usr/bin/run-all.sh $(1)/usr/bin/run-all
  54. $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/etc/crontabs/root $(1)/etc/crontabs/root
  55. # cron directories
  56. $(INSTALL_DIR) $(1)/etc/cron.minute $(1)/etc/cron.hour $(1)/etc/cron.day $(1)/etc/cron.week
  57. endef
  58. define Package/oboo-clock-base/install
  59. $(INSTALL_DIR) $(1)/usr/share/oboo $(1)/etc/cron.week/ $(1)/etc/cron.hour/
  60. # install the package upgrade script
  61. $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/oboo-sw-upgrade.sh $(1)/usr/share/oboo/oboo-sw-upgrade.sh
  62. # install the overall firmware update script
  63. $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/firmware_update.sh $(1)/etc/cron.week/
  64. # install other scripts
  65. $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/ntp-refresh.sh $(1)/etc/cron.hour/ntp-refresh.sh
  66. # config files
  67. $(INSTALL_DIR) $(1)/etc/ $(1)/usr/share/rpcd/acl.d/
  68. $(INSTALL_BIN) $(PKG_BUILD_DIR)/config/acl.d/oboo-app.json $(1)/usr/share/rpcd/acl.d/
  69. # website files
  70. $(INSTALL_DIR) $(1)/www/
  71. $(INSTALL_BIN) $(PKG_BUILD_DIR)/www/index.html $(1)/www/
  72. endef
  73. define Package/oboo-clock-scripts/install
  74. # general scripts
  75. $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/share/rpcd/acl.d/
  76. $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/oboo.sh $(1)/usr/bin/oboo
  77. $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/configUpdate.sh $(1)/usr/bin/
  78. $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/checkWifi.sh $(1)/usr/bin/
  79. # hotplug scripts
  80. $(INSTALL_DIR) $(1)/etc/hotplug.d/usb/ $(1)/etc/hotplug.d/iface/
  81. $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/hotplug/usbUpgrade.sh $(1)/etc/hotplug.d/usb/99-oboo-upgrade
  82. $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/hotplug/wifiStatus.sh $(1)/etc/hotplug.d/iface/99-oboo-wifi
  83. # wifi provisioning scripts
  84. $(INSTALL_DIR) $(1)/www/cgi-bin
  85. $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/www/cgi-bin/ver $(1)/www/cgi-bin/
  86. $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/www/cgi-bin/wifi-scan $(1)/www/cgi-bin/
  87. $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/www/cgi-bin/wifi-setup $(1)/www/cgi-bin/
  88. $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/www/cgi-bin/secure $(1)/www/cgi-bin/
  89. endef
  90. define Package/oboo-clock-base/postinst
  91. #!/bin/sh
  92. # check if we are on real system
  93. if [ -z "$${IPKG_INSTROOT}" ]; then
  94. # update the mcu firmware
  95. echo "upgrading oboo packages" >> /tmp/oboo-clock-base
  96. opkg upgrade oboo-repo-keys oboo-clock-card-manager oboo-clock-cards oboo-clock-mcu
  97. fi
  98. exit 0
  99. endef
  100. $(eval $(call BuildPackage,oboo-cron))
  101. $(eval $(call BuildPackage,oboo-clock-base))
  102. $(eval $(call BuildPackage,oboo-clock-scripts))