Convert Figma logo to code with AI

OpenRC logoopenrc

The OpenRC init system

1,544
256
1,544
171

Top Related Projects

The Void source packages collection

2,177

[MIRROR] Official Gentoo ebuild repository

13,628

The systemd System and Service Manager

Quick Overview

OpenRC is a dependency-based init system for Unix-like operating systems. It is designed to be lightweight, flexible, and compatible with various Linux distributions and BSD systems. OpenRC manages system services and handles the boot process, offering a more modular approach compared to traditional SysV init systems.

Pros

  • Lightweight and fast, with minimal resource usage
  • Highly configurable and customizable
  • Compatible with multiple Unix-like operating systems
  • Supports parallel service startup for improved boot times

Cons

  • Less widely adopted compared to systemd in many modern Linux distributions
  • May require more manual configuration compared to some other init systems
  • Limited integration with some modern Linux features (e.g., cgroups, namespaces)
  • Smaller ecosystem of tools and documentation compared to more popular init systems

Getting Started

To get started with OpenRC, follow these steps:

  1. Install OpenRC on your system (method varies by distribution)
  2. Configure your system to use OpenRC as the init system
  3. Create or modify service scripts in /etc/init.d/
  4. Manage services using OpenRC commands:
# Start a service
rc-service servicename start

# Stop a service
rc-service servicename stop

# Add a service to default runlevel
rc-update add servicename default

# Remove a service from default runlevel
rc-update del servicename default

# View enabled services
rc-update show

Note: The exact installation and configuration process may vary depending on your operating system and distribution. Consult your distribution's documentation for specific instructions.

Competitor Comparisons

The Void source packages collection

Pros of void-packages

  • Larger and more active community with frequent updates
  • Broader scope, covering package management for an entire Linux distribution
  • More comprehensive documentation and user guides

Cons of void-packages

  • More complex structure due to its broader scope
  • Steeper learning curve for contributors
  • Potentially slower review process due to the larger codebase

Code Comparison

openrc:

static int svc_start(struct service *service)
{
    pid_t pid;
    int status;

    if (service->pid != 0)
        return 1;

void-packages:

do_install() {
    vbin ${wrksrc}/bin/xbps-create
    vbin ${wrksrc}/bin/xbps-dgraph
    vbin ${wrksrc}/bin/xbps-install
    vman ${wrksrc}/man/xbps-create.1
}

Summary

openrc focuses on init system and service management, while void-packages is a package management system for the Void Linux distribution. openrc has a more specialized codebase, primarily in C, while void-packages uses shell scripts for package definitions and build processes. void-packages offers a wider range of functionality but may be more challenging for newcomers to contribute to compared to the more focused openrc project.

2,177

[MIRROR] Official Gentoo ebuild repository

Pros of gentoo

  • Comprehensive repository covering the entire Gentoo Linux distribution
  • Larger community and more active development
  • Includes a wide range of packages and ebuilds for system customization

Cons of gentoo

  • More complex and potentially overwhelming for new users
  • Requires more system resources and time for management
  • Less focused on init system specifics compared to OpenRC

Code comparison

openrc:

#!/sbin/openrc-run
command="/usr/sbin/example_daemon"
pidfile="/var/run/example.pid"

gentoo:

# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DESCRIPTION="Example package"
HOMEPAGE="https://example.com"
SRC_URI="https://example.com/${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"

The openrc repository focuses on init scripts and service management, while the gentoo repository contains ebuilds for package management and system configuration. The code examples highlight this difference, with openrc showing a typical init script and gentoo displaying an ebuild structure for package installation and management.

13,628

The systemd System and Service Manager

Pros of systemd

  • Faster boot times and parallel service startup
  • Unified system and service management with extensive features
  • Better dependency handling and service isolation

Cons of systemd

  • Complex and monolithic design, potentially harder to troubleshoot
  • Steeper learning curve for system administrators
  • Less adherence to Unix philosophy of simple, modular tools

Code Comparison

systemd service file:

[Unit]
Description=My Service
After=network.target

[Service]
ExecStart=/usr/bin/myservice
Restart=always

[Install]
WantedBy=multi-user.target

OpenRC service file:

#!/sbin/openrc-run

name="My Service"
command="/usr/bin/myservice"
command_background=true
pidfile="/var/run/${RC_SVCNAME}.pid"

depend() {
    need net
}

systemd uses declarative configuration files, while OpenRC uses shell scripts for service definitions. systemd's approach is more structured but less flexible, while OpenRC offers more customization at the cost of potential complexity in larger scripts.

Both systems aim to manage services efficiently, but systemd provides a more comprehensive suite of tools for system management, while OpenRC focuses on simplicity and follows traditional Unix conventions more closely.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

OpenRC README

OpenRC is a dependency-based init system that works with the system-provided init program, normally /sbin/init.

building and installing

OpenRC uses the meson build system, so use the usual methods for this build system to build and install.

Notes

We don't support building a static OpenRC with PAM.

PKG_PREFIX should be set to where packages install to by default.

LOCAL_PREFIX should be set to where user maintained packages are. Only set LOCAL_PREFIX if different from PKG_PREFIX.

rc and rc.shutdown are the hooks from the BSD init into OpenRC.

devd.conf is modified from FreeBSD to call /etc/rc.devd which is a generic hook into OpenRC.

inittab is the same, but for SysVInit as used by most Linux distributions. This can be found in the support folder.

Obviously, if you're installing this onto a system that does not use OpenRC by default then you may wish to backup the above listed files, remove them and then install so that the OS hooks into OpenRC.

If you are installing this onto a system which has separate / and /usr file systems and expects / to be mounted before /usr, you will need to make sure the appropriate pieces are installed on / by passing the appropriate options to "meson setup" as follows:

$ meson setup \
        --bindir /bin --libdir /lib64 --libexecdir /lib --sbindir /sbin \
        build_path

Discussions

We are testing discussions, so feel free to open topics there.

Reporting Bugs

Please report bugs on our bug tracker.

If you can contribute code , please feel free to do so by opening pull requests.

IRC Channel

We have an official irc channel, #openrc on the libera network. Please connect your irc client to irc.libera.chat and join #openrc on that network.