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
Compare revisions
7e575400f240954ae91145b739705640a6c1d502 to 77c45fded52e5720bd40db5aa9065de13ec149c5
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
edi/eins-apps
Select target project
No results found
77c45fded52e5720bd40db5aa9065de13ec149c5
Select Git revision
Branches
main
Swap
Target
edi/eins-apps
Select target project
edi/eins-apps
1 result
7e575400f240954ae91145b739705640a6c1d502
Select Git revision
Branches
main
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (2)
rename example.ini to avoid confusion and name clashes
· 6ebd5963
Gigadoc 2
authored
10 months ago
Unverified
6ebd5963
enable multiline commands
· 77c45fde
Gigadoc 2
authored
10 months ago
Unverified
77c45fde
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
simpleinit.ini
+13
-0
13 additions, 0 deletions
simpleinit.ini
simpleinit.py
+11
-8
11 additions, 8 deletions
simpleinit.py
with
24 additions
and
8 deletions
exa
mple.ini
→
si
mple
init
.ini
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
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.