Commit Graph

2318 Commits

Author SHA1 Message Date
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
Natanael Copa
e4668a5061 Fix autodetection of lxc
The /proc/1/environ contains various \0 terminated strings. The current
code will only work when the search string is in the first of those.

To fix this we look for strings in entire buffer.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
2013-04-09 02:25:26 -05:00
William Hubbs
56f1752ce1 create loopback service
The loopback service handles the basic settings for the loopback
interface, regardless of the network manager you are using.
2013-04-08 12:46:51 -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
19fa20832c localmount: add "no" in front of network file system types
On Linux, this was not an issue, but we may have been attempting to
mount network file systems twice on *bsd.

Reported-by: powerman-asdf@yandex.ru
x-Gentoo-Bug: 462210
x-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=462210
2013-03-22 14:50:27 -05:00
William Hubbs
879c7f04ec runscript: update documentation for the provide function
Explain that virtual services take precedence over real services and
recommend that virtual services have different names from real services.

Reported-by: me@2gw.net
X-Gentoo-Bug: 461818
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=461818
2013-03-20 15:42:09 -05:00
William Hubbs
66dd88d6f6 config: move rc_fuser_timeout to rc.conf
I was told that fuser does exist on *bsd, so this will need to bee
supported there. This moves the timeout setting to rc.conf.
2013-03-12 14:16:41 -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
Yuta SATOH
f1ae8963c9 oldnet: convert netmask to decimal numbers in _netmask2cidr
Free BSD's ifconfig outputs a netmask in the form 0xffffff00, which
was translating to 0xff.0xff.0xff.0x00,. Now we convert this to decimal
numbers before we convert it to cidr notation.

Reported-by: 4glitch@gmail.com
X-Gentoo-Bug: 460268
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=460268
2013-03-08 15:30:36 -06:00
William Hubbs
3b05586a73 ipfw: change opts variable to extra_commands
Reported-by: 4glitch@gmail.com
X-Gentoo-Bug: 459694
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=459694
2013-03-06 12:48:20 -06:00
William Hubbs
ceb88fc465 local.d: update README
Remind users that if they put a long-running process in /etc/local.d,
they can delay their boot or shutdown processing.

Reported-by: toralf.foerster@gmx.de
X-Gentoo-Bug: 456650
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=456650
2013-02-25 16:04:25 -06:00
Andrew Gregory
fb10b97172 rc-service: add usage message
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2013-02-25 14:45:39 -06:00
Andrew Gregory
927207c1b7 rc-status: improve usage message accuracy and consistency
This makes it more clear that many of the options are used as an
alternative to a runlevel.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2013-02-25 14:44:04 -06:00
Andrew Gregory
5872bf1333 rc-update: improve usage message accuracy and consistency
The old message did not indicate that the runlevel argument was optional
for add and del or that it could be used with show.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2013-02-25 14:41:30 -06:00
Andrew Gregory
67377cc09f rc: add usage message
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2013-02-25 14:39:50 -06: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
Andrew Gregory
8c90042dee make BINDIR and SBINDIR available to input files
BINDIR and SBINDIR can be set independently of PREFIX and may not be set
to PREFIX/bin as scripts currently assume.

Note from William Hubbs:

This adds @BINDIR@ and @SBINDIR@ macros to the sed commands run to
convert *.in files to the executable form.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2013-02-23 20:30:39 -06:00
Andrew Gregory
9eb0674512 add SBINDIR variable to sys.mk
BINDIR was pointing to PREFIX/sbin which was confusing and inconsistent
with src/rc/Makefile.  Add SBINDIR and redefine BINDIR appropriately.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2013-02-23 20:30:39 -06:00
William Hubbs
549cbadd2c build: use pkg-config to find ncurses libraries if it is available
If ncurses was built with the --with-termlib switch enabled, tgoto, tgetent
and tgetstr move to libtinfo. Fortunately, ncurses provides a pkg-config
file which we can use if pkg-config is installed. If it is not, we still
link to -lncurses for now, so pkg-config is not a hard requirement.

