Commit 23d01bb6 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

Update Slapbuilder for new suse Image

Add possibility to choose  Self hosted image with option --one_disk
parent bd12f3f2
...@@ -100,8 +100,10 @@ class Parser(OptionParser): ...@@ -100,8 +100,10 @@ class Parser(OptionParser):
default=False, default=False,
action="store_true"), action="store_true"),
Option(None, "--no_usb", default=False, action="store_true", Option(None, "--no_usb", default=False, action="store_true",
help="Do not write on USB.") help="Do not write on USB."),
]) Option(None, "--one_disk",default=False, action="store_true",
help="Prepare image for one disk usage")
])
def check_args(self): def check_args(self):
""" """
...@@ -266,13 +268,31 @@ def run(config): ...@@ -266,13 +268,31 @@ def run(config):
os.chmod(slapos_software_file, 0644) os.chmod(slapos_software_file, 0644)
# Creating boot scripts # Creating boot scripts
for script in ['slapos_firstboot', 'slapos']: for script in ['slapos.service','slapos']:
path = os.path.join(mount_dir_path, 'etc', 'init.d', script) path = os.path.join(mount_dir_path, 'etc', 'slapos', script)
print "Creating %r" % path print "Creating %r" % path
if not dry_run: if not dry_run:
open(path, 'w').write(pkg_resources.resource_stream(__name__, open(path, 'w').write(pkg_resources.resource_stream(__name__,
'script/%s' % script).read()) 'script/%s' % script).read())
os.chmod(path, 0755) os.chmod(path, 0755)
# Adding slapos_firstboot in case of MultiDisk usage
if not config.one_disk :
for script in ['slapos_firstboot']:
path = os.path.join(mount_dir_path, 'etc', 'init.d', script)
print "Creating %r" % path
if not dry_run:
open(path, 'w').write(pkg_resources.resource_stream(__name__,
'script/%s' % script).read())
os.chmod(path, 0755)
else:
for script in ['slapos_firstboot']:
path = os.path.join(mount_dir_path, 'etc', 'init.d', script)
if os.path.exists(path):
print "Removing %r" % path
os.remove(path)
finally: finally:
_call(['umount', mount_dir_path], dry_run=dry_run) _call(['umount', mount_dir_path], dry_run=dry_run)
finally: finally:
...@@ -337,3 +357,6 @@ def main(): ...@@ -337,3 +357,6 @@ def main():
return_code = err return_code = err
sys.exit(return_code) sys.exit(return_code)
if __name__ == "__main__":
main()
...@@ -48,7 +48,11 @@ ...@@ -48,7 +48,11 @@
if [ -f /etc/init.d/suse_studio_firstboot ] if [ -f /etc/init.d/suse_studio_firstboot ]
then then
/etc/init.d/slapos_firstboot echo "______________Init of SlapOS service_______________"
/etc/init.d/slapos_firstboot
mv /etc/slapos/slapos.service /etc/systemd/system/
systemctl enable slapos.service
systemctl start slapos.service
elif [ -f /token_second_boot ]; then elif [ -f /token_second_boot ]; then
/etc/init.d/slapos_secondboot /etc/init.d/slapos_secondboot
fi fi
#!/bin/sh #!/bin/sh
### BEGIN INIT INFO
# Provides: slapos
# Required-Start: $network $remote_fs
# Required-Stop: $network $remote_fs
# Default-Start: 3 5
# Default-Stop:
# Description: Run SlapOS
### END INIT INFO
############################################################################## ##############################################################################
# #
# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved. # Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved.
...@@ -34,8 +26,6 @@ ...@@ -34,8 +26,6 @@
# #
############################################################################## ##############################################################################
case "$1" in
start)
# clean the system # clean the system
for service in rpcbind network-remotefs postfix ; do for service in rpcbind network-remotefs postfix ; do
......
[Unit]
Description=SlapOs Boot script
Requires=basic.target
Wants=network.target remote-fs.target
After=basic.target network.target remote-fs.target
[Service]
Type=simple
ExecStart=/etc/slapos/slapos
StandardOutput=tty
TTYPath=/dev/console
[Install]
WantedBy=multi-user.target
...@@ -278,7 +278,6 @@ quit ...@@ -278,7 +278,6 @@ quit
def run(): def run():
"""Prepares machine to run SlapOS""" """Prepares machine to run SlapOS"""
print "Running SUSE Studio first boot script..." print "Running SUSE Studio first boot script..."
callWithIgnore("chkconfig --add slapos".split(' '))
partprobe() partprobe()
slapos_label_file='/dev/disk/by-label/' + LABEL slapos_label_file='/dev/disk/by-label/' + LABEL
if not os.path.exists(slapos_label_file): if not os.path.exists(slapos_label_file):
......
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