Commit 22829662 authored by Vitaly Lipatov's avatar Vitaly Lipatov

add initial openrc support

parent 35e2e84b
...@@ -71,7 +71,7 @@ case $DISTRNAME in ...@@ -71,7 +71,7 @@ case $DISTRNAME in
# CMD="pkg_add" # CMD="pkg_add"
# ;; # ;;
# Gentoo) # Gentoo)
# CMD="emerge" # CMD="eselect"
# ;; # ;;
# ArchLinux) # ArchLinux)
# CMD="pacman" # CMD="pacman"
......
...@@ -42,6 +42,9 @@ serv_disable() ...@@ -42,6 +42,9 @@ serv_disable()
systemd) systemd)
sudocmd systemctl disable $1 sudocmd systemctl disable $1
;; ;;
openrc)
sudocmd rc-update del $1 default
;;
runit) runit)
sudocmd rm -fv /var/service/$SERVICE sudocmd rm -fv /var/service/$SERVICE
;; ;;
......
...@@ -46,6 +46,9 @@ __serv_enable() ...@@ -46,6 +46,9 @@ __serv_enable()
systemd) systemd)
sudocmd systemctl enable $1 sudocmd systemctl enable $1
;; ;;
openrc)
sudocmd rc-update add $1 default
;;
runit) runit)
epm assure $SERVICE epm assure $SERVICE
[ -r "/etc/sv/$SERVICE" ] || fatal "Can't find /etc/sv/$SERVICE" [ -r "/etc/sv/$SERVICE" ] || fatal "Can't find /etc/sv/$SERVICE"
......
...@@ -33,6 +33,9 @@ serv_list() ...@@ -33,6 +33,9 @@ serv_list()
systemd) systemd)
sudocmd systemctl list-units $@ sudocmd systemctl list-units $@
;; ;;
openrc)
sudocmd rc-status
;;
*) *)
# hack to improve list speed # hack to improve list speed
[ "$UID" = 0 ] || { sudocmd $PROGDIR/serv --quiet list ; return ; } [ "$UID" = 0 ] || { sudocmd $PROGDIR/serv --quiet list ; return ; }
......
...@@ -36,6 +36,9 @@ serv_list_all() ...@@ -36,6 +36,9 @@ serv_list_all()
systemd) systemd)
sudocmd systemctl list-unit-files $@ sudocmd systemctl list-unit-files $@
;; ;;
openrc)
sudocmd rc-service -l
;;
*) *)
fatal "Have no suitable command for $SERVICETYPE" fatal "Have no suitable command for $SERVICETYPE"
;; ;;
......
...@@ -42,6 +42,9 @@ serv_restart() ...@@ -42,6 +42,9 @@ serv_restart()
runit) runit)
sudocmd sv restart "$SERVICE" sudocmd sv restart "$SERVICE"
;; ;;
openrc)
sudocmd rc-service restart "$SERVICE"
;;
*) *)
fatal "Have no suitable command for $SERVICETYPE" fatal "Have no suitable command for $SERVICETYPE"
;; ;;
......
...@@ -40,6 +40,9 @@ serv_start() ...@@ -40,6 +40,9 @@ serv_start()
runit) runit)
sudocmd sv up "$SERVICE" sudocmd sv up "$SERVICE"
;; ;;
openrc)
sudocmd rc-service start "$SERVICE"
;;
*) *)
fatal "Have no suitable command for $SERVICETYPE" fatal "Have no suitable command for $SERVICETYPE"
;; ;;
......
...@@ -40,6 +40,9 @@ serv_stop() ...@@ -40,6 +40,9 @@ serv_stop()
runit) runit)
sudocmd sv down "$SERVICE" sudocmd sv down "$SERVICE"
;; ;;
openrc)
sudocmd rc-service stop "$SERVICE"
;;
*) *)
fatal "Have no suitable command for $SERVICETYPE" fatal "Have no suitable command for $SERVICETYPE"
;; ;;
......
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