Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
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.toolbox
Commits
23d01bb6
Commit
23d01bb6
authored
Feb 08, 2012
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Slapbuilder for new suse Image
Add possibility to choose Self hosted image with option --one_disk
parent
bd12f3f2
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
17 deletions
+48
-17
slapos/builder/__init__.py
slapos/builder/__init__.py
+27
-4
slapos/builder/appliance/each_boot_script.sh
slapos/builder/appliance/each_boot_script.sh
+6
-2
slapos/builder/script/slapos
slapos/builder/script/slapos
+0
-10
slapos/builder/script/slapos.service
slapos/builder/script/slapos.service
+15
-0
slapos/builder/script/slapos_firstboot
slapos/builder/script/slapos_firstboot
+0
-1
No files found.
slapos/builder/__init__.py
View file @
23d01bb6
...
@@ -100,7 +100,9 @@ class Parser(OptionParser):
...
@@ -100,7 +100,9 @@ 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'
,
'slapos'
,
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
)
# 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
)
path
=
os
.
path
.
join
(
mount_dir_path
,
'etc'
,
'init.d'
,
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
)
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
()
slapos/builder/appliance/each_boot_script.sh
View file @
23d01bb6
...
@@ -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
echo
"______________Init of SlapOS service_______________"
/etc/init.d/slapos_firstboot
/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
slapos/builder/script/slapos
View file @
23d01bb6
#!/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
...
...
slapos/builder/script/slapos.service
0 → 100644
View file @
23d01bb6
[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
slapos/builder/script/slapos_firstboot
View file @
23d01bb6
...
@@ -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
):
...
...
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