Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
agent
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
7
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
df3b8a14
authored
Dec 16, 2014
by
Oliver Pinter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bootstrap ok, working serial port
parent
fef2b186
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
3 deletions
+16
-3
agent.py
+2
-2
context.py
+11
-0
freebsd/_freebsdcontext.py
+3
-1
No files found.
agent.py
View file @
df3b8a14
...
...
@@ -9,11 +9,11 @@ import sys
system
=
platform
.
system
()
if
system
==
"Linux"
:
if
system
==
"Linux"
or
system
==
"FreeBSD"
:
try
:
chdir
(
sys
.
path
[
0
])
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/"
)
except
:
pass
# hope it works
...
...
context.py
View file @
df3b8a14
...
...
@@ -27,6 +27,8 @@ def get_context():
from
windows._win32context
import
Context
elif
system
==
"Linux"
:
from
linux._linuxcontext
import
Context
elif
system
==
"FreeBSD"
:
from
freebsd._freebsdcontext
import
Context
else
:
raise
NotImplementedError
(
"Platform
%
s is not supported."
,
system
)
return
Context
...
...
@@ -53,6 +55,15 @@ def get_serial():
port
=
'/dev/ttyS0'
else
:
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
:
raise
NotImplementedError
(
"Platform
%
s is not supported."
,
system
)
return
(
SerialPort
,
port
)
...
...
freebsd/_
linux
context.py
→
freebsd/_
freebsd
context.py
View file @
df3b8a14
...
...
@@ -11,9 +11,11 @@ system = platform.system()
working_directory
=
sys
.
path
[
0
]
try
:
# load virtio console driver, the device is /dev/ttyV0.1
subprocess
.
call
((
'kldload'
,
'-n'
,
'virtio_console'
))
chdir
(
working_directory
)
subprocess
.
call
((
'pip'
,
'install'
,
'-r'
,
'requirements.txt'
))
if
system
==
'
Linux
'
:
if
system
==
'
FreeBSD
'
:
copy
(
"/root/agent/misc/vm_renewal"
,
"/usr/local/bin/"
)
except
:
pass
# hope it works
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment