Commit Graph

333 Commits

Author SHA1 Message Date
William Hubbs
60d288a877 remove type command
The posix equivalent of the type command is "command -v", so now we use
that. Thanks to Jonathan Callen <jcallen@gentoo.org> for informing me
wrt the fix.
2013-12-02 02:08:40 -06:00
Mike Frysinger
af30c4b86e functions.sh: yesno: (mostly) fix eval logic
We need to quote the expansion.

X-Gentoo-Bug: 475032
X-Gentoo-Bug: https://bugs.gentoo.org/475032
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-11-30 16:33:31 -05:00
William Hubbs
6965d85f2e Fix the service-level rc_verbose setting
This commit fixes the rc_verbose setting so that it is honored if it is
set for an individual service.

Thanks to whissi@whissi.de for the original patch; this one is slightly
modified to be more posix.

X-Gentoo-Bug: 489358
X-Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=489358
2013-10-31 16:04:19 -05:00
William Hubbs
993e7d7044 fix cgroup_cleanup function
The yesno test for rc_cgroup_cleanup belongs at the point where this
function is called from runscript, not in the function itself.

X-Gentoo-Bug: 486210
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=486210
2013-09-27 15:55:46 -05:00
William Hubbs
838c9efb36 Remove gentoo's net.* scripts
It has been determined that it will be best for gentoo's net.* scripts
to be in a separate package to allow independent development.
This package will be called netifrc and maintained by Gentoo.
2013-08-13 16:33:41 -05:00
Dirk Sondermann
e90dcf39dd tmpfiles: do not signal an error if device nodes already exist
X-Gentoo-Bug: 478336
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=478336
2013-07-27 10:53:32 -05:00
William Hubbs
bee59c68c5 rc-cgroup: make sure the tasks file exists before adding the pid 2013-07-25 20:33:51 -05:00
William Hubbs
e9189cd8a2 tmpfiles: add --prefix and --exclude-prefix options 2013-07-25 00:58:38 -05:00
William Hubbs
19579687fd tmpfiles: make b and c commands set ownership and permissions
The b and c commands in tmpfiles.sh were not setting ownership and
permissions for the device nodes.
2013-07-23 17:58:42 -05:00
Hank Leininger
3af434a4e9 typo fix
X-Gentoo-Bug: 477006
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=477006
2013-07-16 17:12:45 -05:00
William Hubbs
a7a6092f01 cgroups: change '$$' to 0 for consistency 2013-07-05 11:04:45 -05:00
William Hubbs
88cdcc145e Merge branch 'cgroup.systemd'
Conflicts:
	sh/rc-cgroup.sh.in
2013-07-05 10:38:51 -05:00
Alexander V Vershilov
992807de55 Put a service on into a top hierarchy of each cgroup
This change will fix unwanted cgroup inheriting from user cgroups,
and fixes issues with systemd cgroup tracking by logind.

However this fix can lead to incorrect work for some user cgroup
controllers - so more advanced solution, that coveres such cases
will be created later.

Thanks to Fabio Erculiani (lxnay) for testing and general idea.
2013-07-01 09:18:02 +04:00
William Hubbs
2391ddff77 cgroups: add support for systemd cgroup hierarchy
The systemd cgroup hierarchy support is being added so we can run
logind outside of systemd. This is needed because software that was
using consolekit is now migrating to logind.
We do not create this hierarchy, we just add services to it if it
exists.
2013-06-25 10:58:27 -05:00
Alexander V Vershilov
9f14fd7ae1 Fix quoting in cgroup-release-agent 2013-06-16 14:22:23 -05:00
Alexander V Vershilov
dce989e96d cgroups: hide messages about non-existent processes 2013-06-16 14:14:30 -05:00
William Hubbs
e451d173fa runscript.sh: run cgroup_cleanup automatically after stop 2013-05-25 21:04:10 -05:00
Alexander V Vershilov
b5cb1f5020 rc_cgroup.sh: fix typo
This fixes an incorrect variable assignment in cgroup_get_pids
2013-05-25 19:58:08 -05:00
William Hubbs
248434329b fix setfont detection in early startup on Linux
Most of the time, setfont is an external command (part of the kbd
package), but it can also be a builtin if busybox is being used. This
corrects the test in early startup to work for both cases. I would like
to thank Steve L. for pointing this out.
2013-05-05 13:47:45 -05:00
Alexander Vershilov
c984506537 add cgroup cleanup support
This adds the ability to kill all processes within a service's cgroup
when that service is stopped or restarted.
2013-04-25 16:59:19 -05:00
William Hubbs
9314ac64ea migrate-to-run: fix test for successful migration
This script originally tested the file system type for the source
location of the data we were migrating to determine if the migration was
complete. Now we test the destination, and if the softlevel file is
there the migration was successful.

Reported-by: Piotr Karbowski <piotr.karbowski@gmail.com>
2013-04-03 11:25:19 -05:00
William Hubbs
6794441224 Make fuser command time out
This avoids situations in which fuser hangs because of open files on
remote file systems when the remote system goes down.
I have also passed this bug on to the maintainers of psmisc since it
should really be fixed in fuser.
This is based on a patch submitted by evermind@tuxfamily.org

Reported-by: evermind@tuxfamily.org
X-Gentoo-Bug: 455458
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=455458
2013-03-12 12:57:44 -05:00
William Hubbs
274d6eee66 tmpfiles: add support for the new X line type
tmpfiles now has a new line type, X, which is similar to the x line type
used by the cleanup function.
This is not supported yet by OpenRc, because we do not have the cleanup
function in tmpfiles.sh, so I have added a dummy procedure for it so
we don't get complaints about this line type.

Reported-by: mgorny@gentoo.org
X-Gentoo-Bug: 460880
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=460880
2013-03-11 01:03:06 -05:00
Andrew Gregory
a82a2b5f7c include BINDIR and SBINDIR in the sanitized PATH
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2013-02-23 20:30:40 -06:00
Andrew Gregory
8a44067838 Fix shebangs in services to point to the correct location of runscript
SBINDIR and BINDIR can be set independently of PREFIX.  This fixes
broken shebangs in service files when SBINDIR is set to something other
than PREFIX/sbin

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2013-02-23 20:30:39 -06:00
William Hubbs
fac96b4df4 cgroups: major update to cgroups support
This reworks cgroups support so we have one variable in rc.conf for each
controller instead of each setting.

Also we add support for all of the possible cgroup controllers.

I would like to thank Alexander Vershilov for his help with testing and
reworking this code.
2013-02-19 17:09:30 -06:00
William Hubbs
ebf85d598e cgroups: fix shebang line in rc-cgroup.sh 2013-02-19 16:52:49 -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
Andrew Gregory
746bf5f783 consolefont: use setfont to save the current font
Using setfont directly to save the font prevents breakage
when a distro stores consolefonts in a location other than
/usr/share/consolefonts such as Arch which stores them in
/usr/share/kbd/consolefonts

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2013-02-16 19:51:15 -06:00
Alexander Vershilov
b46747f998 Add module for cgroup processing
sh/rc-cgroup.sh.in: new script to handle cgroup processing
sh/rc-cgroup.sh.in: do not use grep or cut (modification by William Hubbs)
sh/runscript.sh.in: use the cgroup script
2013-02-16 01:28:35 -06:00
Mike Frysinger
8328b88360 rc-functions.sh: add ceph to net fs list
X-Gentoo-Bug: 452552
X-Gentoo-Bug-URL: https://bugs.gentoo.org/452552
Reported-by: Tomas Mozes <hydrapolic@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-01-16 22:17:45 -05:00
William Hubbs
cb31b13276 typo fix 2013-01-15 12:36:12 -06:00
William Hubbs
6b3a4110cc runscript: fix stopping changed service issues
If an init script or service was upgraded while it was running and the
settings for the pid file, command and process name were changed, it
would not be possible to stop the old service.

