Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.package
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Boxiang Sun
slapos.package
Commits
7de5283f
Commit
7de5283f
authored
Aug 31, 2012
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed slapprepare
parent
431fa584
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
15 deletions
+27
-15
slapprepare/slapprepare/__init__.py
slapprepare/slapprepare/__init__.py
+23
-3
slapprepare/slapprepare/script/slapos
slapprepare/slapprepare/script/slapos
+4
-12
No files found.
slapprepare/slapprepare/__init__.py
View file @
7de5283f
...
@@ -327,14 +327,14 @@ class Config:
...
@@ -327,14 +327,14 @@ class Config:
self
.
computer_name
=
raw_input
(
"Define a unique name for this computer: "
)
self
.
computer_name
=
raw_input
(
"Define a unique name for this computer: "
)
self
.
partition_amount
=
raw_input
(
"""Number of SlapOS partitions for this computer? Default is 20 :"""
)
self
.
partition_amount
=
raw_input
(
"""Number of SlapOS partitions for this computer? Default is 20 :"""
)
if
self
.
partition_amount
==
''
:
if
self
.
partition_amount
==
''
:
self
.
partition_amount
=
20
self
.
partition_amount
=
'20'
self
.
virtual
=
get_yes_no
(
"Is this a virtual Machine?"
,
False
)
self
.
virtual
=
get_yes_no
(
"Is this a virtual Machine?"
,
False
)
if
not
self
.
virtual
:
if
not
self
.
virtual
:
self
.
one_disk
=
not
get_yes_no
(
"Do you want to use SlapOS with a second disk?"
,
True
)
self
.
one_disk
=
not
get_yes_no
(
"Do you want to use SlapOS with a second disk?"
,
True
)
else
:
else
:
self
.
one_disk
=
True
self
.
one_disk
=
True
self
.
force_vpn
=
get_yes_no
(
"Do you want to force the use of vpn to provide ipv6?"
,
True
)
self
.
force_vpn
=
get_yes_no
(
"Do you want to force the use of vpn to provide ipv6?"
,
True
)
self
.
force_
vpn
=
get_yes_no
(
"Do you want to force the use lxc on this computer?"
,
False
)
self
.
force_
slapcontainer
=
get_yes_no
(
"Do you want to force the use lxc on this computer?"
,
False
)
if
self
.
force_vpn
:
if
self
.
force_vpn
:
self
.
ipv6_interface
=
"tapVPN"
self
.
ipv6_interface
=
"tapVPN"
else
:
else
:
...
@@ -343,11 +343,13 @@ class Config:
...
@@ -343,11 +343,13 @@ class Config:
def
displayUserConfig
(
self
):
def
displayUserConfig
(
self
):
if
self
.
certificates
:
if
self
.
certificates
:
print
"Will register a computer on master"
print
"Number of partition: %s"
%
(
self
.
partition_amount
)
print
"Number of partition: %s"
%
(
self
.
partition_amount
)
print
"Computer name: %s"
%
self
.
computer_name
print
"Computer name: %s"
%
self
.
computer_name
print
"Virtual Machine: %s"
%
self
.
virtual
print
"Ipv6 over VPN: %s"
%
self
.
force_vpn
print
"Ipv6 over VPN: %s"
%
self
.
force_vpn
print
"Remote ssh access: %s"
%
self
.
need_ssh
print
"Remote ssh access: %s"
%
self
.
need_ssh
print
"
Virtual Machine: %s"
%
self
.
virtual
print
"
Prepared to use lxc: %s"
%
self
.
force_slapcontainer
if
not
self
.
virtual
:
if
not
self
.
virtual
:
print
"Use a second disk: %s"
%
(
not
self
.
one_disk
)
print
"Use a second disk: %s"
%
(
not
self
.
one_disk
)
...
@@ -406,6 +408,14 @@ def slapprepare():
...
@@ -406,6 +408,14 @@ def slapprepare():
slapserver
(
config
)
slapserver
(
config
)
if
not
config
.
one_disk
:
if
not
config
.
one_disk
:
_call
([
'/etc/init.d/slapos_firstboot'
])
_call
([
'/etc/init.d/slapos_firstboot'
])
try
:
_call
([
'zypper'
,
'addrepo'
,
'-fc'
,
'-n'
,
'"SlapOS Official repo"'
,
'http://download.opensuse.org/repositories/home:/VIFIBnexedi/openSUSE_12.1/'
,
'slapos'
])
except
ValueError
:
print
"SlapOS repository was already there"
pass
_call
([
'systemctl'
,
'enable'
,
'slapos-boot-dedicated.service'
])
_call
([
'systemctl'
,
'enable'
,
'slapos-boot-dedicated.service'
])
_call
([
'systemctl'
,
'start'
,
'slapos-boot-dedicated.service'
])
_call
([
'systemctl'
,
'start'
,
'slapos-boot-dedicated.service'
])
...
@@ -424,3 +434,13 @@ def slapprepare():
...
@@ -424,3 +434,13 @@ def slapprepare():
print
"Deleting directory: %s"
%
temp_directory
print
"Deleting directory: %s"
%
temp_directory
_call
([
'rm'
,
'-rf'
,
temp_directory
])
_call
([
'rm'
,
'-rf'
,
temp_directory
])
sys
.
exit
(
return_code
)
sys
.
exit
(
return_code
)
if
__name__
==
"__main__"
:
config
=
Config
()
while
True
:
config
.
userConfig
()
print
"
\
n
This your configuration:
\
n
"
config
.
displayUserConfig
()
if
get_yes_no
(
"
\
n
Do you confirm?"
):
break
slapprepare/slapprepare/script/slapos
View file @
7de5283f
...
@@ -95,16 +95,8 @@ while :; do
...
@@ -95,16 +95,8 @@ while :; do
break
break
fi
fi
# software not detected, force forever installation
# software not detected, force forever installation
echo
-n
"Installing SlapOS, log availble at
${
SLAP_INSTALL_LOG
}
..."
echo
-n
"Installing SlapOS"
mkdir
-p
/opt/slapos
zypper
--gpg-auto-import-keys
install
-fy
slapos.node
#(python -S -c \
# 'import urllib2;print urllib2.urlopen("http://svn.zope.org/*checkout*/zc.buildout/trunk/bootstrap/bootstrap.py").read()' \
# | python -S - -c $SLAPOS_CONFIGURATION/software.cfg buildout:directory=/opt/slapos \
# >> ${SLAP_INSTALL_LOG} 2>&1 && /opt/slapos/bin/buildout -c \
# $SLAPOS_CONFIGURATION/software.cfg buildout:directory=/opt/slapos >> \
# ${SLAP_INSTALL_LOG} 2>&1 ) && (echo "done.") || (echo \
# "failed, retrying, the last error was:." ; tail -n 20 ${SLAP_INSTALL_LOG} ; rm -f /opt/slapos/bin/slapformat)
rpm
--install
--force
$SLAPOS_CONFIGURATION
/slapos
*
.rpm
done
done
# Create PKI repository
# Create PKI repository
...
@@ -113,11 +105,11 @@ mkdir -v -p -m 0755 $repo
...
@@ -113,11 +105,11 @@ mkdir -v -p -m 0755 $repo
# Fix path in case of old config:
# Fix path in case of old config:
SLAPOS_GOOD_CONFIGURATION
=
/etc/opt/slapos
/
SLAPOS_GOOD_CONFIGURATION
=
/etc/opt/slapos
if
[
$SLAPOS_GOOD_CONFIGURATION
!=
$SLAPOS_CONFIGURATION
]
;
then
if
[
$SLAPOS_GOOD_CONFIGURATION
!=
$SLAPOS_CONFIGURATION
]
;
then
sed
-i
"s|
$SLAPOS_GOOD_CONFIGURATION
|
$SLAPOS_CONFIGURATION
|g"
/etc/cron.d/slapos-node
sed
-i
"s|
$SLAPOS_GOOD_CONFIGURATION
|
$SLAPOS_CONFIGURATION
|g"
/etc/cron.d/slapos-node
sed
-i
"s|
$SLAPOS_GOOD_CONFIGURATION
|
$SLAPOS_CONFIGURATION
|g"
/usr/sbin/slapos-start
sed
-i
"s|
$SLAPOS_GOOD_CONFIGURATION
|
$SLAPOS_CONFIGURATION
|g"
/usr/sbin/slapos-start
fi
# Set up cron
# Set up cron
...
...
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