new place for common custom buildroot packages (like mruby), and fix tzdata.
* mruby is a test package for now, but it can now be configured from all the systems. * tzdata fixed * tzdata's default behavior is to download a file randomly to its `:code.priv_dir` (which is read-only), now we dont download it ever * we needed the files it _would_ download, so i packaged them into `farmbot_system`'s priv dir, then copy it to `/tmp/` (which is read-write) at every boot.pull/232/head
parent
d872f6cd16
commit
35890d1c6c
4
Makefile
4
Makefile
|
@ -13,7 +13,7 @@ prod_env:
|
|||
|
||||
clean:
|
||||
$(info Cleaning)
|
||||
rm -rf apps/NERVES_SYSTEM_*
|
||||
# rm -rf apps/NERVES_SYSTEM_*
|
||||
rm -rf apps/farmbot/_images
|
||||
rm -rf deps
|
||||
rm -rf _build
|
||||
|
@ -109,4 +109,4 @@ release-rpi2: rpi2
|
|||
## end rpi2 portion.
|
||||
|
||||
## Release will build all the systems.
|
||||
release: clean release-rpi release-rpi3 release-rpi2
|
||||
release: clean release-rpi release-rpi3 release-rpi2
|
||||
|
|
|
@ -3,3 +3,5 @@ config :nerves, :firmware,
|
|||
rootfs_additions: "config/hardware/#{Mix.Project.config[:target]}/rootfs-additions"
|
||||
|
||||
config :farmbot_configurator, port: 80
|
||||
config :tzdata, :data_dir, "/tmp"
|
||||
config :tzdata, :autoupdate, :disabled
|
||||
|
|
|
@ -59,16 +59,16 @@ defmodule Farmbot.Mixfile do
|
|||
:rsa,
|
||||
:runtime_tools,
|
||||
:mustache,
|
||||
:timex,
|
||||
:vmq_commons,
|
||||
:amnesia,
|
||||
:quantum,
|
||||
:gen_stage,
|
||||
:nerves,
|
||||
:"farmbot_system_#{target(Mix.env)}",
|
||||
:farmbot_system,
|
||||
:farmbot_auth,
|
||||
:farmbot_configurator,
|
||||
:quantum, # Quantum needs to start AFTER farmbot_system, so we can set up its dirs
|
||||
:timex, # Timex needs to start AFTER farmbot_system, so we can set up its dirs
|
||||
]
|
||||
end
|
||||
|
||||
|
|
Binary file not shown.
|
@ -12,6 +12,7 @@ defmodule Farmbot.System.NervesCommon.FileSystem do
|
|||
block_device: block_device)
|
||||
do
|
||||
quote do
|
||||
require Logger
|
||||
# mount -t ext4 -o ro,remount /dev/mmcblk0p3 /state
|
||||
|
||||
@doc false
|
||||
|
@ -31,6 +32,25 @@ defmodule Farmbot.System.NervesCommon.FileSystem do
|
|||
# If not, we are fine. continue
|
||||
_ -> :ok
|
||||
end
|
||||
|
||||
:ok = tzdata_hack()
|
||||
end
|
||||
|
||||
@doc """
|
||||
This needs to happen because tzdata by default polls and downloads
|
||||
things to its release dir, which is read only in nerves environments.
|
||||
to fix this we bundle the file it would normally download, and package
|
||||
it into farmbot_system, then copy it to a configured dir for tzdata to
|
||||
use because /tmp is read-write, we will just copy it there at every
|
||||
boot becase its easier.
|
||||
"""
|
||||
def tzdata_hack() do
|
||||
Logger.debug ">> Hacking tzdata..."
|
||||
# File.cp "#{:code.priv_dir(:tzdata)}/release_ets/2016j.ets", "/tmp"
|
||||
File.mkdir "/tmp/release_ets"
|
||||
File.cp_r "#{:code.priv_dir(:farmbot_system)}/release_ets/2016j.ets", "/tmp/release_ets/2016j.ets"
|
||||
Logger.debug ">> Hacked!"
|
||||
:ok
|
||||
end
|
||||
|
||||
@doc false
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
/_build
|
||||
/cover
|
||||
/deps
|
||||
erl_crash.dump
|
||||
*.ez
|
||||
build.log
|
||||
.nerves
|
|
@ -0,0 +1 @@
|
|||
source "$NERVES_DEFCONFIG_DIR/../nerves_packages_farmbot/package/mruby/Config.in"
|
|
@ -0,0 +1,41 @@
|
|||
defmodule NervesPackagesFarmbot.Mixfile do
|
||||
use Mix.Project
|
||||
|
||||
@version Path.join([__DIR__, "..", "farmbot", "VERSION"])
|
||||
|> File.read!
|
||||
|> String.strip
|
||||
|
||||
|
||||
def project do
|
||||
[app: :nerves_packages_farmbot,
|
||||
version: @version,
|
||||
elixir: "~> 1.4",
|
||||
archives: [nerves_bootstrap: "~> 0.2.1"],
|
||||
aliases: ["deps.precompile": ["nerves.env", "deps.precompile"]],
|
||||
compilers: Mix.compilers ++ [:nerves_package],
|
||||
description: description(),
|
||||
package: package(),
|
||||
lockfile: "../../mix.lock",
|
||||
deps: deps()]
|
||||
end
|
||||
|
||||
def application, do: []
|
||||
|
||||
defp deps do
|
||||
[{:nerves, "~> 0.4.0"},
|
||||
{:nerves_system_br, "~> 0.8.1"}]
|
||||
end
|
||||
|
||||
defp description do
|
||||
"""
|
||||
Buildroot packages common to Farmbot
|
||||
"""
|
||||
end
|
||||
|
||||
defp package do
|
||||
[maintainers: ["Connor Rigby"],
|
||||
files: ["mix.exs", "Config.in", ".gitignore"],
|
||||
licenses: ["MIT"],
|
||||
links: %{"Github" => "https://github.com/farmbot/farmbot_os"}]
|
||||
end
|
||||
end
|
|
@ -2,3 +2,4 @@
|
|||
#
|
||||
# If these are non-proprietary, please consider contributing them back to
|
||||
# Nerves or Buildroot.
|
||||
source "$NERVES_DEFCONFIG_DIR/../nerves_packages_farmbot/Config.in"
|
||||
|
|
|
@ -77,3 +77,4 @@ BR2_PACKAGE_ERLANG_HISTORY=y
|
|||
BR2_PACKAGE_NERVES_CONFIG=y
|
||||
BR2_PACKAGE_NERVES_CONFIG_NO_ERLINIT_CONF=y
|
||||
BR2_PACKAGE_NERVES_CONFIG_APPS="crypto"
|
||||
BR2_PACKAGE_MRUBY=y
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
#
|
||||
# If these are non-proprietary, please consider contributing them back to
|
||||
# Nerves or Buildroot.
|
||||
source "$NERVES_DEFCONFIG_DIR/../nerves_packages_farmbot/Config.in"
|
||||
|
|
|
@ -72,3 +72,4 @@ BR2_PACKAGE_ERLANG_HISTORY=y
|
|||
BR2_PACKAGE_NERVES_CONFIG=y
|
||||
BR2_PACKAGE_NERVES_CONFIG_NO_ERLINIT_CONF=y
|
||||
BR2_PACKAGE_NERVES_CONFIG_APPS="crypto"
|
||||
BR2_PACKAGE_MRUBY=y
|
||||
|
|
|
@ -1 +1 @@
|
|||
source "$NERVES_DEFCONFIG_DIR/package/mruby/Config.in"
|
||||
source "$NERVES_DEFCONFIG_DIR/../nerves_packages_farmbot/Config.in"
|
||||
|
|
Loading…
Reference in New Issue