Skip to content

openrc-wrapper - using some openrc scripts with systemd and other init systems

Notifications You must be signed in to change notification settings

vaeth/openrc-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

openrc-wrapper

Using some openrc scripts with systemd and other init systems

(C) Martin Väth (martin at mvath.de). The license of this package is the GNU Public License GPL-2. SPDX-License-Identifier: GPL-2.0-only

This script has been splitted from the squash_dir project

https://github.com/vaeth/squash_dir/

because the latter project has essentially been replaced by squashmount

https://github.com/vaeth/squashmount/

except for the openrc-wraper which is of independent interest and which will be further developed only here - the version in squash_dir is frozen. Moreover, some independent systemd init-scripts are provided here.

openrc-wrapper works only for relatively simple openrc initscripts: If the initscripts are simple enough, openrc-wrapper might even be able to start/stop them even if openrc is not installed at all (although the output might look better if openrc is installed).

Usage

The usage is extremely simple: If you have an openrc init script

/etc/init.d/SERVICE

possibly with a configuration file

/etc/conf.d/SERVICE

you just start/stop this service by calling

/bin/openrc-wrapper SERVICE start

or

/bin/openrc-wrapper SERVICE stop

respectively. Note that this does not really start/stop the service in the sense of openrc but just executes the corresponding function of the initscript (in an environment which somewhat emulates the openrc environment). In addition, if the openrc init script registered additional COMMANDS like store/restore/... you can also use:

openrc-wrapper SERVICE COMMAND

Example calls from the command line

  • openrc-wrapper alsasound save
  • openrc-wrapper alsasound restore

Examples for systemd

A typical systemd service using an openrc initscript will contain

ExecStart=/bin/openrc-wrapper SERVICE start

and possibly also

ExecStop=/bin/openrc-wrapper SERVICE stop

Some examples are in the provided systemd/system folder.

Installation

For installation, just copy bin/* into /bin and, at your discretion, the provided systemd initscripts systemd/system/* into your systemd unit folder. In order to get zsh completion support, also copy zsh/_openrc-wrapper somewhere into your zsh's $fpath. Thus, a typical manual installation looks like this (after you did cd into the project's directory):

cp bin/* /bin
cp systemd/system/* "`pkg-config --variable=systemdsystemunitdir systemd`"
cp zsh/* /usr/share/zsh/site-functions

(For gentoo there is an ebuild in the mv overlay which does this).

About

openrc-wrapper - using some openrc scripts with systemd and other init systems

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages