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
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
3ec1de18
authored
Jan 19, 2015
by
Oliver Pinter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
share: smbfs
parent
5a5785dc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
7 deletions
+24
-7
bootstrap-freebsd.sh
+5
-0
freebsd/_freebsdcontext.py
+19
-7
No files found.
bootstrap-freebsd.sh
View file @
3ec1de18
...
@@ -20,6 +20,11 @@ then
...
@@ -20,6 +20,11 @@ then
git clone https://github.com/HardenedBSD/freebsd-ports.git /usr/ports
git clone https://github.com/HardenedBSD/freebsd-ports.git /usr/ports
fi
fi
if
[
!
-d
/store
]
then
mkdir
-p
/store
fi
if
[
!
-d
/root/agent
]
if
[
!
-d
/root/agent
]
then
then
cd
/root
cd
/root
...
...
freebsd/_freebsdcontext.py
View file @
3ec1de18
#!/usr/bin/env python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
from
os
import
mkdir
,
environ
,
chdir
from
os
import
mkdir
,
environ
,
chdir
,
chmod
import
platform
import
platform
from
shutil
import
copy
,
rmtree
,
move
from
shutil
import
copy
,
rmtree
,
move
import
subprocess
import
subprocess
...
@@ -13,6 +13,7 @@ working_directory = sys.path[0]
...
@@ -13,6 +13,7 @@ working_directory = sys.path[0]
try
:
try
:
# load virtio console driver, the device is /dev/ttyV0.1
# load virtio console driver, the device is /dev/ttyV0.1
subprocess
.
call
((
'/sbin/kldload'
,
'-n'
,
'virtio_console'
))
subprocess
.
call
((
'/sbin/kldload'
,
'-n'
,
'virtio_console'
))
subprocess
.
call
((
'/sbin/kldload'
,
'-n'
,
'smbfs'
))
chdir
(
working_directory
)
chdir
(
working_directory
)
subprocess
.
call
((
'/usr/local/bin/pip'
,
'install'
,
'-r'
,
'requirements.txt'
))
subprocess
.
call
((
'/usr/local/bin/pip'
,
'install'
,
'-r'
,
'requirements.txt'
))
copy
(
"/root/agent/misc/vm_renewal"
,
"/usr/local/bin/"
)
copy
(
"/root/agent/misc/vm_renewal"
,
"/usr/local/bin/"
)
...
@@ -46,9 +47,15 @@ AUTHORIZED_KEYS = join(SSH_DIR, 'authorized_keys')
...
@@ -46,9 +47,15 @@ AUTHORIZED_KEYS = join(SSH_DIR, 'authorized_keys')
STORE_DIR
=
'/store'
STORE_DIR
=
'/store'
mount_template_linux
=
(
mount_template_freebsd
=
(
'//
%(host)
s/
%(username)
s
%(dir)
s cifs username=
%(username)
s'
'//CLOUD/
%(username)
s
%(dir)
s smbfs '
',password=
%(password)
s,iocharset=utf8,uid=cloud 0 0
\n
'
)
'rw,-N,-ucloud,-U
%(username)
s 0 0
\n
'
)
NSMBRC
=
'/etc/nsmb.conf'
nsmbrc_template_freebsd
=
(
'[CLOUD:
%(username)
s]
\n
'
'addr=
%(host)
s
\n
'
'password=
%(password)
s
\n
'
)
class
Context
(
BaseContext
):
class
Context
(
BaseContext
):
...
@@ -116,11 +123,15 @@ class Context(BaseContext):
...
@@ -116,11 +123,15 @@ class Context(BaseContext):
mkdir
(
STORE_DIR
)
mkdir
(
STORE_DIR
)
# TODO
# TODO
for
line
in
fileinput
.
input
(
'/etc/fstab'
,
inplace
=
True
):
for
line
in
fileinput
.
input
(
'/etc/fstab'
,
inplace
=
True
):
if
not
(
line
.
startswith
(
'//'
)
and
'
ci
fs '
in
line
):
if
not
(
line
.
startswith
(
'//'
)
and
'
smb
fs '
in
line
):
print
line
.
rstrip
()
print
line
.
rstrip
()
with
open
(
NSMBRC
,
'w'
)
as
f
:
chmod
(
NSMBRC
,
0600
)
f
.
write
(
nsmbrc_template_freebsd
%
data
)
with
open
(
'/etc/fstab'
,
'a'
)
as
f
:
with
open
(
'/etc/fstab'
,
'a'
)
as
f
:
f
.
write
(
mount_template_
linux
%
data
)
f
.
write
(
mount_template_
freebsd
%
data
)
subprocess
.
call
(
'/sbin/mount -a'
,
shell
=
True
)
subprocess
.
call
(
'/sbin/mount -a'
,
shell
=
True
)
...
@@ -184,7 +195,8 @@ class Context(BaseContext):
...
@@ -184,7 +195,8 @@ class Context(BaseContext):
'/home/cloud/.ssh'
'/home/cloud/.ssh'
'/root/.lesshst'
'/root/.lesshst'
'/root/.history'
'/root/.history'
'/root/.viminfo'
]
'/root/.viminfo'
'/etc/nsmb.conf'
]
+
glob
(
'/etc/ssh/ssh_host_*'
))
+
glob
(
'/etc/ssh/ssh_host_*'
))
for
f
in
filelist
:
for
f
in
filelist
:
rmtree
(
f
,
ignore_errors
=
True
)
rmtree
(
f
,
ignore_errors
=
True
)
...
...
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