Reported-by: jan.paesmans@gmail.com
X-Gentoo-Bug: 455912
X-Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=455912
2013-02-23 17:10:35 -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
William Hubbs
f36f8fb1be Typo Fix
Reported-by: vitalyb@telenet.dn.ua
X-Gentoo-Bug: 452544
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=452544
2013-02-17 15:37:27 -06:00
William Hubbs
a55eb3965e cgroups: remove comment about suspend for cpu_shares setting 2013-02-17 11:09:02 -06:00
Andrew Gregory
89bb04a01a do not use SYSCONFDIR for binfmt.d
This makes binfmt.d consistent with tmpfiles.d and systemd which uses
hard coded paths for both.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2013-02-16 20:46:34 -06:00
Andrew Gregory
414ef64661 disable default -prefix services if MKPREFIX = yes
Certain services were not being enabled by default if PREFIX was set.
This appears to have been intended for Gentoo Prefix systems which are
indicated by MKPREFIX not PREFIX.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2013-02-16 20:46:34 -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
William Hubbs
405dfea7ad cgroups: document kernel requirement for cpu controller settings 2013-02-16 16:11:33 -06:00
William Hubbs
1831e433a0 bootmisc: Skip cleaning /var/run or tmp directories if they are tmpfs
Reported-by: walter@pratyeka.org
X-Gentoo-Bug: 454338
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=454338
2013-02-16 02:06:26 -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
William Hubbs
86dbd757e9 keymaps: fix the use of loadkeys in the euro fix
The loadkeys man page states that if you don't pass a filename loadkeys
will read from stdin. However, this is not correct, so we now pass "-"
as the filename to explicitly request stdin.

Reported-by: andi@grois.info
X-Gentoo-Bug: 457524
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=457524
2013-02-15 16:09:49 -06:00
Alexander Mezin
970893adf3 runscript: retry prefix flock if it is interrupted by a signal
Reported-by: Pacho Ramos <pacho2@gentoo.org>
X-Gentoo-Bug: 434800
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=434800
2013-02-15 13:28:35 -06:00
William Hubbs
f30eec03ce devfs: Mount the posix message queue file system
Reported-by: reuben.m@gmail.com
X-Gentoo-Bug: 456998
X-Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=456998
2013-02-14 17:53:53 -06:00
William Hubbs
5bfebbecea Rename shutdown_network setting to keep_network
We were telling users that setting shutdown_network=YES would shut down
the network interfaces during shutdown, but this was exactly the
opposite of what we were doing. The default was YES, which was keeping
the interfaces active.

This keeps the default behavior, but renames the setting to keep_network
which more accurately describes its function, and instructs users to set
it to NO if they want the network interfaces to go down.
2013-02-11 09:45:14 -06:00
William Hubbs
1280b97749 oldnet: add support for shutdown_network from newnet
This setting, already in use in newnet, allows the user to control
whether network interfaces are stopped when the system shuts down. By
default, under newnet, they are not, so I am making oldnet have the same
default.

A side-affect of this is that in the default configuration this fixes
bugs like the one below.

Reported-by: jerryfleming2006@gmail.com
X-Gentoo-Bug: 259183
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=259183
2013-02-11 09:08:34 -06:00
William Hubbs
bbc6b96a40 oldnet: accomodate rkhunter false positive
rkhunter thinks OpenRC is a rootkit because of the hidefirstrout
variable. This has been renamed to hideFirstroute in order to get past
rkhunter.

I realize this is not an openrc bug. In this case though I do not have a
problem renaming the variable.

Reported-by: ago@gentoo.org
X-Gentoo-Bug: 339714
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=339714
2013-02-09 17:39:32 -06:00
William Hubbs
8a6c3391bd sysfs: mount the fusectl file system
Reported-by: vapier@gentoo.org
X-Gentoo-Bug: 453740
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=453740
2013-02-01 13:49:02 -06:00
William Hubbs
8be072628c remove cruft from /run directory
The /run directory is a mount point for a tmpfs and should not contain
any files or directories.  This cleans out the /run/openrc
symlink and any other files which were incorrectly placed in /run.
Thanks to Ian Stakenvicius for pointing out this solution.
2013-01-31 12:11:53 -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
Andrew Gregory
3896b9d55c libeinfo: check for "color" in the terminal name
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2013-01-04 08:48:08 -06:00
William Hubbs
630d23283a Add tools directory
This directory will contain tools which are not necessary for OpenRC to
run, but which some users have found useful.

The first of these is deptree2dot, which converts /run/openrc/deptree to
a .dot file for use with graphviz. This can assist in finding circular
dependencies.
2013-01-02 18:00:04 -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
Alexander Tsoy
a8ab9d63f5 ifconfig.sh.Linux.in: fix ipv6 routes and default route
Do not add -net or -host to ipv6 routes or to the default route when
using route from net-tools.

X-Gentoo-Bug: 442594
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=442594
2012-12-21 16:36:20 -06:00
Alexander Tsoy
2b0ff6f669 net.lo: add ipv6 net and host patterns
X-Gentoo-Bug: 442594
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=442594
2012-12-21 14:24:27 -06:00
Mihai Moldovan
a61fdd019e net.lo: allow address families to be set on routes
X-Gentoo-Bug: 447310
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?d=447310
2012-12-20 16:02:11 -06:00