changing ssh round a bit

pull/321/head
Connor Rigby 2017-06-14 21:13:55 -07:00
parent 3ec0a40deb
commit ccbf01969b
4 changed files with 25 additions and 12 deletions

View File

@ -30,8 +30,3 @@ IO.puts "using #{target} - #{env} configuration."
import_config "hardware/#{target}/#{env}.exs"
config :nerves, :firmware,
rootfs_additions: "config/hardware/#{target}/rootfs-additions-#{env}"
config :bootloader,
overlay_path: "/tmp/erl_bootloader",
init: [],
app: :farmbot

View File

@ -114,8 +114,26 @@ defmodule Farmbot.System.Network do
:ok
end
if Mix.env() == :prod do
defp read_ssh_public_key do
{:ok, public_key} = get_config("ssh")
public_key
end
else
defp read_ssh_public_key do
case File.read "#{System.get_env("HOME")}/.ssh/id_rsa.pub" do
{:ok, bin} -> String.trim(bin)
_ -> nil
end
end
end
defp maybe_start_ssh do
{:ok, public_key} = get_config("ssh")
public_key = read_ssh_public_key()
ssh_dir = '/ssh'
ssh_dir_exists? = File.exists?(ssh_dir)
shell = {Elixir.IEx, :start, []}

View File

@ -132,7 +132,7 @@ defmodule Farmbot.Mixfile do
# Hardware stuff
{:nerves_uart, "0.1.2"}, # uart handling
{:nerves_lib, github: "nerves-project/nerves_lib"}, # this has a good uuid
{:bootloader, github: "nerves-project/bootloader"},
# {:bootloader, github: "nerves-project/bootloader"},
# http stuff
{:poison, "~> 3.0"},

View File

@ -28,12 +28,12 @@ end
release :farmbot do
set version: current_version(:farmbot)
plugin Bootloader.Plugin
# plugin Bootloader.Plugin
if System.get_env("NERVES_SYSTEM") do
set dev_mode: false
set include_src: false
set include_erts: System.get_env("ERL_LIB_DIR")
set dev_mode: false
set include_src: false
set include_erts: System.get_env("ERL_LIB_DIR")
set include_system_libs: System.get_env("ERL_SYSTEM_LIB_DIR")
set vm_args: "rel/vm.args"
set vm_args: "rel/vm.args"
end
end