Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
Obarun Install Themes
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
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
Eric Vidal
Obarun Install Themes
Commits
351b78f1
Commit
351b78f1
authored
8 years ago
by
Eric Vidal
Browse files
Options
Downloads
Patches
Plain Diff
oopss, rewrite runit_pipe
parent
9c43c2ad
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
openbox/rootfs/etc/skel/.config/openbox/menu.xml
+1
-0
1 addition, 0 deletions
openbox/rootfs/etc/skel/.config/openbox/menu.xml
openbox/rootfs/etc/skel/.config/pipe_menu/runit_pipe
+315
-0
315 additions, 0 deletions
openbox/rootfs/etc/skel/.config/pipe_menu/runit_pipe
with
316 additions
and
0 deletions
openbox/rootfs/etc/skel/.config/openbox/menu.xml
+
1
−
0
View file @
351b78f1
...
...
@@ -133,6 +133,7 @@
<separator/>
<menu
id=
"SystemArch"
icon=
"/usr/share/icons/Faenza/categories/24/applications-system.png"
/>
<menu
id=
"system"
icon=
"/usr/share/icons/Faenza/categories/24/configuration_section.png"
/>
<menu
id=
"runitcontrol"
label=
"Runit"
execute=
"~/.config/pipe_menu/runit_pipe"
icon=
"/usr/share/icons/Faenza/categories/24/applications-system.png"
/>
<separator/>
<menu
id=
"worlddate"
label=
"WorldDate"
execute=
"~/.config/pipe_menu/date.sh"
icon=
"/usr/share/icons/Faenza/status/scalable/appointment-soon.svg"
/>
<separator/>
...
...
This diff is collapsed.
Click to expand it.
openbox/rootfs/etc/skel/.config/pipe_menu/runit_pipe
0 → 100755
+
315
−
0
View file @
351b78f1
#!/bin/sh
# This script is under license BEERWARE
# "THE BEERWARE LICENSE" (Revision 42):
# <eric@obarun.org> wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return. Eric Vidal
# http://obarun.org
#
# Place this to your .config/openbox/menu.xml :
# <menu id="runitcontrol" label="Runit" execute="/path/to/runit_pipe" />
# Don't forget : chmod +x /path/to/runit_pipe
## Define variables
browser
=
"sudo spacefm"
sv
=
"sudo sv"
path
=
"
${
1
:-
/var/service
}
"
editor
=
"sudo geany"
list
=
$(
ls
-H
-d
--group-directories-first
$path
/
*
)
shortname
=
"
${
1
##*/
}
"
status
=
"sudo sv status
$path
"
## Define pid
status
(){
if
[[
((
"
$path
"
!=
"/var/service"
))
&&
((
$(
echo
"
$path
"
|
grep
main
)
=
""
))
]]
;
then
pid
=
$(
$status
|
awk
-F
'('
'{ print $2 }'
|
cut
-d
')'
-f1
)
run
=
$(
$status
|
cut
-d
':'
-f1
)
echo
"<separator label=
\"
Status :
$run
\"
/>"
if
[[
"
$run
"
=
"run"
]]
;
then
echo
"<separator label=
\"
$pid
\"
/>"
echo
"<separator />"
fi
fi
if
[[
((
"
$path
"
!=
"/var/service"
))
&&
((
$(
echo
"
$path
"
|
grep
/log
)
=
""
))
]]
;
then
disable
echo
"<separator />"
fi
}
## Disable a service
disable
(){
echo
"<item label=
\"
Disable
$shortname
\"
>
<action name=
\"
Execute
\"
>
<execute>
sudo rm
$path
</execute>
</action>
</item>"
}
## Starting a pipe_menu in xml
start_pipe
(){
echo
"<openbox_pipe_menu>"
}
## Ending a pipe_menu in xml
end_pipe
(){
echo
"</openbox_pipe_menu>"
}
## Browsing here
head
(){
echo
"<item label=
\"
Browse here..
\"
>
<action name=
\"
Execute
\"
>
<execute>
$browser
$path
</execute>
</action>
</item>
<separator />"
}
## Launch editor
menu_editor
(){
echo
"<item label=
\"
$shortname
\"
>
<action name=
\"
Execute
\"
>
<execute>
$editor
$path
/
$shortname
</execute>
</action>
</item>"
}
## Viewing log
menu_log
(){
shortname
=
$(
echo
"
$path
"
|
cut
-d
'/'
-f4
)
echo
"<item label=
\"
View log
\"
>
<action name=
\"
Execute
\"
>
<execute>
$editor
/var/log/
$shortname
/current
</execute>
</action>
</item>
<separator />"
}
## Manage services
control
(){
echo
"<separator />"
echo
"<item label=
\"
up
\"
>
<action name=
\"
Execute
\"
>
<execute>
$sv
up
$path
</execute>
</action>
</item>
<item label=
\"
down
\"
>
<action name=
\"
Execute
\"
>
<execute>
$sv
down
$path
</execute>
</action>
</item>
<item label=
\"
once
\"
>
<action name=
\"
Execute
\"
>
<execute>
$sv
once
$path
</execute>
</action>
</item>
<item label=
\"
hup
\"
>
<action name=
\"
Execute
\"
>
<execute>
$sv
hup
$path
</execute>
</action>
</item>
<item label=
\"
exit
\"
>
<action name=
\"
Execute
\"
>
<execute>
$sv
exit
$path
</execute>
</action>
</item>
<item label=
\"
kill
\"
>
<action name=
\"
Execute
\"
>
<execute>
$sv
kill
$path
</execute>
</action>
</item>
<menu id=
\"
control
\"
label=
\"
More Signal
\"
>
<item label=
\"
pause
\"
>
<action name=
\"
Execute
\"
>
<execute>
$sv
pause
$path
</execute>
</action>
</item>
<item label=
\"
cont
\"
>
<action name=
\"
Execute
\"
>
<execute>
$sv
cont
$path
</execute>
</action>
</item>
<item label=
\"
alarm
\"
>
<action name=
\"
Execute
\"
>
<execute>
$sv
alarm
$path
</execute>
</action>
</item>
<item label=
\"
interrupt
\"
>
<action name=
\"
Execute
\"
>
<execute>
$sv
interrupt
$path
</execute>
</action>
</item>
<item label=
\"
quit
\"
>
<action name=
\"
Execute
\"
>
<execute>
$sv
quit
$path
</execute>
</action>
</item>
<item label=
\"
USR1
\"
>
<action name=
\"
Execute
\"
>
<execute>
$sv
1
$path
</execute>
</action>
</item>
<item label=
\"
USR2
\"
>
<action name=
\"
Execute
\"
>
<execute>
$sv
2
$path
</execute>
</action>
</item>
<item label=
\"
term
\"
>
<action name=
\"
Execute
\"
>
<execute>
$sv
term
$path
</execute>
</action>
</item>
<item label=
\"
force-reload
\"
>
<action name=
\"
Execute
\"
>
<execute>
$sv
force-reload
$path
</execute>
</action>
</item>
<item label=
\"
force-restart
\"
>
<action name=
\"
Execute
\"
>
<execute>
$sv
force-restart
$path
</execute>
</action>
</item>
<item label=
\"
force-shutdown
\"
>
<action name=
\"
Execute
\"
>
<execute>
$sv
force-shutdown
$path
</execute>
</action>
</item>
</menu>"
}
## Read directories
check_path
(){
if
[[
"
$shortname
"
!=
"supervise"
]]
;
then
if
[[
-d
"
$i
"
]]
;
then
echo
"<menu id=
\"
$path
/
$shortname
\"
label=
\"
$shortname
\"
execute=
\"
$0
$path
/
$shortname
\"
/>"
else
menu_editor
fi
fi
}
################# Menu for service started ###########
menu_started
(){
## Browser
head
## Status of the service
status
## Display menu for log
if
[[
((
$(
echo
"
$path
"
|
grep
log
)
!=
""
))
&&
((
$(
echo
"
$path
"
|
grep
socklog
)
=
""
))
]]
;
then
menu_log
fi
## Check directories
for
i
in
$list
;
do
shortname
=
"
${
i
##*/
}
"
check_path
done
## Display menu
if
[[
$(
echo
"
$path
"
|
grep
/var/service/
)
]]
;
then
if
[[
$(
echo
"
$path
"
|
grep
main
)
=
""
]]
;
then
control
fi
fi
}
############## Menu for service available #########
menu_available
(){
path
=
"/etc/sv"
head
for
i
in
$path
/
*
;
do
shortname
=
"
${
i
##*/
}
"
if
[[
-d
"
$i
"
]]
;
then
echo
"<menu id=
\"
$shortname
\"
label=
\"
$shortname
\"
>
<item label=
\"
Enable
\"
>
<action name=
\"
Execute
\"
>
<execute>
sudo ln -sf
$path
/
$shortname
/var/service
</execute>
</action>
</item>
</menu>"
fi
done
}
############## let's go ###################
if
[[
"
$path
"
=
"/var/service"
]]
;
then
start_pipe
echo
"<menu id=
\"
started
\"
label=
\"
Started
\"
>"
menu_started
echo
"</menu>"
echo
"<menu id=
\"
available
\"
label=
\"
Available
\"
>"
menu_available
echo
"</menu>"
end_pipe
else
start_pipe
menu_started
end_pipe
fi
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