Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EDI Eins Apps
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EDI
EDI Eins Apps
Commits
77c45fde
Unverified
Commit
77c45fde
authored
10 months ago
by
Gigadoc 2
Browse files
Options
Downloads
Patches
Plain Diff
enable multiline commands
parent
6ebd5963
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
simpleinit.ini
+9
-0
9 additions, 0 deletions
simpleinit.ini
simpleinit.py
+11
-8
11 additions, 8 deletions
simpleinit.py
with
20 additions
and
8 deletions
simpleinit.ini
+
9
−
0
View file @
77c45fde
...
...
@@ -2,3 +2,12 @@
Runlevel
=
1
CmdStart
=
pulseaudio start
CmdStop
=
pulseaudio stop
[message]
Runlevel
=
2
CmdStart
=
say
Subraum
startet
sob
subraum_startup
CmdStop
=
say
Subraum
faehrt
runter
sob
subraum_shutdown
This diff is collapsed.
Click to expand it.
simpleinit.py
+
11
−
8
View file @
77c45fde
...
...
@@ -18,8 +18,8 @@ for section in config.sections():
command
=
config
[
section
]
try
:
runlevel
=
int
(
command
[
'
Runlevel
'
])
start
=
command
[
'
CmdStart
'
]
stop
=
command
[
'
CmdStop
'
]
start
=
command
[
'
CmdStart
'
]
.
splitlines
()
stop
=
command
[
'
CmdStop
'
]
.
splitlines
()
if
runlevel
not
in
runlevels
:
runlevels
[
runlevel
]
=
list
()
runlevels
[
runlevel
].
append
({
'
name
'
:
section
,
'
start
'
:
start
,
'
stop
'
:
stop
})
...
...
@@ -31,10 +31,13 @@ old_level = 0
eins
=
Eins
()
def
emit_cmd
(
command_string
):
print
(
f
"
Emitting cmd:
{
command_string
}
"
)
argv
=
shlex
.
split
(
command_string
)
eins
.
emit_cmd
(
argv
[
0
],
*
argv
[
1
:])
def
emit_cmds
(
command_strings
):
for
command
in
command_strings
:
if
command
==
""
:
continue
print
(
f
"
Emitting cmd:
{
command
}
"
)
argv
=
shlex
.
split
(
command
)
eins
.
emit_cmd
(
argv
[
0
],
*
argv
[
1
:])
# This is a silent command, subinitd already describes the same command
@eins.simple_cmd
()
...
...
@@ -48,13 +51,13 @@ def telinit2(new_level):
if
i
in
runlevels
:
for
command
in
runlevels
[
i
]:
print
(
f
"
Starting
{
command
[
'
name
'
]
}
"
)
emit_cmd
(
command
[
'
start
'
])
emit_cmd
s
(
command
[
'
start
'
])
else
:
for
i
in
reversed
(
range
(
new_level
+
1
,
old_level
+
1
)):
if
i
in
runlevels
:
for
command
in
runlevels
[
i
]:
print
(
f
"
Stopping
{
command
[
'
name
'
]
}
"
)
emit_cmd
(
command
[
'
stop
'
])
emit_cmd
s
(
command
[
'
stop
'
])
old_level
=
new_level
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment