Commit Graph

39 Commits

Author SHA1 Message Date
William Hubbs
5f890ee8ab init.sh: rework the /run setup for linux xystems
- fix mount options for /run.
- run restorecon after everything is set up.

X-Gentoo-Bug: 740576
X-Gentoo-Bug-URL: https://bugs.gentoo.org/740576
2021-03-22 15:47:21 -05:00
William Hubbs
5427783fdf standardize the default shell
I do not know of a need to have the default shell be a build-time
configurable setting. All *nix systems I am aware of have /bin/sh as a
default posix compatible shell.
If some systems running OpenRC do not make that assumption about
/bin/sh, I will consider bringing this back, so feel free to open an
issue.
2018-12-08 12:06:26 -06:00
Jason Zaman
5bb6f9aa31 init.sh: apply SELinux label for /run early in boot
Some initramfs mount /run which then ends up with the wrong labels.
Force relabel all of /run right after its mounted to fix.
2018-02-28 12:42:58 -06:00
William Hubbs
d3f833179b sh/init.sh.Linux.in: remove unused check for Gnu/KFreeBSD
This script only runs on Linux, so the check will always be false.
2016-12-18 11:53:12 -06:00
Doug Freed
856eafb006 sh/init.sh.Linux.in: skip /proc test if no md5sum
This will also warn users if md5sum is missing, which serves as a pretty
good indicator that /usr is not mounted.
2016-12-17 23:27:37 +00:00
Doug Freed
8ad460c54c Fix typos
Fixes #99
2016-12-17 18:41:02 +00:00
William Hubbs
bbf98befb8 sh/init.sh.Linux.in: update test for live /proc to use md5sum
This allows us to avoid the warnings from bash-4.4 about null bytes in
command substitutions.

If you have separate /usr, are not using an initramfs, and have a file
called /proc/self/environ on your root file system, this will break.
X-Gentoo-Bug: 594534
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=594534
2016-09-22 17:37:09 -05:00
William Hubbs
ac53c9a658 sh/init.sh: fix the test for cache restoration
This fixes the test for cache restoration since we are no longer caching
the dependency tree.
2016-09-12 12:58:31 -05:00
William Hubbs
cc9c23c848 Complete support for rc.conf.d
- gendepends.sh needs to read this directory to allow dependencies to be
  overridden
  - init.sh for Linux and Bsd need to read it to allow config settings
    they use to be overridden.
2015-12-09 12:38:10 -06:00
William Hubbs
cdc0dd061b init-Linux.sh: do not mount /run with nosuid
This is so that we will be consistent with the systemd spec forr the
/run directory mentioned in this wiki article:

http://www.freedesktop.org/wiki/Software/systemd/InitrdInterface/
2014-01-18 02:34:39 -06:00
William Hubbs
7b5fa011ac Rename the rc binary to openrc
Debian requested this rename due to the "rc" binary conflicting with the
"rc" binary from the plan 9 shell.

We also add a deprecation warning to the binary when it is run as rc to
encourage users to switch to openrc instead.

X-Gentoo-Bug: 493958
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=493958
2013-12-12 18:31:29 -06:00
Andrew Gregory
cd4becf6cd make init.sh and init-early.sh honor SYSCONFDIR
Fixes hardcoded paths that break when built with SYSCONFDIR
set to anything other than /etc/

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2013-02-16 19:56:47 -06:00
William Hubbs
b00f85864d Set a default size for /run on Linux
Reported-by: alpiturchi@gmail.com
X-Gentoo-Bug: 447076
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=447076
2012-12-22 08:37:45 -06:00
William Hubbs
b44f96ac9b init.sh.Linux: do not try to remove the /run/openrc symlink
In order to make migration from /lib*/rc/init.d to /run/openrc possible
without rebooting, the migration script creates a symlink from
/run/openrc to /lib*/rc/init.d. We were trying to remove it on the next
reboot, but this is not possible since / is ro when /run is mounted.

Reported-by: fturco@fastmail.fm
X-Gentoo-Bug: 447678
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=447678
2012-12-19 11:42:32 -06:00
William Hubbs
230a678824 init-linux: Do not remove the $rc_libexecdir/init.d directory
Reported-by: toralf.foerster@gmx.de
X-Gentoo-Bug: 446342
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=446342
2012-12-07 09:39:12 -06:00
William Hubbs
e5173b9127 migrate-to-run: do not require a reboot
The script that migrates the @libexecdir@/rc/init.d directory to
/run/openrc should not require a reboot.

Reported-by: chainsaw@gentoo.org
2012-12-06 16:43:24 -06:00
William Hubbs
a5b4fab732 fix handling of /run for vserver
Mount can't be used in vservers, but /run is still needed. So we create
the directory and clear it out instead of mounting a tmpfs in that
situation.

reported-by: <patrick@gentoo.org>
X-Gentoo-Bug: 423739
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=423739
2012-07-02 13:22:04 -05:00
William Hubbs
82d3918d7a move rc_svcdir to /run/openrc on Linux systems
If you are not using linux, this should not affect you.

If you are using linux, from this point forward, openrc requires the
/run directory to be a mounted tmpfs. If it is, you can run
@LIBEXECDIR@/sh/migrate-to-run.sh as root to migrate your dependency
tree and state information to the new location. If it is not, you must
create the /run directory as root with permissions 755 then reboot your
system.

reported-by: Maxim Kammerer <mk@dee.su>
X-Gentoo-Bug: 401059
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=401059
2012-05-14 13:49:06 -05:00
William Hubbs
9e196a71ad clarify the message about /proc being already mounted
This message was being taken by some users as an error, so I have
removed the part about "skipping..." Hopefully this will make the
message less alarming.
2012-05-02 14:48:52 -05:00
Christian Ruppert
e14e78db16 Revert "Mount /run as early as possible"
This reverts commit 5ed4d084d9.
/run needs to be mounted after /proc.
2011-09-12 22:15:24 -05:00
William Hubbs
5ed4d084d9 Mount /run as early as possible
This commit moves the code that mounts /run to the earliest possible
position in openrc.
2011-09-06 21:00:08 -05:00
Mike Frysinger
d0bc4f20ad drop useless "All rights reserved" notice
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-06-29 19:46:31 -04:00
Mike Frysinger
3d56124ed1 only warn about /run if it exists
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-05-16 18:49:21 -04:00
William Hubbs
b6409feaac fix permissions for /run/lock
If /run/lock is a directory, set the ownership and permissions for it,
whether or not we created the directory.
2011-04-19 10:56:14 -05:00
Amadeusz Żołnowski
64ef51ab09 Add support for /run directory
This is a new directory for storing volatile runtime data.
See https://lwn.net/Articles/436012

X-Gentoo-Bug: 363971
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=363971
2011-04-18 15:26:13 -05:00
William Hubbs
1d63e85794 rework test for mounted /proc
The previous test assumed that we could always rely on the minor fault
counter to change between reads of /proc/self/stat, but we found that
this is not the case.

The new test compares two reads of /proc/self/environ for which we have
set the same environment variable to two different values.
If the comparison shows the two reads have the same contents, we know
that /proc is not working.

I would like to thank Robin Johnson and Mike Frysinger for their input
for this patch.

X-Gentoo-Bug: 348416
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=348416
2011-03-24 19:14:16 -05:00
Robin H. Johnson
80853f5dbc sh/init: Detect a mounted /proc without sleeping
Previously we checked if /proc was alive by reading /proc/uptime twice
with a 1 second sleep between calls, so that it had time to update.
This got a complaint of an entire 1 second delay, so we improve the
check to be much faster without sleep. We cannot continue to use
/proc/uptime as it only has a 10ms resolution.

X-Gentoo-Bug: 348416
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=348416
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2011-01-18 01:29:09 +00:00
Mike Frysinger
faa2df1159 more whitespace cleanup
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-17 04:49:12 -05:00
Robin Johnson
80d5f7d27b fix selinux context for rc-svcdir (bug #347503) 2010-12-03 23:49:34 -06:00
Juan RP
59b08643f1 Mount xenfs early so OpenRC can detect it. 2010-02-26 09:34:43 +00:00
Roy Marples
ec38bbbdda If mounting tmpfs fails, try ramfs.
This is because buggy kernels always report tmpfs even when not present.
2009-11-20 00:04:32 +00:00
Roy Marples
c0fd1b49e4 Move non compiled libraries from /lib/rc to /libexec/rc
OpenRC version is now stored as plaintext in /libexec/rc/version

Plugins (cursplash, splashutils) will have to be re-compiled to pickup
the new directories. State data needs to be moved from /lib/rc/init.d
to /libexec/rc/init.d as well.
2009-05-23 20:38:12 +01:00
Roy Marples
658a220638 Add (c) to Copyright 2009-05-01 15:11:40 +01:00
Roy Marples
2b866f264f Stop using needless {} in vars 2009-04-26 21:13:26 +00:00
Roy Marples
0af7d5bc20 Add a new shutdown runlevel, Gentoo #224537.
Split halt.sh into halt, killprocs, romount and savecache services.
The reboot runlevel is removed but mapped to shutdown.
The halt script should be moved to the sysvinit package.
2008-11-03 15:31:01 +00:00
Roy Marples
d6da8e8c48 sysinit is now a real runlevel that handles things like udev, dmesg and
mounting various bits in /dev and /sys.
init.sh JUST mounts /lib/rc/init.d (and /proc for Linux systems)
To make development of this easier we now return an empty RC_STRINGLIST
instead of a NULL for empty things.

If you don't have a udev init script installed, don't reboot your box OR
roll back to an older OpenRC version.
2008-10-10 08:37:21 +00:00
Roy Marples
a3c8706618 Allow OpenVZ to mount /sys and device managers, #102 2008-08-19 15:27:15 +00:00
Roy Marples
dcdfdb442f Some systems are only detectable after /proc is mounted, so re-test if unknown. 2008-04-06 20:06:07 +00:00
Roy Marples
55858eca2e .sh.BSD.in is a better extension. 2008-03-26 14:02:59 +00:00