Runscript now saves the values it used to start the service and re-uses
them to stop the service.

Reported-by: flameeyes@gentoo.org
X-Gentoo-Bug: 434032
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=434032
2013-01-15 12:14:05 -06:00
William Hubbs
7bda62d844 udhcpc: fix resolv.conf setting for domain
The value that was supposed to be in the domain setting was being added
incorrectly to search.

Reported-by: bug@mejor.pl
X-Gentoo-Bug: 446862
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=446862
2012-12-22 09:38:38 -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
a9272f50f7 Do not add a prefix to the /run directory
This doesn't affect us on gentoo, but on archlinux, which has done the
/usr merge, OpenRC was looking for /run under PREFIX. /run is always at
the root level, so it shouldn't have prefix appended to it.

Reported-by: udeved@openrc4arch.site40.net
2012-12-03 18:33:21 -06:00
William Hubbs
0a72893c8b migrate-to-run: Remove old RC_SVCDIR after unmounting tmpfs
reporrrrted-by: netfab@gmail.com
X-Gentoo-Bug: 443996
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=443996
2012-11-25 21:27:36 -06:00
Alexander Vershilov
4f19c2f512 Support cpu usage management for Linux
This commit was modified by William Hubbs as follows:

- The paths in the cgroup fs were put into variables to ease
  maintenance.
- Documentation was added to rc.conf.Linux.
- The services were added originally to openrc/svcname cgroups under the
  controller cgroups, but this left an "openrc" cgroup which was unused.
  Now they are added to individual cgroups with the name openrc_${RC_SVCNAME}.
2012-11-12 10:58:00 -06:00
Robin H. Johnson
23f975dfcd checkbashisms: Fix redirection order.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2012-11-07 01:44:56 +00:00
Robin H. Johnson
1b0130961e checkbashisms: clean up export statements.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2012-11-07 00:22:33 +00:00
William Hubbs
ec60e20331 tmpfiles: fix bashism
reported-by: <pesa@gentoo.org>
2012-11-06 16:32:59 -06:00
Robin H. Johnson
4936b72e0f tmpfilesd: Doing both create+remove at the same time is valid.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2012-11-05 21:25:32 +00:00
Andrew Gregory
525c731f0e tmpfilesd: parse arguments with spaces
systemd allows the final arg in tmpfiles to contain spaces.  Using the read()
call to set the variables includes all trailing components in $arg so it
doesn't get cut off.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2012-10-21 19:50:54 -05:00
Andrew Gregory
5647946e61 tmpfiles: return success from _f/_F on empty $arg
'[ -n "$arg" ] && _w' causes _f/_F to return the failure from the test when
$arg is empty.  Inverting the test causes the test and _f/_F to return success.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2012-10-21 19:49:42 -05:00
William Hubbs
74c6b554bc tmpfiles: do not process systemd.conf
This file contains definitions specific to systemd, so we should not
process it.

Reported-by: <andrew.gregory.8@gmail.com>
2012-10-21 14:50:29 -05:00
William Hubbs
f886372749 functions.sh: do not hard code path in e* wrapper functions
We should use the "command" shell builtin to execute a binary from
within the wrapper with the same name. Hard coding the path to the
binary makes our test suite fail.
2012-10-17 17:55:02 -05:00
Robin H. Johnson
4ff71bd741 tmpfiles.d init.d scripts
Now that the tmpfiles.d code is more tested, actually call it from
init.d. It assumes that /run is already available when it runs.

Please note it runs TWICE.
- During sysinit, ideally just after /dev/shm is created, but before
  udev has started. After udev is also acceptable, but not ideal.
- During boot, ideally just after localmount has completed.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2012-09-26 15:42:37 -07:00