Commit df3b8a14 by Oliver Pinter

bootstrap ok, working serial port

parent fef2b186
...@@ -9,11 +9,11 @@ import sys ...@@ -9,11 +9,11 @@ import sys
system = platform.system() system = platform.system()
if system == "Linux": if system == "Linux" or system == "FreeBSD" :
try: try:
chdir(sys.path[0]) chdir(sys.path[0])
subprocess.call(('pip', 'install', '-r', 'requirements.txt')) subprocess.call(('pip', 'install', '-r', 'requirements.txt'))
if system == 'Linux': if system == 'Linux' or system == "FreeBSD":
copy("/root/agent/misc/vm_renewal", "/usr/local/bin/") copy("/root/agent/misc/vm_renewal", "/usr/local/bin/")
except: except:
pass # hope it works pass # hope it works
......
...@@ -27,6 +27,8 @@ def get_context(): ...@@ -27,6 +27,8 @@ def get_context():
from windows._win32context import Context from windows._win32context import Context
elif system == "Linux": elif system == "Linux":
from linux._linuxcontext import Context from linux._linuxcontext import Context
elif system == "FreeBSD":
from freebsd._freebsdcontext import Context
else: else:
raise NotImplementedError("Platform %s is not supported.", system) raise NotImplementedError("Platform %s is not supported.", system)
return Context return Context
...@@ -53,6 +55,15 @@ def get_serial(): ...@@ -53,6 +55,15 @@ def get_serial():
port = '/dev/ttyS0' port = '/dev/ttyS0'
else: else:
from linux.posixvirtio import SerialPort from linux.posixvirtio import SerialPort
elif system == "FreeBSD":
port = "/dev/ttyV0.1"
try:
open(port, 'rw').close()
except (OSError, IOError):
from twisted.internet.serialport import SerialPort
port = '/dev/ttyu0'
else:
from freebsd.posixvirtio import SerialPort
else: else:
raise NotImplementedError("Platform %s is not supported.", system) raise NotImplementedError("Platform %s is not supported.", system)
return (SerialPort, port) return (SerialPort, port)
......
...@@ -11,9 +11,11 @@ system = platform.system() ...@@ -11,9 +11,11 @@ system = platform.system()
working_directory = sys.path[0] working_directory = sys.path[0]
try: try:
# load virtio console driver, the device is /dev/ttyV0.1
subprocess.call(('kldload', '-n', 'virtio_console'))
chdir(working_directory) chdir(working_directory)
subprocess.call(('pip', 'install', '-r', 'requirements.txt')) subprocess.call(('pip', 'install', '-r', 'requirements.txt'))
if system == 'Linux': if system == 'FreeBSD':
copy("/root/agent/misc/vm_renewal", "/usr/local/bin/") copy("/root/agent/misc/vm_renewal", "/usr/local/bin/")
except: except:
pass # hope it works pass # hope it works
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment