Commit graph

18 commits

Author SHA1 Message Date
Heiko Thiery 2d38c5a4e5 package/openrc: add upstream security fix for CVE-2018-21269
Cc: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2020-11-23 22:46:15 +01:00
Heiko Thiery 9d40f49dbb package/openrc: fix build with gcc 10
Fixes:
 - https://bugs.busybox.net/show_bug.cgi?id=13331

Cc: mscdex@mscdex.net
Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2020-11-23 22:44:01 +01:00
Adam Duskett 1eff2c637e package/openrc: enable selinux support when libselinux is enabled
OpenRC suports SELinux, so there is no reason to forcibly disable it.

Notice this only allows OpenRC to perform the initial policy load and
set the enforcing mode. In order really use SELinux it's also
necessary to select refpolicy, which provides a policy, and
policycoreutils, which provides restorecon and other SELinux
utilities.

Signed-off-by: Adam Duskett <Aduskett@gmail.com>
Signed-off-by: Carlos Santos <unixmania@gmail.com>
Tested-by: Carlos Santos <unixmania@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2020-04-17 22:09:05 +02:00
Adam Duskett 5bcf91b81d package/openrc: bump to version 0.42.1
Add a patch to prevent starting agetty on tty[1-6]. Buildroot starts a
single getty, according to the system configuration. Also tty[1-6] may
not even exist (e.g. embedded devices with serial consoles only).

Signed-off-by: Adam Duskett <Aduskett@gmail.com>
Signed-off-by: Carlos Santos <unixmania@gmail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2020-03-11 18:20:07 +01:00
Carlos Santos cd7dcf83bc package/openrc: drop custom getty service
In Buildroot getty is provided by BusyBox or util-linux (agetty). Both
create a /sbin/getty symlink pointing to the actual program, so make the
agetty service use that path instead of /sbin/agetty.

Also start agetty after all other services, to prevent mixing startup
messages with the getty prompt on devices with a single serial console,
as the custom unit we're dopping was doing already.

This allows us to drop the custom getty service, which causes an error
message from openrc 0.42.1 (in a forthcoming patch):

    Error: getty is the name of a real and virtual service.

The patches are required because it's not possible to override the
command or startup order by means of a configuration file. Anyway it's
still better to patch something maintained upstream than depending on a
custom piece that may easily become obsolete.

Signed-off-by: Carlos Santos <unixmania@gmail.com>
[yann.morin.1998@free.fr:
  - expand commit log to explain why we ve 'after *' in the same patch
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2020-03-11 17:46:41 +01:00
Carlos Santos 0acd05423d package/openrc: remove keymaps units if kbd package is not selected
keymaps and save-keymaps require kbd_mode and dumpkeys, respectively, so
remove them if the kbd package is not selected (e.g. devices with serial
console, only).

Signed-off-by: Carlos Santos <unixmania@gmail.com>
Tested-by: Adam Duskett <aduskett@gmail.com>
[yann.morin.1998@free.fr:
  - expand to three commands to match the existing hook
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2020-02-29 22:14:50 +01:00
Carlos Santos 4e3e53483c package/openrc: fix post-install-target addition
OPENRC_POST_TARGET_INSTALL_HOOKS -> OPENRC_POST_INSTALL_TARGET_HOOKS

Signed-off-by: Carlos Santos <unixmania@gmail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2020-02-29 19:24:16 +01:00
Yann E. MORIN 4cc586695f package/openrc: needs kmod
openrc provides scripts that have been written for the big-gun kmod, and
so use options unknown to the busybox' provided applets:

  - Busybox modprobe does not have a "--first-time" option,
  - the "--verbose" option is just "-v",
  - the "--use-blacklist" option is just "-b". Also blacklist support is
    not selected in our default busybox configuration.

One of two options, is to "fix" or "adapt" openrc's scripts to busybox,
which means for the openrc package to go peek into files from the
busybox package, which is not nice, and can't work because that is not
available by the time we scan our Makefiles.

The other option, which this patch implements, is to just add a
dependency onto kmod and its tools.

Reported-by: Carlos Santos <unixmania@gmail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Peter Korsgaard <peter@korsgaard.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Tested-by: Carlos Santos <unixmania@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2020-02-29 17:47:47 +01:00
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