Commit 7de5283f authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

fixed slapprepare

parent 431fa584
...@@ -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 "\nThis your configuration: \n"
config.displayUserConfig()
if get_yes_no("\nDo you confirm?"):
break
...@@ -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
......
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 to comment