Commit graph

10 commits

Author SHA1 Message Date
Adam Duskett bc66a64193 package/openrc: cleanup sysv-rcs script
Currently, the sysv-rcs script has two issues:
  - The return code of each RCS script is not checked.
  - The output does not match the formatting of the other openrc
    init scripts.

Modify the script in the following ways to fix both issues:
  - Remove the "einfo "Starting sysv rc scripts"" at the top of the
    start function in favor of "einfo "Starting $i" in the loop
    itself.

  - Add a "> /dev/null" to the end of $i start; this suppresses
    stdout while still allowing for stderr messages to print to the
    terminal.

  - add an "eend $? to both the start and stop functions, this
    allows for openrc to show if an RCS script returned 0 or
    not.

The following is the startup output of OpenRC on a minimal system
with S01syslogd modified to exit with a return code 1 for testing
purposes:

Before:
 * Adding static routes ...
 [ ok ]
Starting default runlevel
 * Starting sysv rc scripts
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK

After:
 * Adding static routes ...
 [ ok ]
Starting default runlevel
 * Starting /etc/init.d/S01syslogd ...
 [ !! ]
 * Starting /etc/init.d/S02klogd ...
 [ ok ]
 * Starting /etc/init.d/S02sysctl ...
 [ ok ]

Signed-off-by: Adam Duskett <aduskett@greenlots.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-12-21 23:02:36 +01:00
Adam Duskett 3945226a7e package/openrc: install sysv-rcs file
package/openrc has the file sysv-rcs which starts sysvinit services
not written for openrc. However, currently it is not installed to
the target.

Install this file to $(TARGET_DIR)/etc/init.d during the
target_install step.

Signed-off-by: Adam Duskett <aduskett@greenlots.com>
[yann.morin.1998@free.fr: use full-path for destination, not just dir]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2019-12-19 22:21:49 +01:00
Michał Łyszczek 39950aae00 package/netifrc: new package
netifrc entirely replaces openrc's basic network management. As such, it
conflicts with the network services installed by openrc, so we remove
them from openrc when netifrc is enabled.

Currently, we only catter tfor the loopback interface, but we prepare
for also handling the DHCP interface, to come in a latter patch.

Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
[yann.morin.1998@free.fr:
  - remove openrc files within the openrc package itself
  - as it's a generic-package, no need to use post-install hooks
  - use description from the homepage in the help text
  - check-package fixes
  - rename package
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
[Thomas:
 - pass UDEVDIR to install udev rules at the correct location]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-09-23 22:53:54 +02:00
Michał Łyszczek 4019559de0 package/openrc: add support for spawning getty
We install a template getty service, and we 'instantiate' it in the
default runlevel, using the configured tty.

Ideally, packages that provide a getty program would be responsible
for installing the corresponding service file. However, to keep
consistency with the existing init systems (busybox, systemd, and
sysv), so we do provide it from the openrc package itself.

OpenRC only acts on the files in a runlevel sub-directory, but the
documentation [0] actually suggests that the instance symlink be done
in init.d, and then again symlinked into the actual runlevel
sub-directory. So, we abide by the rules.

Also, to be noted, the getty service file is installed without ensuring
that a getty command is available. This again is not unlike other init
systems, sysvinit and busybox, which behave the same.

[0] https://wiki.gentoo.org/wiki/OpenRC

Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
[yann.morin.1998@free.fr:
  - move getty template to openrc package  (Thomas)
  - fix namespace of the vaiables (Thomas)
  - simplify creation of the defaults file
  - rewrite commit log
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-09-23 22:29:28 +02:00
Michał Łyszczek 162044407b package/skeleton-init-openrc: add support for starting sysv scripts
Add an OpenRC service that starts and stops sysv-init scripts. We order
that script 'after local' so that it is started after all other native
openrc services.

Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
[yann.morin.1998@free.fr:
  - don't propagate the micro optimisation for running .sh scripts
  - use spaces, not TABs
  - stop services in reverse order
  - reword commit log
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-09-23 22:29:28 +02:00
Michał Łyszczek 6d61bf8cdb package/openrc: change /run/lock from root:uucp to root:daemon
On gentoo /run/lock is owned by uucp group because of historical
reasons. However uucp does not exist on buildroot by default, and
it makes more sense that 'daemon' group should own this directory.

Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-05-18 23:25:08 +02:00
Michał Łyszczek ab22fd278b package/openrc: add patch to support busybox version of sysctl
Busybox version of sysctl does not support --system argument, and
files need to be loaded one by one. This patch adds code to sysctl
service in openrc to recognize busybox sysctl and execute proper
function based on that.

Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-05-18 23:24:49 +02:00
Michał Łyszczek eb77734d11 system/Config.in: add new init - openrc
This is very basic settings for openrc init.

* system/Config.in
  Allows to select openrc as init system (which auto selects
  openrc-skeleton and openrc package).

* package/ifupdown-scripts/Config.in
  openrc has its own service to bring up/down interfaces, so
  ifupdown-scripts should not be enabled when openrc is enabled to
  prevent service clash.

Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
[Thomas: take into account the !BR2_STATIC_LIBS dependency]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-05-18 23:16:04 +02:00
Thomas Petazzoni a7314d842e package/openrc: add missing mmu and !static dependencies
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-05-18 23:07:09 +02:00
Michał Łyszczek e6cf089741 package/openrc: new package
This adds openrc init system package. This performs default openrc
installation with openrc-init that acts as pid1.

MKPKGCONFIG=no:
openrc does not use pkg-config per se, if MKPKGCONFIG is enabled,
it will just install *.pc files on rootfs for other programs to
find librc and libeinfo. These libs expose C api to control openrc
(al rc-* functions use it). From the looks of it, these libs would
be usefull if user wanted to write his own programs to manage
services, and vast majority of people using openrc won't need it.
Also, that's the reason why there is not INSTALL_STAGING=yes.

Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-05-18 22:43:44 +02:00