Compare commits

..

125 Commits

Author SHA1 Message Date
Daniel Robbins
6a5e6f1ee0 openrc-0.7.0 upstream merge 2011-01-20 14:00:29 -07:00
Robin H. Johnson
eebb2d1b9c test: You need to run "make" before "make check" will work.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2011-01-18 01:49:22 +00:00
Robin H. Johnson
e39178de28 docs: make check does not catch textfile trailing whitespace. 2011-01-18 01:48:53 +00:00
Robin H. Johnson
9c5aa8a3f7 Document all deprecated code for future removal. 2011-01-18 01:41:29 +00: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
9ce957c3e7 librc: delete trailing newlines
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-17 20:05:13 -05:00
Mike Frysinger
c825a74dd1 tests: check for trailing blank newlines
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-17 20:04:53 -05:00
Robin H. Johnson
69abe1b2e8 Add removal schedule document for code trimming/deprecation. 2011-01-17 22:31:11 +00:00
Robin H. Johnson
164b8e4e04 Document that rc_sys_v{1,2} should not be used outside of OpenRC. 2011-01-17 22:30:40 +00:00
Robin H. Johnson
de8b4855d3 Bug #351570: Fix hidden functions visibility for rc_deptree_load_file. 2011-01-17 19:36:51 +00:00
Robin H. Johnson
f3f55f1f6d Build cleanup: librc.funcs.hidden.list is generated by testsuite. 2011-01-17 19:34:09 +00:00
Robin H. Johnson
2b7c2b8cf1 Bug #351570: Hidden function fixes: rc_conf_value.
Refactor rc_conf_value into librc for use in library context.
Also requires moving:
- rc_conf internal static
- Defines: PROFILE_ENV, SYS_WHITELIST, USR_WHITELIST, RC_PATH_PREFIX
  moved to rc.h with new RC_ prefix added.
- Defines: RC_CONF, RC_CONF_OLD moved to rc.h.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2011-01-17 19:29:45 +00:00
Mike Frysinger
6e876bca13 tests: check for common style issues
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-17 04:49:35 -05:00
Mike Frysinger
faa2df1159 more whitespace cleanup
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-17 04:49:12 -05:00
Mike Frysinger
711713d664 start-stop-daemon: use termios.h rather than sys/termios.h
POSIX specifies termios.h, not sys/termios.h.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-17 04:48:13 -05:00
Mike Frysinger
8b5e391afb start a STYLE file
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-17 04:23:09 -05:00
Mike Frysinger
1e73fd4b1e tests: setup env before reading local files
The local files we source might use local binaries (like eval_ecolors),
so setup the env first.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-17 04:07:24 -05:00
Mike Frysinger
f796269a1d dist.mk: add a standard "distcheck" target
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-17 04:03:25 -05:00
Robin H. Johnson
b2d0656814 Style fix: "char *foo" not "char* foo". 2011-01-17 08:46:41 +00:00
Robin H. Johnson
c0a3e25d48 Style fix: /* */ comments not // comments. 2011-01-17 08:43:40 +00:00
Robin H. Johnson
0c93f4df32 Style fix: "while (" not "while(". 2011-01-17 08:42:28 +00:00
Robin H. Johnson
b1fcf4ce9c Style fix: "if (" not "if(". 2011-01-17 08:41:02 +00:00
Robin H. Johnson
6804edfc85 Better error checking of argc for --applet call. 2011-01-17 08:39:44 +00:00
Robin H. Johnson
bfb87f2d51 Use xstrdup for style. 2011-01-17 08:34:03 +00:00
Robin H. Johnson
e6fc30da61 Clean up all trailing whitespace in src/. 2011-01-17 08:28:43 +00:00
Robin H. Johnson
49339525a9 Bug #351712: Implement --applet selection mode for SELinux wrappers.
In addition to detecting what multicall applet we want via argv[0],
provide an explicit override mode with a --applet initial argument.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2011-01-17 07:37:43 +00:00
Robin H. Johnson
1f578cdbad Add TODO item. 2011-01-17 06:59:37 +00:00
Robin H. Johnson
b00ad439a6 Add new option -F to rc-depend tool, so that we can debug user deptree files easily. 2011-01-17 06:53:50 +00:00
Robin H. Johnson
0e90ae266a Factor out new function rc_deptree_load_file to aid in debugging deptree files from users. Loads from a given filename instead of the hardcoded RC_DEPTREE_CACHE define. 2011-01-17 06:32:46 +00:00
Robin H. Johnson
b113ad49e9 Bug #351783: more documentation for rc_sys. But really see the OpenRC migration guide where this is covered. 2011-01-16 22:48:10 +00:00
Nathan Phillip Brink
a534b623b9 bug #351622: Use CFLAGS during linking.
Fix compilation on portage-multilib.
2011-01-14 16:40:58 -06:00
William Hubbs
882a4b7d69 bug 351523: fix deprecation date for rc_sys
The deprecation notice for automatic detection of the system type stated
that the automatic detection will be removed no later than 2010/03/01,
but it should state 2011/03/01.
2011-01-13 10:37:45 -06:00
William Hubbs
ac8b4be7c2 release openrc-0.7.0 2011-01-12 20:14:17 -06:00
Eray Aslan
66abbefd6c bug 351160: make openrc exit codes LSB compliant
* status on a stopped service now has a return code of 3 (was 1)
* starting an already started service now has a return code of 0 (was 1)
* stopping an already stopped service now has a return code of 0 (was 1)
2011-01-12 19:46:11 -06:00
William Hubbs
84eda608c8 bug 328675: add error checking to runscript.sh
runscript.sh needs to abort if the . command used to load
conf.d files and the service script does not execute successfully.
I would like to thank Mike Frysinger for his input wrt style on this
patch.
2011-01-12 19:21:48 -06:00
Mike Frysinger
e3905ed7bb update bug reporting information
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-08 18:35:08 -05:00
Chris Richards
92b6262ac7 Bug 349571 - SELinux fixes for bootmisc
- delete the contents of the $RC_LIBEXECDIR/console directory but not
  the directory itself.
  - direct error output from the chmod call for /tmp to /dev/null.
2011-01-06 18:20:53 -06:00
Robin H. Johnson
647df8cfe7 Make sure old rc_sys code never runs if the rc_sys variable exists.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2011-01-05 22:33:03 -08:00
Robin H. Johnson
6a0812645a Update manpage for mention of rc_sys purpose.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2011-01-05 22:27:35 -08:00
Robin H. Johnson
3d4d1ab14b Remove broken automatic LXC subsystem detection.
Any system using cgroups was being detected as an LXC system. This was
triggering on OpenVZ under RHEL6 as well as the "automated per tty task
groups" as discussed on the LKML.

All LXC users should now switch to the new rc_sys variable introduced in
the previous patch.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2011-01-05 22:09:34 -08:00
Robin H. Johnson
09f990a7c8 Implement explicit selection of subsystem types.
- Fixes bugs #347583, #349389, both of which were triggered by cgroups
  being detected as the LXC subsystem type.
- Makes it much easier to select "prefix" type.
- "rc -S" will now print a warning if you have not configured rc_sys in
  /etc/rc.conf
- All other semantics of rc_sys are unchanged in this patch.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2011-01-05 22:09:34 -08:00
Robin H. Johnson
6df531d33d Document the order of the services within rc-status output. 2011-01-05 22:09:33 -08:00
William Hubbs
b2e9b91852 bug #349443: remove -openvz keyword from sysctl service
Openvz supports sysctl settings which are different from the host
settings, so allow the sysctl service to run for openvz systems.
2010-12-28 13:54:19 -06:00
Piotr Karbowski
d8ce5dccb2 openrc-0.6.8 2010-12-16 11:17:34 +01:00
Piotr Karbowski
62bd337494 Unprivileged users (such as services for example) should not be able view who is logged into system. 2010-12-16 10:04:46 +01:00
Robin H. Johnson
f84d997d4c Move the ip rule extra output to verbose mode only, and support verbose output on addresses and routes. 2010-12-15 13:02:04 -08:00
Robin H. Johnson
346148ceb8 Fix pointopoint->peer for iproute. 2010-12-15 12:40:21 -08:00
Robin H. Johnson
12a91636f4 Fix pointopoint typo in old ifconfig setup. 2010-12-15 12:37:50 -08:00
Robin H. Johnson
7f7baa6c3c Bug #266659: we really need to allow peer, pointtopoint in parsing config lines. 2010-12-11 18:29:34 -08:00
Robin H. Johnson
400b45d590 Final documentation cleanup for updated bridge code.
Specifically document how to handle the case of explicitly starting a
bridge and then dynamically adding interfaces to it.

brctl_br0=''
bridge_add_eth0='br0'
2010-12-12 00:58:47 +00:00
Robin H. Johnson
e431599d08 Add "after lvm modules" as Flameeyes reports that LVM is starting too late on his system in some cases. 2010-12-11 14:25:46 -08:00
Robin H. Johnson
e07f0ef417 Merge support for Routing Policy Database (RPDB)
This can be used for multi-homed connections and other advanced routing
in Linux. See the documentation links for more information about doing
this in linux.

The code was a originally pure addon into the conf.d/net files, written
in mid-2004 for doing multi-homing between two internet connections. I
have finally cleaned this up and integrated it. Thanks to Jonathan Kwan
for giving me the original impetus to develop this for Gentoo (it was
his dual internet connections...).

In the intervening years, it was a example of postup/postdown in the
net.example file, however that suffered from a few corner case issues.

If you were using the code from net.example, please see the updated
section 'Advanced Routing' on syntax, and drop your old function blocks.
Additionally, note that the rules added are now directly saved for
removal when the interface is taken down.
2010-12-11 14:23:52 -08:00
Robin H. Johnson
dbb5af2023 Revamp of bridging code.
- Use sysfs to read bridge information from the system instead of
  parsing the brctl outputs.
- Allow setting of all bridge configuration parameters using new sysfs
  methods, modelled after bonding configuration. Also works for per-port
  bridge interface parameters.
- Document pre-starting an empty bridge for dynamic add.
- Check for interface existence before adding to bridge.
- Should fix bug #293046, #309185.
2010-12-11 12:26:38 -08:00
William Hubbs
900d54b0fc release openrc-0.6.8 2010-12-07 22:32:44 -06:00
William Hubbs
84750f5722 bug 232347: fix netmount to respect _netdev option
The _netdev option in fstab on linux systems indicates
that a filesystem should only be mounted if the network is available.

This commit fixes netmount to support this.
2010-12-07 11:54:03 -06:00
Robin H. Johnson
f8f03bdbbf Bug #345281: If wpa_supplicant is built w/ USE=dbus, we need to start after DBus is up. 2010-12-06 02:54:21 +00:00
Robin Johnson
80d5f7d27b fix selinux context for rc-svcdir (bug #347503) 2010-12-03 23:49:34 -06:00
Jory A. Pratt
06c8bd0156 Fix for make-3.82 breakage. 2010-12-03 20:06:34 -07:00
William Hubbs
449080e145 release openrc-0.6.7 2010-12-03 14:51:30 -06:00
Thomas Pfaff
062223a5df Avoid race condition in runscript (bug #319865)
Under normal conditions, runscript creates one child and waits for its
termination, which is signaled by a pipe write from the SIGCHLD
sighandler.

When running killprocs however more than one SIGHCLD signal is generated, at
least on all of my amd64 boxes running on real hardware and in vmware.

When the first SIGCHLD occurs svc_exec leaves the loop and closes the pipe.
Subsequent SIGCHLDs during the close can lead to a race condition and create an
EBADF error in the pipe write (pipe is closed but the file handle is still !=
-1).

We avoid this by blocking SIGHCHLD during the pipe close.
2010-12-03 14:01:28 -06:00
William Hubbs
18064e19f6 release openrc-0.6.6 2010-11-30 16:04:17 -06:00
William Hubbs
cdf07b5970 localmount should only use the -O option for linux systems
This fixes bug #347307.
2010-11-30 15:40:44 -06:00
Daniel Robbins
33803219d4 openrc-0.6.5 2010-11-26 17:02:16 -07:00
Jory A. Pratt
18c08a9d4d remove 'use hostname' bug 340991, Thanks Diego 2010-11-26 16:59:28 -07:00
William Hubbs
2406dc4f3e allow net_fs_list to be extended but not replaced
This fixes bug #342825.
2010-11-26 16:59:18 -07:00
Diego Elio Pettenò
8e6d461a7f Allow cleaning up of pam_mktemp-based temporary directories.
This was blacklisted before, so the .private directories never had their
content cleaned up, even if WIPE_TMP was set to yes.
2010-11-26 16:57:37 -07:00
William Hubbs
472a3bb99c remove support for local.start and local.stop for bug #343709
The openrc ebuild now migrates these files to /etc/conf.d/local, so we
do not need to support them.
2010-11-26 16:53:54 -07:00
William Hubbs
c9a2085699 add warnings about local.start and local.stop for bug #343709
We need to warn users that they should be using /etc/conf.d/local
instead of /etc/conf.d/local.start and /etc/conf.d/local.stop. This adds
those warnings.
2010-11-26 16:53:50 -07:00
William Hubbs
69169b7e95 update documentation for rc_interactive
rc_interactive is automatically disabled if rc_parallel is set to YES.
Update the documentation in rc.conf to reflect this.
This fixes bug #327305.
2010-11-26 16:53:37 -07:00
William Hubbs
3a11f8af34 remove "use hostname" from sysctl for bsd systems 2010-11-26 16:51:42 -07:00
William Hubbs
e2e5b27d85 do not mount local file systems with the _netdev option in fstab
This fixes #344947.
2010-11-26 16:51:20 -07:00
William Hubbs
82b265016a send error output from chattr command to /dev/null
This is for bug #346659.
2010-11-26 14:54:30 -06:00
William Hubbs
bdfab242b7 release openrc-0.6.5 2010-11-21 11:08:53 -06:00
William Hubbs
4ca32808dd Revert "allow ifplugd to work on wireless interfaces"
This reverts commit 4ea75dd1d6.
This caused a regression, see bug #345795.

Ifplugd is only designed to support wireless interfaces that use the
older wireless extentions.
2010-11-18 15:06:42 -06:00
William Hubbs
9e5b9abf40 remove "use hostname" from sysctl for bsd systems 2010-11-16 10:03:05 -06:00
William Hubbs
ac37dc2764 do not mount local file systems with the _netdev option in fstab
This fixes #344947.
2010-11-15 12:01:48 -06:00
William Hubbs
9285cb3392 release openrc-0.6.4 2010-11-15 10:17:17 -06:00
William Hubbs
6d9137d6c4 remove support for local.start and local.stop for bug #343709
The openrc ebuild now migrates these files to /etc/conf.d/local, so we
do not need to support them.
2010-11-10 10:55:28 -06:00
William Hubbs
2fa6bb0d48 add warnings about local.start and local.stop for bug #343709
We need to warn users that they should be using /etc/conf.d/local
instead of /etc/conf.d/local.start and /etc/conf.d/local.stop. This adds
those warnings.
2010-11-05 13:42:33 -05:00
William Hubbs
39776d6fb7 update documentation for rc_interactive
rc_interactive is automatically disabled if rc_parallel is set to YES.
Update the documentation in rc.conf to reflect this.
This fixes bug #327305.
2010-11-01 13:57:22 -05:00
Jory A. Pratt
68c021c424 ensure bonding interface is down before we attempt to configure, also
mode has to be configure before any other arguements are passed. Thanks
Ed Wildgoose <gentoo@wildgooses.com> for patch.
2010-10-31 16:40:54 -05:00
Diego Elio Pettenò
09bed967bf Allow cleaning up of pam_mktemp-based temporary directories.
This was blacklisted before, so the .private directories never had their
content cleaned up, even if WIPE_TMP was set to yes.
2010-10-31 16:18:38 -05:00
Jory A. Pratt
060b19e3e3 correction for unmounting volumes with weird characters, thanks Brant
Gurganus <brant@gurganus.name>
2010-10-28 20:35:09 -05:00
Daniel Robbins
f343360741 0.6.4 release 2010-10-27 23:43:30 -06:00
William Hubbs
d8a76d1bf6 allow net_fs_list to be extended but not replaced
This fixes bug #342825.
2010-10-27 09:00:02 -05:00
Brant Gurganus
694fd2027f correction for unmounting volumes with weird characters 2010-10-24 13:08:38 -04:00
Jory A. Pratt
7653ef89b8 remove 'use hostname' bug 340991, Thanks Diego 2010-10-23 23:52:43 -05:00
Daniel Robbins
ca76764743 Merge branch 'master' of github.com:funtoo/openrc 2010-10-20 19:21:48 -06:00
Jory A. Pratt
19bd9923d7 surpress output of loadkeys, fix setfont path check 2010-10-20 19:21:02 -06:00
Brant Gurganus
2a844e1122 corrected a typo 2010-10-20 16:26:01 -04:00
Jory A. Pratt
be6c0716ee surpress output of loadkeys, fix setfont path check 2010-09-30 07:33:52 -05:00
William Hubbs
4ea75dd1d6 allow ifplugd to work on wireless interfaces
this fixes bug #335494.
2010-09-14 19:37:52 -05:00
William Hubbs
b708852784 release openrc-0.6.3 2010-09-02 10:15:17 -05:00
William Hubbs
f700243016 Revert "fix bug 266395"
This reverts commit 1a188f8f72.

This revert fixes bug #334663.
2010-09-02 09:42:11 -05:00
Jory A. Pratt
b232e529f1 Fix for make-3.82 breakage. 2010-08-22 15:05:11 -05:00
William Hubbs
ae3186834f release openrc-0.6.2 2010-08-19 17:00:38 -05:00
William Hubbs
23546e27d9 fix detection of renamed vlan interfaces
This fixes bug 327059, thanks to Jonathan for reporting this and for the patch.
2010-08-19 16:17:38 -05:00
William Hubbs
1a188f8f72 fix bug 266395
Do not stop wpa_supplicant or wpa_cli if they are in the background.
Thanks to Slava Gorbunov for the patch.
2010-08-18 15:01:23 -05:00
Daniel Robbins
5135412978 fixing history, one step at a time 2010-08-16 19:09:26 -06:00
Anthony G. Basile
89829f6d7c Fixes bug #332383. Thanks Lutz Heermann. 2010-08-13 17:42:23 -04:00
Anthony G. Basile
6e3b3bfc53 Fix bug #332181. Thanks Lutz Heermann. 2010-08-13 17:32:31 -04:00
Jory A. Pratt
14c95ae9a6 update consolefont/keymap to include -lxc in keywords 2010-08-10 08:21:08 -05:00
William Hubbs
d3ccbdb5a9 allow ip to be in /sbin or /bin
This makes it possible for the "ip" program in iproute2 to be installed
in /sbin or /bin.
2010-08-09 20:01:15 -05:00
William Hubbs
1cdf85e1ce fix bug #330173
This fixes a typo in the comments in net.example.
2010-07-28 13:18:33 -05:00
Jory A. Pratt
2982cfab70 Fix bug #301237, update example to list proper package for mii-tool 2010-07-12 22:45:40 -05:00
Jory A. Pratt
761fe99fe2 on_ac_power needs to exit not return bug #322037 2010-07-12 22:19:56 -05:00
William Hubbs
6f24d1cbd8 fix typo
I made a typo while manually transferring over Roy's last commit.  This
fixes that typo.
2010-07-10 15:31:16 -05:00
William Hubbs
898552dcc3 fix metric
This change was also taken from Roy Marples' git.
2010-07-07 19:55:37 -05:00
William Hubbs
6850566be0 remove extra route
This was taken from Roy Marples' git repository.
2010-07-07 19:42:56 -05:00
Mike Frysinger
3036b44798 restore init.d pause option 2010-04-09 02:19:40 -04:00
Mike Frysinger
acc0edb040 restore old e* func output
Gentoo has always used the sytle:
 * moo ...                [ ok ]
Latest openrc now does:
* moo...                    [ok]

Realistically, 4 spaces out of 80 on reduced terminals doesn't make any
sort of realistic difference and it's been just fine for the last 10
years, so keep the default behavior.
2010-04-09 02:19:40 -04:00
Seth Robertson
316a316d9b Allow dhclient per $IFACE arguments. 2010-03-30 09:21:54 +01:00
Michal Gorny
20b4076b12 Support sysfs.
Fixes #214
2010-03-27 08:53:04 +00:00
Roy Marples
4d86d34635 Fix -s and -S. 2010-03-26 22:10:03 +00:00
Roy Marples
ae7a92ae7b Try and describe bonding errors a bit more. 2010-03-24 20:41:18 +00:00
Roy Marples
67b538fd26 Fix tentative ip addresses 2010-03-24 20:25:42 +00:00
Roy Marples
0276c4f516 Release openrc-0.6.1 2010-03-22 20:02:12 +00:00
Roy Marples
7271449a0c Fix two leaks. 2010-03-17 20:37:47 +00:00
Roy Marples
4b333eaf36 Send SIGKILL after 2 failed SIGTERM when unmounting. 2010-03-16 21:34:48 +00:00
Juan RP
59b08643f1 Mount xenfs early so OpenRC can detect it. 2010-02-26 09:34:43 +00:00
Roy Marples
5c52e5beb5 Fix rc_${rc_svcname}_need.
Display config depends in service depend function also.
2010-02-20 21:48:06 +00:00
Trevor Summers Smith
c0f5f2122c Allow bridge interfaces to be called bridge. 2010-02-09 17:10:04 +00:00
Mike Frysinger
ecf9ef49a7 random spelling fixes
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-01-08 22:02:51 +00:00
Roy Marples
bb45f0eabc Fix BSD compile. 2010-01-08 00:22:04 +00:00
Daniel Mierswa
f434c902a5 Use IFACE variable instead of iface.
Signed-off-by: Daniel Mierswa <impulze@impulze.org>
2009-12-31 07:21:59 +00:00
108 changed files with 1243 additions and 607 deletions

70
FEATURE-REMOVAL-SCHEDULE Normal file
View File

@@ -0,0 +1,70 @@
The following is a list of files and features that are going to be removed in
the source tree. Every entry should contain what exactly is going away, why it
is happening, and who is going to be doing the work. When the feature is
removed, it should also be removed from this file.
---------------------------
What: rc_sys automatic detection code
- Functions for removal: rc_sys_v1, rc_sys_v2
When: 2011/03/01
Why: The original automatic sub-system detection is flawed in that it cannot
safely detect some variables (Using cgroups confused it to think you were
using LXC, and Prefix cannot be detect by definition). Also, almost all of
the detection requires that /proc is available and readable. During early
boot, /proc may not be mounted yet, leading to mis-detection. The readable
condition can also fail under some hardened kernels when running as an
unprivileged user.
The new rc_sys_v2 function uses the rc_sys variable from rc.conf. After
the removal, the contents of the rc_sys_v2 function will move into the
rc_sys function.
Who: Robin H. Johnson <robbat2@gentoo.org>
---------------------------
What: oldnet ADSL rp-pppoe mode
When: undecided
Why: Replaced by the oldnet PPP module
Who: Robin H. Johnson <robbat2@gentoo.org>
---------------------------
What: oldnet /etc/conf.d/wireless
When: undecided
Why: All configuration moved to /etc/conf.d/net
Who: Robin H. Johnson <robbat2@gentoo.org>
---------------------------
What: Service pause action
When: Removed already, compatbility warning in place.
Why: ...
Who:
---------------------------
What: Service --startas, --chuid , --oknodo
When: undecided
Why: Obsolete or replaced by other options.
--startas => use --name or --exec
--chuid => use --user
--oknodo => ignore return code instead
Who:
---------------------------

View File

@@ -1,3 +1,3 @@
NAME= openrc
VERSION= 0.6.0
VERSION= 0.7.0
PKG= ${NAME}-${VERSION}

69
README
View File

@@ -1,8 +1,9 @@
OpenRC README
=============
Installation
------------
make install
Yup, that simple. Works with GNU make and BSD make.
@@ -41,7 +42,7 @@ If any of the following files exist then we do not overwrite them
rc and rc.shutdown are the hooks from the BSD init into OpenRC.
devd.conf is modified from FreeBSD to call /etc/rc.devd which is a generic
hook into OpenRC.
inittab is the same, but for SysVInit as used by most Linux distrubtions.
inittab is the same, but for SysVInit as used by most Linux distributions.
This can be found in the support folder.
Obviously, if you're installing this onto a system that does not use OpenRC
by default then you may wish to backup the above listed files, remove them
@@ -51,34 +52,54 @@ init.d.misc is not installed by default as the scripts will need
tweaking on a per distro basis. They are also non essential to the operation
of the system.
Reporting Bugs
-------------
If you installed OpenRC from your chosen distribution, you should report
bugs directly to them. For example, if you use Gentoo and emerged OpenRC
then you should reports bugs to http://bugs.gentoo.org.
Otherwise, you can report them directly to me at
http://roy.marples.name/projects/openrc
History - by Daniel Robbins
---------------------------
The Gentoo modular network scripts were created by Daniel Robbins for
Gentoo Linux 1.0_rc6, in development during most of 2001 and released
in September 2001. After their development, the dependency-based initscript
system was maintained by a number of senior developers (add names here....
need to look at baselayout cvs logs.)
History - by Roy Marples
------------------------
I became a Gentoo/Linux developer in 2004 and wrote the modular network
scripts for the Gentoo baselayout package. baselayout is a collection of
bash scripts to bring up your computer and it's services.
Then towards the end of 2005 I found myself as the primary maintainer
for baselayout.
excerpt from http://www.gentoo.org/news/en/gwn/20040426-newsletter.xml
by Grant Goodyear:
At the start of 2007, baselayout-2 is announced to the world, re-writing the
core of baselayout in C and allowing POSIX sh init scripts instead of
forcing the use of bash. By Mid 2007 I have re-written everything, including
init scripts, and alpha and pre baselayout-2 snapshots where put into Gentoo.
Towards the end of 2007 I retired as a Gentoo developer for reasons I won't
go into here. baselayout-2 was still in the pre stage, and aside from the
fbsd users, it was masked everywhere. However, I also desired to keep the
baselayout-2 project alive, but outside of Gentoo and into other projects
such as FreeBSD.
"My recollection is that one of woodchip's more impressive early feats was the
complete replacement of all of the init scripts in Portage for Gentoo Linux
1.0_rc6. Through 1.0_rc5 Gentoo had used fairly standard rc scripts modified
from Stampede Linux, but for 1.0_rc6 Daniel Robbins (drobbins) and Martin
Schlemmer (azarah) had created a new dependency-based init script system that
is still used today. Within a span of days Donny rewrote every single init
script in the Portage tree and committed new masked packages to await the
release of 1.0_rc6. Thanks to woodchip (and drobbins and azarah, of course) the
transition to the new init scripts was nearly painless."
As such, the Gentoo Council have allowed the creation of OpenRC under the
2 clause BSD license, managed by me as an external project.
Roy Marples became a Gentoo/Linux developer in 2004 and maintained the modular
network scripts for the Gentoo baselayout package. Then towards the end of
2005, he became the the primary maintainer for baselayout.
At the start of 2007, Roy Marples announced the ongoing development of
baselayout-2, containing a rewritten initscript code in C and allowing POSIX sh
init scripts instead of forcing the use of bash. By Mid 2007 Roy Marples had
re-implemented the Gentoo initscript design created by Daniel Robbins, using an
entirely new code base. Alpha and pre-release baselayout-2 snapshots were
added to Gentoo's Portage tree as an optional component.
Towards the end of 2007, Roy Marples retired as a Gentoo developer Baselayout-2
was still in the pre stage, and aside from the fbsd users, it was masked
everywhere. However, Roy Marples desired to keep the baselayout-2 project
alive, but outside of Gentoo and into other projects such as FreeBSD.
As such, the Gentoo Council permitted Roy Marples to release OpenRC under the 2
clause BSD license, managed by him as an external project. Around mid-2010, Roy
Marples decided to no longer maintain OpenRC. At this point, he transferred
development back to Gentoo, which continues to maintain the scripts. In
addition, Daniel Robbins continues to maintain an independent version OpenRC
for Funtoo Linux, which includes a Funtoo-specific network configuration
system.

View File

@@ -12,8 +12,8 @@ In the Perfect World (TM) ifconfig should be able to configure everything
about the interface easily * . The BSD family almost get this right and Linux
epically fails.
* Only static confguration, including link setup.
For dynmaic, static, IPv4LL, arping and per ssid IPv4 setup dhcpcd-5.x
* Only static configuration, including link setup.
For dynamic, static, IPv4LL, arping and per ssid IPv4 setup dhcpcd-5.x
provides your needs.
It fails because there are many tools to do the same job and often have
@@ -31,6 +31,6 @@ currently available. It's just harder as you have to know them and their
documentation can be lacking at times.
The correct end goal is a BSD style ifconfig tool.
I've started work on it, but the project has stalled somewhat.
It's display only right now and the source is not yet publically available.
It's display only right now and the source is not yet publicly available.
If you have the skills and share the vision then contact me privately and
we'll take it from there.

34
STYLE Normal file
View File

@@ -0,0 +1,34 @@
This is the openrc style manual. It governs the coding style of all code
in this repository. Follow it. Contact openrc@gentoo.org for any questions
or fixes you might notice.
##########
# C CODE #
##########
The BSD Kernel Normal Form (KNF) style is used:
http://en.wikipedia.org/wiki/Indent_style#BSD_KNF_style
Basically, it's like K&R/LKML, but wrapped lines that are indented use 4 spaces.
Highlights:
- no trailing whitespace
- indented code use tabs (not line wrapped)
- cuddle the braces (except for functions)
- space after native statements and before paren (for/if/while/...)
- no space between function and paren
- pointer asterisk cuddles the variable, not the type
void foo(int c)
{
int ret = 0;
if (c > 1000)
return;
while (c--) {
bar(c);
ret++;
}
return ret;
}

4
TODO
View File

@@ -1,3 +1,7 @@
- ensure all forks block, restore and unblock signals. needs review
- add support somehow for optional translations
- oldnet[bridging]: Review setting of bridge configuration on dynamic interface add
- Document rc-depend binary.

View File

@@ -11,7 +11,7 @@ include ${MK}/scripts.mk
SOS?= BSD
network: network.in network.${OS}
network: network.in network.${SOS}
cp $@.in $@
[ -e $@.${SOS} ] && cat $@.${SOS} >> $@ || true

View File

@@ -12,7 +12,7 @@
# kernel then remove the IPv6 address from your config.
# If you want to use a static address or use DHCP explicitly, jump
# down to the section labelled INTERFACE HANDLERS.
# down to the section labeled INTERFACE HANDLERS.
#
# If you want to do anything more fancy, you should take the time to
# read through the rest of this file.
@@ -22,10 +22,10 @@
#
# We now support modular networking scripts which means we can easily
# add support for new interface types and modules while keeping
# compatability with existing ones.
#
# compatibility with existing ones.
#
# Modules load by default if the package they need is installed. If
# you specify a module here that doesn't have it's package installed
# you specify a module here that doesn't have its package installed
# then you get an error stating which package you need to install.
# Ideally, you only use the modules setting when you have two or more
# packages installed that supply the same service.
@@ -96,8 +96,8 @@
#modules="iwconfig"
# ifconfig (iwconig) support is a one shot script - wpa_supplicant is daemon
# that scans, assoicates and re-configures if assocation is lost.
# We call it iwconfig to seperate the wireless setup from ifconfig.
# that scans, associates and re-configures if association is lost.
# We call it iwconfig to separate the wireless setup from ifconfig.
####################################
# HINTS
#
@@ -182,7 +182,7 @@
#dns_servers_001122334455="192.168.0.1 192.168.0.2"
# Map a MAC address to an SSID
# This is used when the Access Point is not broadcasting it's SSID
# This is used when the Access Point is not broadcasting its SSID
# WARNING: This will override the SSID being broadcast due to some
# Access Points sending an SSID even when they have been configured
# not to!
@@ -193,7 +193,7 @@
# This lists the preferred SSIDs to connect to in order
# SSID's can contain any characters here as they must match the broadcast
# SSID exactly.
# Surround each SSID with the " character and seperate them with a space
# Surround each SSID with the " character and separate them with a space
# If the first SSID isn't found then it moves onto the next
# If this isn't defined then it connects to the first one found
#preferred_aps="SSID1 SSID2"
@@ -208,11 +208,11 @@
# any other available AP
# "preferredonly" means it will only connect to visible APs in the preferred
# list
# "forcepreferred" means it will forceably connect to APs in order if it does
# "forcepreferred" means it will forcibly connect to APs in order if it does
# not find them in a scan
# "forcepreferredonly" means it forceably connects to the APs in order and
# "forcepreferredonly" means it forcibly connects to the APs in order and
# does not bother to scan
# "forceany" does the same as forcepreferred + connects to any other
# "forceany" does the same as forcepreferred + connects to any other
# available AP
# Default is "any"
#associate_order="any"
@@ -266,13 +266,13 @@
# won't have associated then)
# If you're using anything else to configure wireless on your interface AND
# you have installed wpa_supplicant, you need to disable wpa_supplicant
# you have installed wpa_supplicant, you need to disable wpa_supplicant
#modules="!iwconfig !wpa_supplicant"
#or
#modules="!wireless"
##############################################################################
# WIRELESS SSID IN VARIABLES
# WIRELESS SSID IN VARIABLES
##############################################################################
# Remember to change SSID to your SSID.
# Say that your SSID is My NET - the line
@@ -320,7 +320,7 @@
# Set generic DHCP options like so
#dhcp_eth0="release nodns nontp nonis nogateway nosendhost"
# This tells the dhcp client to release it's lease when it stops, not to
# This tells the dhcp client to release its lease when it stops, not to
# overwrite dns, ntp and nis settings, not to set a default route and not to
# send the current hostname to the dhcp server and when it starts.
# You can use any combination of the above options - the default is not to
@@ -368,7 +368,7 @@
##############################################################################
# ADVANCED CONFIGURATION
#
#
# Four functions can be defined which will be called surrounding the
# start/stop operations. The functions are called with the interface
# name first so that one function can control multiple adapters. An extra two

View File

@@ -12,7 +12,7 @@
# kernel then remove the IPv6 address from your config.
# If you want to use a static address or use DHCP explicitly, jump
# down to the section labelled INTERFACE HANDLERS.
# down to the section labeled INTERFACE HANDLERS.
#
# If you want to do anything more fancy, you should take the time to
# read through the rest of this file.
@@ -23,10 +23,10 @@
#
# We now support modular networking scripts which means we can easily
# add support for new interface types and modules while keeping
# compatability with existing ones.
#
# compatibility with existing ones.
#
# Modules load by default if the package they need is installed. If
# you specify a module here that doesn't have it's package installed
# you specify a module here that doesn't have its package installed
# then you get an error stating which package you need to install.
# Ideally, you only use the modules setting when you have two or more
# packages installed that supply the same service.
@@ -49,7 +49,7 @@
##############################################################################
# INTERFACE HANDLERS
#
#
# We provide two interface handlers presently: ifconfig and iproute2.
# You need one of these to do any kind of network configuration.
# For ifconfig support, emerge sys-apps/net-tools
@@ -106,7 +106,7 @@
# Each module described below can set a default base metric, lower is
# preferred over higher. This is so we can prefer a wired route over a
# wireless route automaticaly. You can override this by setting
# wireless route automatically. You can override this by setting
#metric_eth0="100"
# or on a global basis
#metric="100"
@@ -253,7 +253,7 @@
#key_SSID="s:foobar enc open"
#key_SSID="1234-5678-9012 enc open"
# You may want to set muliple keys - here's an example
# You may want to set multiple keys - here's an example
# It sets 4 keys on the card and instructs to use key 2 by default
#key_SSID="[1] s:passkey1 key [2] s:passkey2 key [3] s:passkey3 key [4] s:passkey4 key [2]"
@@ -283,7 +283,7 @@
#dns_servers_001122334455="192.168.0.1 192.168.0.2"
# Map a MAC address to an SSID
# This is used when the Access Point is not broadcasting it's SSID
# This is used when the Access Point is not broadcasting its SSID
# WARNING: This will override the SSID being broadcast due to some
# Access Points sending an SSID even when they have been configured
# not to!
@@ -294,10 +294,10 @@
# This lists the preferred SSIDs to connect to in order
# SSID's can contain any characters here as they must match the broadcast
# SSID exactly.
# Surround each SSID with the " character and seperate them with a space
# Surround each SSID with the " character and separate them with a space
# If the first SSID isn't found then it moves onto the next
# If this isn't defined then it connects to the first one found
#preferred_aps="SSID1 SSID2"
#preferred_aps="SSID1 SSID2"
# You can also define a preferred_aps list per interface
#preferred_aps_eth0="SSID3 SSID4"
@@ -307,9 +307,9 @@
# "any" means it will connect to visible APs in the preferred list and then any
# other available AP
# "preferredonly" means it will only connect to visible APs in the preferred list
# "forcepreferred" means it will forceably connect to APs in order if it does not find
# "forcepreferred" means it will forcibly connect to APs in order if it does not find
# them in a scan
# "forcepreferredonly" means it forceably connects to the APs in order and does not bother
# "forcepreferredonly" means it forcibly connects to the APs in order and does not bother
# to scan
# "forceany" does the same as forcepreferred + connects to any other available AP
# Default is "any"
@@ -371,13 +371,13 @@
# won't have associated then)
# If you're using anything else to configure wireless on your interface AND
# you have installed wpa_supplicant, you need to disable wpa_supplicant
# you have installed wpa_supplicant, you need to disable wpa_supplicant
#modules="!iwconfig !wpa_supplicant"
#or
#modules="!wireless"
##############################################################################
# WIRELESS SSID IN VARIABLES
# WIRELESS SSID IN VARIABLES
##############################################################################
# Remember to change SSID to your SSID.
# Say that your SSID is My NET - the line
@@ -421,7 +421,7 @@
# Notes:
# - All clients send the current hostname to the DHCP server by default
# - dhcpcd does not daemonize when the lease time is infinite
# - udhcp-0.9.3-r3 and earlier do not support getting NTP servers
# - udhcp-0.9.3-r3 and earlier do not support getting NTP servers
# - pump does not support getting NIS servers
# - DHCP tends to erase any existing device information - so add
# static addresses after dhcp if you need them
@@ -448,7 +448,7 @@
# Set generic DHCP options like so
#dhcp_eth0="release nodns nontp nonis nogateway nosendhost"
# This tells the dhcp client to release it's lease when it stops, not to
# This tells the dhcp client to release its lease when it stops, not to
# overwrite dns, ntp and nis settings, not to set a default route and not to
# send the current hostname to the dhcp server and when it starts.
# You can use any combination of the above options - the default is not to
@@ -467,7 +467,7 @@
#fallback_eth0="apipa"
#-----------------------------------------------------------------------------
# ARPING Gateway configuration
# ARPING Gateway configuration
# and
# Automatic Private IP Addressing (APIPA)
# For arpingnet / apipa support, emerge net-misc/iputils or net-analyzer/arping
@@ -572,7 +572,7 @@
#config_bond0="null" # You may not want to assign an IP the the bond
# You can also configure the bond here, which must be done via sysfs on 2.6
# kernels or newer. See the kernel bonding documention for a description of
# kernels or newer. See the kernel bonding documentation for a description of
# these options.
#arp_ip_target_bond0="+26.0.0.0"
@@ -582,7 +582,7 @@
#-----------------------------------------------------------------------------
# Classical IP over ATM
# Classical IP over ATM
# For CLIP support emerge net-dialup/linux-atm
# Ensure that you have /etc/atmsigd.conf setup correctly
@@ -620,7 +620,7 @@
#
# Here you should specify what pppd plugins you want to use
# Available plugins are: pppoe, pppoa, capi, dhcpc, minconn, radius,
# radattr, radrealms and winbind
# radattr, radrealms and winbind
#plugins_ppp0="pppoe" # Required plugin for PPPoE
#plugins_ppp0="pppoa vc-encaps" # Required plugin for PPPoA with an option
#plugins_ppp0="capi" # Required plugin for ISDN
@@ -658,9 +658,9 @@
#
# Dead peer detection
# lcp-echo-interval 15 # Send a LCP echo every 15 seconds
# lcp-echo-failure 3 # Make peer dead after 3 consective
# lcp-echo-failure 3 # Make peer dead after 3 consecutive
# # echo-requests
#
#
# Compression options - use these to completely disable compression
# noaccomp noccp nobsdcomp nodeflate nopcomp novj novjccomp
#
@@ -787,11 +787,18 @@
#bridge_add_eth0="br0"
#bridge_add_eth1="br0"
# You need to configure the ports to null values so dhcp does not get started
# NOTE: If you want to manually start an empty bridge, and then dynamically add
# ports to it you must set at least one of the following variables based on the
# interface name, so that we can pick it up from your configuration. Even an
# empty value variable is fine, but at least one of them must be set:
# brctl_IFVAR
# You need to configure the ports to null values so dhcp does not get started
#config_eth0="null"
#config_eth1="null"
# Finally give the bridge an address - dhcp or a static IP
# Finally give the bridge an address - dhcp or a static IP, this is assigned to
# the bridge when the bridge is explicitly started.
#config_br0="dhcp" # may not work when adding ports dynamically
#config_br0="192.168.0.1/24"
@@ -805,8 +812,15 @@
#sethello 0
#stp off"
# You can also configure the bridge or bridge members via sysfs on 2.6 kernels
# or newer. See the kernel bridge documentation for a description of these
# options.
#stp_state_br0="0"
#forward_delay_br0="10"
#hairpin_mode_eth0="1"
#-----------------------------------------------------------------------------
# RFC 2684 Bridge Support
# RFC 2684 Bridge Support
# For RFC 2684 bridge support emerge net-misc/br2684ctl
# Interface names have to be of the form nas0, nas1, nas2, etc.
@@ -822,8 +836,8 @@
#config_nas0="'192.168.0.1/24'"
#-----------------------------------------------------------------------------
# Tunnelling
# WARNING: For tunnelling it is highly recommended that you
# Tunneling
# WARNING: For tunneling it is highly recommended that you
# emerge sys-apps/iproute2
#
# For GRE tunnels
@@ -838,7 +852,7 @@
# 6to4 Tunnels allow IPv6 to work over IPv4 addresses, provided you
# have a non-private address configured on an interface.
# link_6to4="eth0" # Interface to base it's addresses on
# link_6to4="eth0" # Interface to base its addresses on
# config_6to4="ip6to4"
# You may want to depend on eth0 like so
#rc_need_6to4="net.eth0"
@@ -848,10 +862,56 @@
# sit0 - otherwise use a different name like 6to4 in the example above.
# You can also specify a relay and suffix if you like.
# The default relay is 192.88.99.1 and the defualt suffix is :1
# The default relay is 192.88.99.1 and the default suffix is :1
#relay_6to4="192.168.3.2"
#suffix_6to4=":ff"
#-----------------------------------------------------------------------------
# Advanced Routing
# WARNING: For advanced routing you MUST be using sys-apps/iproute2
#
# This provides a means to do multi-homing and more using the Routing Policy
# Database (RPDB).
#
# See the following links for background and more information.
# http://linux-ip.net/html/ch-routing.html
# http://linux-ip.net/html/ch-advanced-routing.html
# The rules listed will be added with 'ip rule add LINE' when the interface is
# being brought up. They will also be removed with 'ip rule delete LINE'.
# The rules added are also stored for later removal, so if you alter your rules
# directly before stopping, you should review your rules again after stopping.
# Note in earlier versions of openrc, this was provided as an example in
# postup/postdown, however that implementation suffered some bugs in corner
# cases, which are now fixed with this merger. If you used the previous
# example, you should only need to drop the relevent portions of your
# postup/postdown functions, and review the quoting in your rules_IFACE
# variables.
# Below is a trivial example for a dual-homed connection where there is an OOB
# management network. Only packets explicitly with an address from or to the
# OOB are sent via eth0. All others go via eth1 as the eth1 rules have a lower
# priority.
# If you want to use names for your tables, you should put lines into
# /etc/iproute2/rt_tables, an example follows:
# 2 oob
# 3 external
#rules_eth0="
#from ZZZ.ZZZ.200.128/27 table oob priority 500
#to ZZZ.ZZZ.200.128/27 table oob priority 550"
#rules_eth1="
#from XXX.XXX.112.0/24 table external priority 400
#to XXX.XXX.112.0/24 table external priority 450"
#routes_eth0="
#ZZZ.ZZZ.200.128/27 dev eth0 table oob scope link
#default via ZZZ.ZZZ.200.129 table oob"
#routes_eth1="
#XXX.XXX.112.0/24 dev eth1 table external scope link
#default via XXX.XXX.112.1 dev eth1"
#-----------------------------------------------------------------------------
# System
@@ -896,7 +956,7 @@
# and you're done :)
# By default we don't wait for netplug/ifplugd to configure the interface.
# If you would like it to wait so that other services now that network is up
# If you would like it to wait so that other services know that network is up
# then you can specify a timeout here.
#plug_timeout="10"
# A value of 0 means wait forever.
@@ -915,7 +975,7 @@
##############################################################################
# ADVANCED CONFIGURATION
#
#
# Four functions can be defined which will be called surrounding the
# start/stop operations. The functions are called with the interface
# name first so that one function can control multiple adapters. An extra two
@@ -936,12 +996,12 @@
#preup() {
# # Test for link on the interface prior to bringing it up. This
# # only works on some network adapters and requires the mii-diag
# # package to be installed.
# # only works on some network adapters and requires the
# # sys-apps/net-tools package to be installed.
# if mii-tool "${IFACE}" 2> /dev/null | grep -q 'no link'; then
# ewarn "No link on ${IFACE}, aborting configuration"
# return 1
# fi
# fi
#
# # Test for link on the interface prior to bringing it up. This
# # only works on some network adapters and requires the ethtool
@@ -980,33 +1040,6 @@
# # This function could be used, for example, to register with a
# # dynamic DNS service. Another possibility would be to
# # send/receive mail once the interface is brought up.
# # Here is an example that allows the use of iproute rules
# # which have been configured using the rules_eth0 variable.
# #rules_eth0=" \
# # 'from 24.80.102.112/32 to 192.168.1.0/24 table localnet priority 100' \
# # 'from 216.113.223.51/32 to 192.168.1.0/24 table localnet priority 100' \
# #"
# eval set -- \$rules_${IFVAR}
# if [ $# != 0 ]; then
# einfo "Adding IP policy routing rules"
# eindent
# # Ensure that the kernel supports policy routing
# if ! ip rule list | grep -q "^"; then
# eerror "You need to enable IP Policy Routing (CONFIG_IP_MULTIPLE_TABLES)"
# eerror "in your kernel to use ip rules"
# else
# for x; do
# ebegin "${x}"
# ip rule add ${x}
# eend $?
# done
# fi
# eoutdent
# # Flush the cache
# ip route flush cache dev "${IFACE}"
# fi
#}
#postdown() {
@@ -1014,21 +1047,6 @@
# # Probably a good idea to set ifdown="no" in /etc/conf.d/net
# # as well ;)
# [ "${IFACE}" != "lo" ] && ethtool -s "${IFACE}" wol g
# Automatically erase any ip rules created in the example postup above
# if interface_exists "${IFACE}"; then
# # Remove any rules for this interface
# local rule
# ip rule list | grep " iif ${IFACE}[ ]*" | {
# while read rule; do
# rule="${rule#*:}"
# ip rule del ${rule}
# done
# }
# # Flush the route cache
# ip route flush cache dev "${IFACE}"
# fi
# # Return 0 always
# return 0
#}

View File

@@ -7,3 +7,6 @@ MK= ../mk
include ${MK}/os.mk
include Makefile.${OS}
include ${MK}/scripts.mk
rc.conf: rc.conf.in rc.conf.${OS}
${SED} ${SED_REPLACE} ${SED_EXTRA} $^ > $@

View File

@@ -1,6 +1,2 @@
SED_EXTRA= -e 's:@TERM@:wsvt25:g'
SRCS+= rc.in rc.shutdown.in
rc.conf:
cp rc.conf.in rc.conf
cat rc.conf.Linux >> rc.conf
SRCS+= rc.conf.in rc.in rc.shutdown.in

12
etc/rc.conf.FreeBSD Normal file
View File

@@ -0,0 +1,12 @@
# This is the subsystem type. Valid options on FreeBSD:
# "" - nothing special
# "jail" - FreeBSD jails
# "prefix" - Prefix
# If unset, the old automagic detection code will be triggered. Said old code
# is deprecated and will be removed not later than 2011/03/01.
#
# This should be set to the value representing what environment this file is
# PRESENTLY in, not what virtualization the environment is capable of.
# See the OpenRC migration guide for more details.
rc_sys=""

View File

@@ -1,3 +1,19 @@
# This is the subsystem type. Valid options on Linux:
# "" - nothing special
# "lxc" - Linux Containers
# "openvz" - Linux OpenVZ
# "prefix" - Prefix
# "uml" - Usermode Linux
# "vserver" - Linux vserver
# "xen0" - Xen0 Domain
# "xenU" - XenU Domain
# If unset, the old automagic detection code will be triggered. Said old code
# is deprecated and will be removed not later than 2011/03/01.
#
# This should be set to the value representing what environment this file is
# PRESENTLY in, not what virtualization the environment is capable of.
# See the OpenRC migration guide for more details.
rc_sys=""
##############################################################################
# LINUX SPECIFIC OPTIONS

13
etc/rc.conf.NetBSD Normal file
View File

@@ -0,0 +1,13 @@
# This is the subsystem type. Valid options on NetBSD:
# "" - nothing special
# "prefix" - Prefix
# "xen0" - Xen0 Domain
# "xenU" - XenU Domain
# If unset, the old automagic detection code will be triggered. Said old code
# is deprecated and will be removed not later than 2011/03/01.
#
# This should be set to the value representing what environment this file is
# PRESENTLY in, not what virtualization the environment is capable of.
# See the OpenRC migration guide for more details.
rc_sys=""

View File

@@ -2,7 +2,7 @@
# Set to "YES" if you want the rc system to try and start services
# in parallel for a slight speed improvement. When running in parallel we
# prefix the service output with it's name as the output will get
# prefix the service output with its name as the output will get
# jumbled up.
# WARNING: whilst we have improved parallel, it can still potentially lock
# the boot process. Don't file bugs about this unless you can supply
@@ -11,7 +11,8 @@
# Set rc_interactive to "YES" and you'll be able to press the I key during
# boot so you can choose to start specific services. Set to "NO" to disable
# this feature.
# this feature. This feature is automatically disabled if rc_parallel is
# set to YES.
#rc_interactive="YES"
# If we need to drop to a shell, you can specify it here.
@@ -75,8 +76,14 @@
# Set unicode to YES to turn on unicode support for keyboards and screens.
#unicode="NO"
# Network fstypes. Below is the default.
net_fs_list="afs cifs coda davfs fuse fuse.sshfs gfs glusterfs lustre ncpfs nfs nfs4 ocfs2 shfs smbfs"
# Below is the default list of network fstypes.
#
# afs cifs coda davfs fuse fuse.sshfs gfs glusterfs lustre ncpfs
# nfs nfs4 ocfs2 shfs smbfs
#
# If you would like to add to this list, you can do so by adding your
# own fstypes to the following variable.
#extra_net_fs_list=""
##############################################################################
# SERVICE CONFIGURATION VARIABLES
@@ -88,7 +95,7 @@ net_fs_list="afs cifs coda davfs fuse fuse.sshfs gfs glusterfs lustre ncpfs nfs
# We can set some things on a per service basis, like the nicelevel.
#export SSD_NICELEVEL="-19"
# Pass ulimit parameters
# Pass ulimit parameters
#rc_ulimit="-u 30"
# It's possible to define extra dependencies for services like so
@@ -108,3 +115,4 @@ net_fs_list="afs cifs coda davfs fuse fuse.sshfs gfs glusterfs lustre ncpfs nfs
# You can also remove dependencies.
# This is mainly used for saying which servies do NOT provide net.
#rc_net_tap0_provide="!net"

View File

@@ -6,7 +6,7 @@
# This gives us a nice colour boot :)
[ -z "$TERM" -o "$TERM" = "dumb" ] && export TERM="@TERM@"
# Handle interrupts
# Handle interrupts
trap : SIGINT
trap "echo 'Boot interrupted'; exit 1" SIGQUIT

View File

@@ -2,7 +2,7 @@
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license.
# Handle interrupts
# Handle interrupts
trap : SIGINT SIGQUIT
# Try and use stuff in /lib over anywhere else so we can shutdown

View File

@@ -10,7 +10,7 @@ required_files=/etc/dnsmasq.conf
extra_started_commands="reload"
depend()
{
{
provide dns
need localmount net
after bootmisc

View File

@@ -24,7 +24,7 @@ if yesno $openvpn_client; then
command_args="$command_args --up $openvpn_up"
command_args="$command_args --down $openvpn_down"
required_files="$required_files $openvpn_up $openvpn_down"
in_background_fake="start stop"
start_inactive=YES
fi
@@ -59,7 +59,7 @@ start_pre()
sysctl -a | grep -q '\.tap\.' || kldload if_tap
fi
fi
# If the config file does not specify the cd option, we do
if ! grep -q "^[ \t]*cd[ \t].*" "$openvpn_config"; then
command_args="$command_args --cd $openvpn_dir"

View File

@@ -31,5 +31,5 @@ start_pre()
eend $? || return 1
fi
$command -t
$command -t
}

View File

@@ -43,7 +43,7 @@ find_wireless()
done
;;
esac
return 1
}

View File

@@ -4,7 +4,7 @@
extra_commands="save"
description="Sets the local clock to UTC or Local Time."
description="Sets the local clock to UTC or Local Time."
description_save="Saves the current time in the BIOS."
: ${clock:=${CLOCK:-UTC}}
@@ -26,7 +26,7 @@ depend()
}
start()
{
{
ebegin "Starting the System Clock Adjuster [${utc}]"
if [ "$clock" != "UTC" ]; then
echo >/etc/wall_cmos_clock

View File

@@ -4,7 +4,6 @@
depend()
{
use hostname
need localmount
before logger
after clock sysctl
@@ -26,7 +25,7 @@ cleanup_tmp_dir()
mkdir -p "$dir" || return $?
fi
dir_writeable "$dir" || return 1
chmod a+rwt "$dir"
chmod a+rwt "$dir" 2> /dev/null
cd "$dir"
if yesno $wipe_tmp; then
ebegin "Wiping $dir directory"
@@ -36,6 +35,12 @@ cleanup_tmp_dir()
# Faster than find
rm -rf -- [^ajlq\.]*
# pam_mktemp creates a .private directory within which
# each user gets a private directory with immutable
# bit set; remove the immutable bit before trying to
# remove it.
[ -d /tmp/.private ] && chattr -R -a /tmp/.private 2> /dev/null
find $startopts ! -name . \
! -path "./lost+found" \
! -path "./lost+found/*" \
@@ -49,8 +54,6 @@ cleanup_tmp_dir()
! -path "./aquota.group/*" \
! -path "./journal" \
! -path "./journal/*" \
! -path "./.private" \
! -path "./.private/*" \
-exec rm -rf {} \;
eend 0
else
@@ -68,13 +71,13 @@ mkutmp()
: >"$1"
# Not all systems have the utmp group
chgrp utmp "$1" 2>/dev/null
chmod 0664 "$1"
chmod 0660 "$1"
}
start()
{
# Remove any added console dirs
rm -rf "$RC_LIBEXECDIR"/console
rm -rf "$RC_LIBEXECDIR"/console/*
local logw=false runw=false extra=
# Ensure that our basic dirs exist
@@ -85,7 +88,7 @@ start()
eend 1 "failed to create needed directory $x"
return 1
fi
fi
fi
done
if dir_writeable /var/run; then
@@ -134,7 +137,7 @@ start()
# Make sure our X11 stuff have the correct permissions
# Omit the chown as bootmisc is run before network is up
# and users may be using lame LDAP auth #139411
rm -rf /tmp/.ICE-unix /tmp/.X11-unix
rm -rf /tmp/.ICE-unix /tmp/.X11-unix
mkdir -p /tmp/.ICE-unix /tmp/.X11-unix
chmod 1777 /tmp/.ICE-unix /tmp/.X11-unix
if [ -x /sbin/restorecon ]; then

View File

@@ -8,7 +8,7 @@ depend()
{
need localmount termencoding
after hotplug bootmisc
keyword -openvz -prefix -uml -vserver -xenu
keyword -openvz -prefix -uml -vserver -xenu -lxc
}
start()

View File

@@ -68,7 +68,7 @@ reset()
start()
{
if [ -r "$hostid_file" ]; then
_set $(cat "$hostid_file")
_set $(cat "$hostid_file")
else
reset
fi

View File

@@ -4,7 +4,7 @@
extra_commands="save show"
description="Sets the local clock to UTC or Local Time."
description="Sets the local clock to UTC or Local Time."
description_save="Saves the current time in the BIOS."
description_show="Displays the current time in the BIOS."
@@ -87,7 +87,7 @@ start()
_hwclock --adjust $utc_cmd
retval=$(($retval + $?))
fi
# If setting UTC, don't bother to run hwclock when first booting
# as that's the default
if [ "$PREVLEVEL" != N -o \
@@ -97,7 +97,7 @@ start()
_hwclock --hctosys $utc_cmd $clock_args
retval=$(($retval + $?))
fi
eend $retval "Failed to set the system clock"
return 0
@@ -126,7 +126,7 @@ stop()
_hwclock --systohc $utc_cmd $clock_args
retval=$?
eend $retval "Failed to sync clocks"
eend $retval "Failed to sync clocks"
}
save()

View File

@@ -40,11 +40,11 @@ init() {
ipfw add deny all from any to 127.0.0.0/8
ipfw add deny ip from 127.0.0.0/8 to any
if have_ip6; then
if have_ip6; then
ipfw add pass ip6 from any to any via lo0
ipfw add deny ip6 from any to ::1
ipfw add deny ip6 from ::1 to any
ipfw add pass ip6 from :: to ff02::/16 proto ipv6-icmp
ipfw add pass ip6 from fe80::/10 to fe80::/10 proto ipv6-icmp
ipfw add pass ip6 from fe80::/10 to ff02::/16 proto ipv6-icmp
@@ -78,7 +78,7 @@ start() {
ipfw add pass udp from 0.0.0.0 68 to 255.255.255.255 67 out
ipfw add pass udp from any 67 to me 68 in
ipfw add pass udp from any 67 to 255.255.255.255 68 in
# Some servers will ping the IP while trying to decide if it's
# Some servers will ping the IP while trying to decide if it's
# still in use.
ipfw add pass icmp from any to any icmptype 8
@@ -88,11 +88,11 @@ start() {
if have_ip6; then
# Allow ICMPv6 destination unreach
ipfw add pass ip6 from any to any icmp6types 1 proto ipv6-icmp
# Allow NS/NA/toobig (don't filter it out)
ipfw add pass ip6 from any to any icmp6types 2,135,136 proto ipv6-icmp
fi
# Add permits for this workstations published services below
# Only IPs and nets in firewall_allowservices is allowed in.
for i in $ipfw_ip_in; do
@@ -107,7 +107,7 @@ start() {
for i in $ipfw_ip_trust; do
ipfw add pass ip from $i to me
done
ipfw add 65000 count ip from any to any
# Drop packets to ports where we don't want logging
@@ -117,7 +117,7 @@ start() {
# Broadcasts and muticasts
ipfw add deny ip from any to 255.255.255.255
ipfw add deny ip from any to 224.0.0.0/24
ipfw add deny ip from any to 224.0.0.0/24
# Noise from routers
ipfw add deny udp from any to any 520 in

View File

@@ -8,7 +8,7 @@ depend()
{
need localmount termencoding
after bootmisc
keyword -openvz -prefix -uml -vserver -xenu
keyword -openvz -prefix -uml -vserver -xenu -lxc
}
start()
@@ -17,7 +17,7 @@ start()
: ${unicode:=$UNICODE}
: ${keymap:=$KEYMAP}
: ${extended_keymaps:=$EXTENDED_KEYMAPS}
: ${windowkeys:=$SET_WINDOWSKEYS}
: ${windowkeys:=$SET_WINDOWSKEYS}
: ${fix_euro:=$FIX_EURO}
: ${dumpkeys_charset:=${DUMPKEYS_CHARSET}}

View File

@@ -15,7 +15,7 @@ start()
killall5 -15
sleep 1
eend 0
ebegin "Killing remaining processes"
ebegin "Killing remaining processes"
killall5 -9
sleep 1
eend 0

View File

@@ -18,11 +18,6 @@ start()
local_start
fi
# Support old configs
if [ -e @SYSCONFDIR@/conf.d/local.start ]; then
. @SYSCONFDIR@/conf.d/local.start
fi
eend $? "Failed to start local"
}
@@ -34,10 +29,5 @@ stop()
local_stop
fi
# Support old configs
if [ -e @SYSCONFDIR@/conf.d/local.stop ]; then
. @SYSCONFDIR@/conf.d/local.stop
fi
eend $? "Failed to stop local"
}

View File

@@ -8,19 +8,23 @@ depend()
{
need fsck
use lvm modules mtab
after lvm modules
keyword -jail -openvz -prefix -vserver -lxc
}
start()
{
# Mount local filesystems in /etc/fstab.
local types="noproc" x=
local types="noproc" x= no_netdev=
for x in $net_fs_list; do
types="${types},${x}"
done
if [ "$RC_UNAME" = Linux ]; then
no_netdev="-O no_netdev"
fi
ebegin "Mounting local filesystems"
mount -at "$types"
mount -at "$types" $no_netdev
eend $? "Some local filesystem failed to mount"
# Always return 0 - some local mounts may not be critical for boot

View File

@@ -21,13 +21,13 @@ depend()
start()
{
ebegin "Starting $name"
ebegin "Starting $name"
if [ -z "$moused_device" ]; then
local dev=
for dev in /dev/psm[0-9]* /dev/ums[0-9]*; do
[ -c "$dev" ] || continue
[ -e /var/run/moused-"${dev##*/}".pid ] && continue
[ -e /var/run/moused-"${dev##*/}".pid ] && continue
moused_device=$dev
eindent
einfo "Using mouse on $moused_device"
@@ -37,7 +37,7 @@ start()
fi
if [ -z "$moused_device" ]; then
eend 1 "No mouse device found"
eend 1 "No mouse device found"
return 1
fi
@@ -49,7 +49,7 @@ start()
--pidfile "$pidfile" \
-- $args -p "$moused_device" -I "$pidfile"
local retval=$?
if [ $retval = 0 ]; then
local ttyv=
for ttyv in /dev/ttyv*; do
@@ -57,6 +57,6 @@ start()
: $((retval+= $?))
done
fi
eend $retval "Failed to start moused"
}

View File

@@ -180,7 +180,7 @@ _gen_module_list()
${update} || return 0
fi
einfo "Caching network module dependencies"
einfo "Caching network module dependencies"
# Run in a subshell to protect the main script
(
after() {
@@ -215,7 +215,7 @@ _gen_module_list()
for MODULE in "${MODULESDIR}"/*.sh; do
sh -n "${MODULE}" || continue
. "${MODULE}" || continue
. "${MODULE}" || continue
MODULE=${MODULE#${MODULESDIR}/}
MODULE=${MODULE%.sh}
eval ${MODULE}_depend
@@ -343,7 +343,7 @@ _load_modules()
# Wrap our provides
local f=
for f in pre_start start post_start; do
for f in pre_start start post_start; do
eval "${provides}_${f}() { [ "$(command -v "${mod}_${f}")" = "${mod}_${f}" ] || return 0; ${mod}_${f} \"\$@\"; }"
done
@@ -357,7 +357,7 @@ _load_modules()
*" ${mod} "*)
eval x=\$module_${mod}_provides
[ -z "${x}" ] && continue
for f in pre_start start post_start; do
for f in pre_start start post_start; do
eval "${x}_${f}() { [ "$(command -v "${mod}_${f}")" = "${mod}_${f}" ] || return 0; ${mod}_${f} \"\$@\"; }"
done
eval module_${x}_providedby="${mod}"
@@ -379,7 +379,7 @@ _load_modules()
MODULES="${MODULES}${MODULES:+ }${mod}"
done
else
for mod in ${LIST}; do
for mod in ${LIST}; do
MODULES="${mod}${MODULES:+ }${MODULES}"
done
fi
@@ -395,14 +395,14 @@ _load_config()
config_index=0
local IFS="$__IFS"
set -- ${config}
# We should support a space separated array for cidr configs
if [ $# = 1 ]; then
unset IFS
set -- ${config}
# Of course, we may have a single address added old style.
case "$2" in
netmask|broadcast|brd|brd+)
netmask|broadcast|brd|brd+|peer|pointopoint)
local IFS="$__IFS"
set -- ${config}
;;
@@ -415,7 +415,7 @@ _load_config()
config_0="127.0.0.1/8"
config_index=1
fi
else
else
if [ -z "$1" ]; then
ewarn "No configuration specified; defaulting to DHCP"
config_0="dhcp"
@@ -500,7 +500,7 @@ start()
fi
_up 2>/dev/null
for module in ${MODULES}; do
if [ "$(command -v "${module}_pre_start")" = "${module}_pre_start" ]; then
${module}_pre_start || exit $?
@@ -527,7 +527,7 @@ start()
_load_config
config_index=0
eval our_metric=\$metric_${IFVAR}
eval our_metric=\$metric_${IFVAR}
if [ -n "${our_metric}" ]; then
metric=${our_metric}
elif [ "${IFACE}" != "lo" -a "${IFACE}" != "lo0" ]; then
@@ -536,7 +536,7 @@ start()
while true; do
eval config=\$config_${config_index}
[ -z "${config}" ] && break
[ -z "${config}" ] && break
set -- ${config}
ebegin "$1"
@@ -638,7 +638,7 @@ ${routes}"
if [ "$(command -v postup)" = "postup" ]; then
ebegin "Running postup"
eindent
postup
postup
eoutdent
fi

View File

@@ -39,11 +39,11 @@ depend()
}
start()
{
{
local myneed= myuse= pmap="portmap" nfsmounts=
[ -x @SYSCONFDIR@/init.d/rpcbind ] && pmap="rpcbind"
local x= fs=
local x= fs= rc=
for x in $net_fs_list; do
case "$x" in
nfs|nfs4)
@@ -65,7 +65,12 @@ start()
ebegin "Mounting network filesystems"
mount -at $fs
ewend $? "Could not mount all network filesystems"
rc=$?
if [ "$RC_UNAME" = Linux ]; then
mount -a -O _netdev
rc=$?
fi
ewend $rc "Could not mount all network filesystems"
return 0
}
@@ -93,5 +98,9 @@ stop()
retval=$?
eoutdent
if [ "$RC_UNAME" = Linux ]; then
umount -a -O _netdev
retval=$?
fi
eend $retval "Failed to unmount network filesystems"
}

View File

@@ -57,6 +57,32 @@ sys_interfaces()
esac
}
tentative()
{
local inet= address= rest=
case "$RC_UNAME" in
Linux)
[ -x /sbin/ip ] || [ -x /bin/ip ] || return 1
[ -n "$(ip -f inet6 addr show tentative)" ]
;;
*)
local inet= address= rest=
LC_ALL=C ifconfig -a | while read inet address rest; do
case "${inet}" in
inet6)
case "${rest}" in
*" "tentative*) return 2;;
esac
;;
esac
done
[ $? = 2 ]
;;
esac
}
auto_interfaces()
{
local ifs= c= f=
@@ -135,7 +161,7 @@ runip()
routeflush()
{
if [ "$RC_UNAME" = Linux ]; then
if [ -x /sbin/ip ]; then
if [ -x /sbin/ip ] || [ -x /bin/ip ]; then
ip route flush scope global
ip route delete default 2>/dev/null
else
@@ -196,9 +222,7 @@ start()
einfo "Starting network"
routeflush
if [ "$RC_UNAME" = "Linux" ]; then
ifconfig lo 127.0.0.1 netmask 255.0.0.0 || cr=1
route add -net 127.0.0.0 netmask 255.0.0.0 \
gw 127.0.0.1 2>/dev/null
ifconfig lo 127.0.0.1 netmask 255.0.0.0 || cr=1
route add -net 127.0.0.0 netmask 255.0.0.0 \
gw 127.0.0.1 reject 2>/dev/null
else
@@ -251,6 +275,19 @@ start()
eoutdent
eend $cr
# Wait for any inet6 tentative addresses
r=5
while [ $r -gt 0 ]; do
tentative || break
[ $r = 5 ] && vebegin "Waiting for tentative addresses"
sleep 1
r=$(($r - 1))
done
if [ $r != 5 ]; then
[ $r != 0 ]
veend $?
fi
if [ -n "$defaultroute" ]; then
ebegin "Setting default route $defaultroute"
route add default $defaultroute
@@ -301,7 +338,7 @@ stop()
then
veinfo "$int"
runargs /etc/ifdown."$int" "$downcmd"
if [ -x /sbin/ip ]; then
if [ -x /sbin/ip ] || [ -x /bin/ip ]; then
# We need to do this, otherwise we may
# fail to add things correctly on restart
ip address flush dev "$int" 2>/dev/null

View File

@@ -44,7 +44,7 @@ reload()
{
ebegin "Reloading $name rules."
pfctl -q -n -f "$pf_conf" && \
{
{
# Flush everything but existing state entries that way when
# rules are read in, it doesn't break established connections.
pfctl -q -Fnat -Fqueue -Frules -FSources -Finfo -FTables -Fosfp

View File

@@ -13,7 +13,7 @@ depend()
start()
{
# Make sure we insert usbcore if its a module
# Make sure we insert usbcore if it's a module
if [ -f /proc/modules -a ! -d /proc/bus/usb ]; then
modprobe -q usbcore
fi

View File

@@ -13,11 +13,11 @@ start()
ebegin "Activating block swap devices"
swapctl -A -t blk >/dev/null
eend 0 # If swapon has nothing todo it errors, so always return 0
}
}
stop()
{
ebegin "Deactivating block swap devices"
swapctl -U -t blk >/dev/null
eend 0
eend 0
}

View File

@@ -16,7 +16,7 @@ start()
*) swapon -a >/dev/null;;
esac
eend 0 # If swapon has nothing todo it errors, so always return 0
}
}
stop()
{
@@ -31,5 +31,5 @@ stop()
NetBSD|OpenBSD) swapctl -U -t noblk >/dev/null;;
*) swapoff -a >/dev/null;;
esac
eend 0
eend 0
}

View File

@@ -15,13 +15,13 @@ start() {
done
eend $?
fi
if [ -n "$keymap" ]; then
ebegin "Setting keymap to $keymap"
kbdcontrol -l $keymap </dev/console
eend $?
fi
if [ -n "$keyrate" ]; then
ebegin "Setting keyrate to $keyrate"
kbdcontrol -r $keyrate </dev/console
@@ -40,7 +40,7 @@ start() {
done
eoutdent
fi
if [ -n "$cursor" ]; then
ebegin "Setting cursor"
vidcontrol -c $cursor

View File

@@ -4,7 +4,6 @@
depend()
{
use hostname
before bootmisc logger
keyword -prefix
}

View File

@@ -4,9 +4,8 @@
depend()
{
use hostname
before bootmisc logger
keyword -openvz -prefix -vserver
keyword -prefix -vserver
}
start()

View File

@@ -2,7 +2,7 @@
# Copyright (c) 2008 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license.
depend()
depend()
{
after fsck
keyword -prefix
@@ -13,7 +13,7 @@ start()
ebegin "Setting tty flags"
ttyflags -a
eend $? || return $?
if [ -c /dev/ttyp0 ]; then
chmod 666 /dev/tty[p-uw-zP-T][0-9a-zA-Z]
fi

View File

@@ -27,10 +27,10 @@ start()
font)
cmd=$wsfld
[ "$arg2" != "-" ] && cmd="$cmd -w $arg2"
[ "$arg3" != "-" ] && cmd="$cmd -h $arg3"
[ "$arg3" != "-" ] && cmd="$cmd -h $arg3"
[ "$arg4" != "-" ] && cmd="$cmd -e $arg4"
cmd="$cmd -N $arg1 $arg5"
eval "$cmd"
eval "$cmd"
;;
screen)

View File

@@ -39,7 +39,7 @@
.Nm eprefix
.Nd colorful informational output
.Sh LIBRARY
Enhanced Informatation output library (libeinfo, -leinfo)
Enhanced Information output library (libeinfo, -leinfo)
.Sh SYNOPSIS
.In einfo.h
.Ft int Fn einfo "const char * restrict format" ...

View File

@@ -36,7 +36,7 @@
.Nm
gathers and displays information about the status of services
in different runlevels. The default behavior is to show information
about the current runlevel and any unassgined services that are not stopped,
about the current runlevel and any unassigned services that are not stopped,
but any runlevel can be quickly examined.
.Pp
The options are as follows:
@@ -62,6 +62,10 @@ Show information only for the named
.Sh EXIT STATUS
.Nm
exits 0, except when checking for crashed services and it doesn't find any.
.Sh IMPLEMENTATION NOTES
.Nm
tries to list services within each runlevel in the presently resolved
dependency order if the dependency tree is available.
.Sh SEE ALSO
.Xr rc 8 ,
.Xr rc-update 8

View File

@@ -54,7 +54,7 @@ owned by
.Fa uid ,
all of which are optional.
.Pp
The retuned list should be freed when done.
The returned list should be freed when done.
.Sh IMPLEMENTATION NOTES
On BSD systems we use
.Lb libkvm

View File

@@ -42,7 +42,7 @@ is set to the hook running, and
.Fa name
is set to the name of the runlevel or name of the service.
.Pp
Plugins can affect the parent environemnt by writing NULL separated strings to
Plugins can affect the parent environment by writing NULL separated strings to
.Va rc_environ_fd .
.Sh SEE ALSO
.Xr rc 8 ,

View File

@@ -39,8 +39,8 @@
.Nm
is basically an interpreter for shell scripts which provide an easy interface
to the often complex system commands and daemons.
When a service runs a command it first loads it's mulitplexed configuration
file, then it's master configuration file, then
When a service runs a command it first loads its multiplexed configuration
file, then its master configuration file, then
.Pa /etc/rc.conf
and finally the script itself. At this point
.Nm
@@ -79,7 +79,7 @@ Ignore all dependency information the service supplies.
Only run the command if the service has been started.
.It Fl q , -quiet
Turns off all informational output the service generates.
Output from any non OpenRC comands is not affected.
Output from any non OpenRC commands is not affected.
.It Fl v , -verbose
Turns on any extra informational output the service generates.
.It Fl Z , -dry-run
@@ -90,9 +90,9 @@ or stopping them.
The following variables affect the service script:
.Bl -tag -width "RC_DEFAULTLEVEL"
.It Ar extra_commands
Space seperated list of extra commands the service defines.
Space separated list of extra commands the service defines.
.It Ar extra_started_commands
Space seperated list of extra commands the service defines. These only work if
Space separated list of extra commands the service defines. These only work if
the service has already been started.
.It Ar description
String describing the service.
@@ -128,7 +128,7 @@ will refuse to stop until any services that need it have stopped.
The service will attempt to start any services we use that have been added
to the runlevel.
.It Ic after
The service will start after thse services and stop before these services.
The service will start after these services and stop before these services.
.It Ic before
The service will start before these services and stop after these services.
.It Ic provide
@@ -138,13 +138,6 @@ We should recalculate our dependencies if the listed files have changed.
.It Ic keyword
Tags a service with a keyword. Here's the keywords we currently understand:-
.Bl -tag -width indent
.It Dv -jail
When in a jail, exclude this service from any dependencies. The service can
still be run directly.
.It Dv -openvz
Same as -jail, but for OpenVZ systems.
.It Dv -lxc
Same as -jail, but for Linux Resource Containers (LXC).
.It Dv -shutdown
Don't stop this service when shutting the system down.
This normally quite safe as remaining daemons will be sent a SIGTERM just
@@ -156,6 +149,18 @@ Don't stop this service when changing runlevels, even if not present.
This includes shutting the system down.
.It Dv -timeout
Do not time out waiting for that service.
.It Dv -jail
When in a jail, exclude this service from any dependencies. The service can
still be run directly. Set via
.Ic rc_sys
in
.Pa /etc/rc.conf
.It Dv -lxc
Same as -jail, but for Linux Resource Containers (LXC).
.It Dv -openvz
Same as -jail, but for OpenVZ systems.
.It Dv -prefix
Same as -jail, but for Prefix systems.
.It Dv -uml
Same as -jail, but for UML systems.
.It Dv -vserver
@@ -225,7 +230,7 @@ is newer than
return 0, otherwise 1.
If
.Ar file2
is a directory, then check all it's contents too.
is a directory, then check all its contents too.
.It Ic is_older_than Ar file1 Ar file2 ...
If
.Ar file1
@@ -234,7 +239,7 @@ is newer than
return 0, otherwise 1.
If
.Ar file2
is a directory, then check all it's contents too.
is a directory, then check all its contents too.
.It Ic service_set_value Ar name Ar value
Saves the
.Ar name
@@ -320,7 +325,7 @@ Configuration files, relative to the location of the service.
If a file ending with .${RC_RUNLEVEL} exists then we use that instead.
.Bl -ohang
.It Pa ../conf.d/${RC_SVCNAME%%.*}
mulitplexed configuration file.
multiplexed configuration file.
Example: if ${RC_SVCNAME} is net.eth1 then look for
.Pa ../conf.d/net .
.It Pa ../conf.d/${RC_SVCNAME}

View File

@@ -43,7 +43,7 @@
.Ar daemon
.Sh DESCRIPTION
.Nm
provides a consistent method of starting, stopping and signalling daemons.
provides a consistent method of starting, stopping and signaling daemons.
If neither
.Fl K , -stop
nor
@@ -85,7 +85,7 @@ then
.Nm
matches the process
.D1 /usr/bin/perl -w foo
If an interpreted daemon changes it's process name then this won't work.
If an interpreted daemon changes its process name then this won't work.
.It Fl u , -user Ar user Ns Op : Ns Ar group
Start the daemon as the
.Ar user

View File

@@ -17,6 +17,13 @@ SNAPFILE= ${SNAPDIR}.tar.bz2
dist:
git archive --prefix=${DISTPREFIX}/ ${GITREF} | bzip2 > ${DISTFILE}
distcheck: dist
rm -rf ${DISTPREFIX}
tar xf ${DISTFILE}
MAKEFLAGS= $(MAKE) -C ${DISTPREFIX}
MAKEFLAGS= $(MAKE) -C ${DISTPREFIX} check
rm -rf ${DISTPREFIX}
snapshot:
rm -rf /tmp/${SNAPDIR}
mkdir /tmp/${SNAPDIR}

View File

@@ -38,7 +38,7 @@ ${SHLIB_NAME}: ${SOBJS}
@${ECHO} building shared library $@
@rm -f $@ ${SHLIB_LINK}
@ln -fs $@ ${SHLIB_LINK}
${CC} ${LDFLAGS} -shared -Wl,-x \
${CC} ${CFLAGS} ${LDFLAGS} -shared -Wl,-x \
-o $@ -Wl,-soname,${SONAME} \
${SOBJS} ${LDADD}

View File

@@ -28,7 +28,7 @@ all: depend ${PROG}
${CC} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
${PROG}: ${SCRIPTS} ${OBJS}
${CC} ${LDFLAGS} -o $@ ${OBJS} ${LDADD}
${CC} ${CFLAGS} ${LDFLAGS} -o $@ ${OBJS} ${LDADD}
clean:
rm -f ${CLEANFILES}

View File

@@ -21,7 +21,7 @@ apipa_start()
local iface="$1" i1= i2= addr= i=0
_exists true || return 1
einfo "Searching for free addresses in 169.254.0.0/16"
eindent

View File

@@ -19,7 +19,7 @@ arping_address()
esac
# We need to bring the interface up to test
_exists "${iface}" || return 1
_exists "${iface}" || return 1
_up "${iface}"
eval w=\$arping_wait_${IFVAR}
@@ -43,7 +43,7 @@ arping_address()
sed -n -e 'y/abcdef/ABCDEF/' -e 's/.*\[\([^]]*\)\].*/\1/p')"
fi
[ -z "${foundmac}" ] && return 1
if [ -n "${mac}" ]; then
if [ "${mac}" != "${foundmac}" ]; then
vewarn "Found ${ip} but MAC ${foundmac} does not match"
@@ -74,7 +74,7 @@ arping_start()
fi
eindent
for x in ${gateways}; do
local IFS=,
set -- ${x}
@@ -119,7 +119,7 @@ arping_start()
fi
done
unset IFS
_load_config
return 0
fi

View File

@@ -15,7 +15,14 @@ _is_bond()
bonding_pre_start()
{
local x= s= slaves="$(_get_array "slaves_${IFVAR}")"
local x= s= n= slaves= primary=
slaves="$(_get_array "slaves_${IFVAR}")"
unset slaves_${IFVAR}
eval primary="\$primary_${IFVAR}"
unset primary_${IFVAR}
[ -z "${slaves}" ] && return 0
@@ -39,13 +46,31 @@ bonding_pre_start()
return 1
fi
# Configure the bond.
# Nice and dynamic :)
# Interface must be down in order to configure
_down
# Configure the bond mode, then we can reloop to ensure we configure
# All other options
for x in /sys/class/net/"${IFACE}"/bonding/mode; do
[ -f "${x}" ] || continue
n=${x##*/}
eval s=\$${n}_${IFVAR}
if [ -n "${s}" ]; then
einfo "Setting ${n}: ${s}"
echo "${s}" >"${x}" || \
eerror "Failed to configure $n (${n}_${IFVAR})"
fi
done
# Nice and dynamic for remaining options:)
for x in /sys/class/net/"${IFACE}"/bonding/*; do
[ -f "${x}" ] || continue
eval s=\$${x##*/}_${IFVAR}
n=${x##*/}
eval s=\$${n}_${IFVAR}
[ "${n}" != "mode" ] || continue
if [ -n "${s}" ]; then
echo "${s}" >"${x}"
einfo "Setting ${n}: ${s}"
echo "${s}" >"${x}" || \
eerror "Failed to configure $n (${n}_${IFVAR})"
fi
done
@@ -72,6 +97,11 @@ bonding_pre_start()
# finally add in slaves
eoutdent
if [ -d /sys/class/net ]; then
if [ -n "${primary}" ]; then
echo "+${primary}" >/sys/class/net/"${IFACE}"/bonding/slaves
echo "${primary}" >/sys/class/net/"${IFACE}"/bonding/primary
slaves="${slaves/${primary}/}"
fi
for s in ${slaves}; do
echo "+${s}" >/sys/class/net/"${IFACE}"/bonding/slaves
done
@@ -85,7 +115,7 @@ bonding_pre_start()
bonding_stop()
{
_is_bond || return 0
_is_bond || return 0
local slaves= s=
slaves=$( \
@@ -117,6 +147,12 @@ bonding_stop()
done
)
_down
if [ -d /sys/class/net ]; then
echo "-${IFACE}" > /sys/class/net/bonding_masters
fi
eend 0
return 0
}

View File

@@ -17,7 +17,7 @@ br2684ctl_depend()
}
_config_vars="$_config_vars bridge bridge_add brctl"
br2684ctl_pre_start()
{
local opts=
@@ -40,7 +40,7 @@ br2684ctl_pre_start()
return 1
;;
esac
einfo "Starting RFC 2684 Bridge control on ${IFACE}"
start-stop-daemon --start --exec $(_br2684ctl) --background \
--make-pidfile --pidfile "/var/run/br2684ctl-${IFACE}.pid" \
@@ -52,7 +52,7 @@ br2684ctl_post_stop()
{
local pidfile="/var/run/br2684ctl-${IFACE}.pid"
[ -e "${pidfile}" ] || return 0
einfo "Stopping RFC 2684 Bridge control on ${IFACE}"
start-stop-daemon --stop --quiet --pidfile "${pidfile}"
eend $?

View File

@@ -11,33 +11,64 @@ _config_vars="$_config_vars bridge bridge_add brctl"
_is_bridge()
{
brctl show 2>/dev/null | grep -q "^${IFACE}[[:space:]]"
[ -d /sys/class/net/"${1:-${IFACE}}"/bridge ]
return $?
}
_is_bridge_port()
{
[ -d /sys/class/net/"${1:-${IFACE}}"/brport ]
return $?
}
_bridge_ports()
{
for x in /sys/class/net/"${1:-${IFACE}}"/brif/*; do
n=${x##*/}
echo $n
done
}
bridge_pre_start()
{
local brif= iface="${IFACE}" e= x=
local brif= oiface="${IFACE}" e= x=
# ports is for static add
local ports="$(_get_array "bridge_${IFVAR}")"
# old config options
local opts="$(_get_array "brctl_${IFVAR}")"
# brif is used for dynamic add
eval brif=\$bridge_add_${IFVAR}
eval x=\${bridge_${IFVAR}-y\}
if [ -z "${brif}" -a -z "${opts}" ]; then
[ -n "${ports}" -o "${x}" != "y" ] || return 0
# we need a way to if the bridge exists in a variable name, not just the
# contents of a variable. Eg if somebody has only bridge_add_eth0='br0',
# with no other lines mentioning br0.
eval bridge_unset=\${bridge_${IFVAR}-y\}
eval brctl_unset=\${brctl_${IFVAR}-y\}
if [ -z "${brif}" -a "${brctl_unset}" == 'y' ]; then
if [ -z "${ports}" -a "${bridge_unset}" == "y" ]; then
#eerror "Misconfigured static bridge detected (see net.example)"
return 0
fi
fi
[ -n "${ports}" ] && bridge_post_stop
# If the bridge was already up, we should clear it
[ "${bridge_unset}" != "y" ] && bridge_post_stop
(
# Normalize order of variables
if [ -z "${ports}" -a -n "${brif}" ]; then
# Dynamic mode detected
ports="${IFACE}"
IFACE="${brif}"
IFVAR=$(shell_var "${IFACE}")
else
# Static mode detected
ports="${ports}"
metric=1000
fi
if ! _is_bridge; then
if ! _is_bridge ; then
ebegin "Creating bridge ${IFACE}"
if ! brctl addbr "${IFACE}"; then
eend 1
@@ -45,6 +76,12 @@ bridge_pre_start()
fi
fi
# TODO: does this reset the bridge every time we add a interface to the
# bridge? We should probably NOT do that.
# Old configuration set mechanism
# Only a very limited subset of the options are available in the old
# configuration method. The sysfs interface is in the next block instead.
local IFS="$__IFS"
for x in ${opts}; do
unset IFS
@@ -56,21 +93,50 @@ bridge_pre_start()
done
unset IFS
# New configuration set mechanism, matches bonding
for x in /sys/class/net/"${IFACE}"/bridge/*; do
[ -f "${x}" ] || continue
n=${x##*/}
eval s=\$${n}_${IFVAR}
if [ -n "${s}" ]; then
einfo "Setting ${n}: ${s}"
echo "${s}" >"${x}" || \
eerror "Failed to configure $n (${n}_${IFVAR})"
fi
done
if [ -n "${ports}" ]; then
einfo "Adding ports to ${IFACE}"
eindent
local OIFACE="${IFACE}"
local BR_IFACE="${IFACE}"
for x in ${ports}; do
ebegin "${x}"
local IFACE="${x}"
local IFVAR=$(shell_var "${IFACE}")
if ! _exists "${IFACE}" ; then
eerror "Cannot add non-existent interface ${IFACE} to ${BR_IFACE}"
return 1
fi
# The interface is known to exist now
_set_flag promisc
_up
if ! brctl addif "${OIFACE}" "${x}"; then
if ! brctl addif "${BR_IFACE}" "${x}"; then
_set_flag -promisc
eend 1
return 1
fi
# Per-interface bridge settings
for x in /sys/class/net/"${IFACE}"/brport/*; do
[ -f "${x}" ] || continue
n=${x##*/}
eval s=\$${n}_${IFVAR}
if [ -n "${s}" ]; then
einfo "Setting ${n}@${IFACE}: ${s}"
echo "${s}" >"${x}" || \
eerror "Failed to configure $n (${n}_${IFVAR})"
fi
done
eend 0
done
eoutdent
@@ -85,25 +151,24 @@ bridge_post_stop()
{
local port= ports= delete=false extra=
if _is_bridge; then
if _is_bridge "${IFACE}"; then
ebegin "Destroying bridge ${IFACE}"
_down
ports="$(brctl show 2>/dev/null | \
sed -n -e '/^'"${IFACE}"'[[:space:]]/,/^\S/ { /^\('"${IFACE}"'[[:space:]]\|\t\)/s/^.*\t//p }')"
for x in /sys/class/net/"${IFACE}"/brif/*; do
[ -s $x ] || continue
n=${x##*/}
ports="${ports} ${n}"
done
delete=true
iface=${IFACE}
eindent
else
# Work out if we're added to a bridge for removal or not
eval set -- $(brctl show 2>/dev/null | sed -e "s/'/'\\\\''/g" -e "s/$/'/g" -e "s/^/'/g")
local line=
for line; do
set -- ${line}
if [ "$3" = "${IFACE}" ]; then
iface=$1
break
fi
done
# We are taking down an interface that is part of a bridge maybe
ports="${IFACE}"
local brport_dir="/sys/class/net/${IFACE}/brport"
[ -d ${brport_dir} ] || return 0
iface=$(readlink ${brport_dir}/bridge)
iface=${iface##*/}
[ -z "${iface}" ] && return 0
extra=" from ${iface}"
fi
@@ -121,6 +186,6 @@ bridge_post_stop()
brctl delbr "${iface}"
eend $?
fi
return 0
}

View File

@@ -5,7 +5,7 @@ _config_vars="$_config_vars ccwgroup"
ccwgroup_depend()
{
before interface
before interface
}
ccwgroup_pre_start()
@@ -42,7 +42,7 @@ ccwgroup_pre_stop()
{
# Erase any existing ccwgroup to be safe
service_set_value ccwgroup_device ""
[ ! -L /sys/class/net/"${FACE}"/driver ] && return 0
local driver="$(readlink /sys/class/net/"${IFACE}"/driver)"
case "${diver}" in
@@ -59,7 +59,7 @@ ccwgroup_post_stop()
{
local device="$(service_get_value ccwgroup_device)"
[ -z "${device}" ] && return 0
einfo "Disabling ccwgroup on ${iface}"
echo "0" >/sys/devices/qeth/"${device}"/online
echo "1" >/sys/devices/qeth/"${device}"/ungroup

View File

@@ -97,7 +97,7 @@ clip_pre_start()
return 1
fi
fi
local started_here=
if ! are_atmclip_svcs_running; then
atmclip_svcs_start || return 1

View File

@@ -17,6 +17,7 @@ dhclient_start()
# Get our options
# These options only work in Gentoo, and maybe RedHat
eval args=\$dhclient_${IFVAR}
eval opts=\$dhcp_${IFVAR}
[ -z "${opts}" ] && opts=${dhcp}

View File

@@ -139,7 +139,7 @@ _add_address()
return 0
fi
case "$1" in
case "$1" in
*:*) ifconfig "${IFACE}" inet6 add "$@"; return $?;;
esac
@@ -172,7 +172,7 @@ _add_address()
cmd="${cmd} broadcast"
fi
;;
peer) cmd="${cmd} pointtopoint";;
peer) cmd="${cmd} pointopoint";;
*) cmd="${cmd} $1";;
esac
shift
@@ -225,7 +225,7 @@ _delete_addresses()
while true; do
local addr=$(_get_inet_address)
[ -z "${addr}" ] && break
if [ "${addr}" = "127.0.0.1/8" ]; then
# Don't delete the loopback address
[ "${IFACE}" = "lo" -o "${IFACE}" = "lo0" ] && break
@@ -246,7 +246,7 @@ _delete_addresses()
einfo "${addr}"
ifconfig "${IFACE}" inet6 del "${addr}"
done
return 0
}

View File

@@ -57,7 +57,7 @@ ifplugd_pre_start()
ewarn "WARNING: infinite timeout set for ${IFACE} to come up"
elif [ ${timeout} -lt 0 ]; then
einfo "Backgrounding ..."
exit 1
exit 1
fi
veinfo "Waiting for ${IFACE} to be marked as started"
@@ -84,7 +84,7 @@ ifplugd_stop()
local pidfile="/var/run/ifplugd.${IFACE}.pid"
[ ! -e "${pidfile}" ] && return 0
ebegin "Stopping ifplugd on ${IFACE}"
start-stop-daemon --stop --quiet --exec /usr/sbin/ifplugd \
--pidfile "${pidfile}" --signal QUIT

View File

@@ -50,7 +50,7 @@ ifwatchd_stop()
-- -c "${RC_LIBEXECDIR}/sh/ifwatchd-carrier.sh" \
-n "${RC_LIBEXECDIR}/sh/ifwatchd-nocarrier.sh" "${IFACE}" \
|| return 0
ebegin "Stopping ifwatchd on" "${IFACE}"
start-stop-daemon --stop --exec /usr/sbin/ifwatchd \
-- -c "${RC_LIBEXECDIR}/sh/ifwatchd-carrier.sh" \

View File

@@ -56,7 +56,7 @@ ip6to4_start()
[ ${i} -lt 32 ] && continue
;;
esac
veinfo "IPv4 address on ${host}: ${ip}/${subnet}"
local ipa= ip6= IFS="${IFS}."
for i in ${ip}; do
@@ -87,7 +87,7 @@ ip6to4_start()
eend $? || return 1
_up
fi
# Now apply our config
eval config_${config_index}=\'"${new}"\'
config_index=$((${config_index} - 1))

View File

@@ -1,9 +1,18 @@
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license.
_ip()
{
if [ -x /bin/ip ]; then
echo /bin/ip
else
echo /sbin/ip
fi
}
iproute2_depend()
{
program /sbin/ip
program $(_ip)
provide interface
after ifconfig
}
@@ -108,9 +117,14 @@ _add_address()
shift; shift; shift
set -- "${one}/$(_netmask2cidr "${three}")" "$@"
fi
#config=( "${config[@]//pointopoint/peer}" )
# tunnel keyword is 'peer' in iproute2, but 'pointopoint' in ifconfig.
if [ "$2" = "pointopoint" ]; then
local one="$1"
shift; shift
set -- "${one}" "peer" "$@"
fi
# Always scope lo addresses as host unless specified otherwise
if [ "${IFACE}" = "lo" ]; then
set -- "$@" "scope" "host"
@@ -127,6 +141,7 @@ _add_address()
;;
esac
veinfo ip addr add "$@" dev "${IFACE}"
ip addr add "$@" dev "${IFACE}"
}
@@ -147,7 +162,7 @@ _add_route()
set -- "${one}" "${two}" via "$@"
fi
local cmd= have_metric=false
local cmd= have_metric=false
while [ -n "$1" ]; do
case "$1" in
metric) cmd="${cmd} $1"; have_metric=true;;
@@ -160,11 +175,13 @@ _add_route()
# We cannot use a metric if we're using a nexthop
if ! ${have_metric} && \
[ -n "${metric}" -a -z "${cmd##* nexthop }" ]
[ -n "${metric}" -a \
"${cmd##* nexthop }" = "$cmd" ]
then
cmd="${cmd} metric ${metric}"
fi
veinfo ip ${family} route append ${cmd} dev "${IFACE}"
ip ${family} route append ${cmd} dev "${IFACE}"
eend $?
}
@@ -189,6 +206,32 @@ _tunnel()
ip tunnel "$@"
}
# This is just to trim whitespace, do not add any quoting!
_trim() {
echo $*
}
# This is our interface to Routing Policy Database RPDB
# This allows for advanced routing tricks
_ip_rule_runner() {
local cmd rules OIFS="${IFS}"
cmd="$1"
rules="$2"
veindent
local IFS="$__IFS"
for ru in $rules ; do
unset IFS
ruN="$(trim "${ru}")"
[ -z "${ruN}" ] && continue
vebegin "${cmd} ${ruN}"
ip rule ${cmd} ${ru}
veend $?
local IFS="$__IFS"
done
IFS="${OIFS}"
veoutdent
}
iproute2_pre_start()
{
local tunnel=
@@ -200,7 +243,7 @@ iproute2_pre_start()
ebegin "Creating tunnel ${IFVAR}"
ip tunnel add ${tunnel} name "${IFACE}"
eend $? || return 1
_up
_up
fi
# MTU support
@@ -230,6 +273,16 @@ iproute2_post_start()
# Kernel may not have IP built in
if [ -e /proc/net/route ]; then
local rules="$(_get_array "rules_${IFVAR}")"
if [ -n "${rules}" ]; then
if ! ip rule list | grep -q "^"; then
eerror "IP Policy Routing (CONFIG_IP_MULTIPLE_TABLES) needed for ip rule"
else
service_set_value "ip_rule" "${rules}"
einfo "Adding RPDB rules"
_ip_rule_runner add "${rules}"
fi
fi
ip route flush table cache dev "${IFACE}"
fi
@@ -249,6 +302,16 @@ iproute2_post_start()
iproute2_post_stop()
{
# Kernel may not have IP built in
if [ -e /proc/net/route ]; then
local rules="$(service_get_value "ip_rule")"
if [ -n "${rules}" ]; then
einfo "Removing RPDB rules"
_ip_rule_runner del "${rules}"
fi
ip route flush table cache dev "${IFACE}"
fi
# Don't delete sit0 as it's a special tunnel
if [ "${IFACE}" != "sit0" ]; then
if [ -n "$(ip tunnel show "${IFACE}" 2>/dev/null)" ]; then

View File

@@ -477,7 +477,7 @@ iwconfig_defaults()
#ifconfig "${iface}" txpower 100 2>/dev/null
ifconfig "${IFACE}" bssid -
ifconfig "${IFACE}" ssid -
ifconfig "${IFACE}" wepkey 1:- wepkey 2:- wepkey 3:- wepkey 4:-
ifconfig "${IFACE}" wepkey 1:- wepkey 2:- wepkey 3:- wepkey 4:-
ifconfig "${IFACE}" authmode open
ifconfig "${IFACE}" -mediaopt adhoc
ifconfig "${IFACE}" -mediaopt hostap
@@ -563,8 +563,8 @@ iwconfig_pre_start()
return 0
fi
iwconfig_defaults
iwconfig_user_config
iwconfig_defaults
iwconfig_user_config
# Set the base metric to be 2000
metric=2000

View File

@@ -47,7 +47,7 @@ _get_ssid()
_get_ap_mac_address()
{
local mac="$(iwgetid --raw --ap "${IFACE}")"
local mac="$(iwgetid --raw --ap "${IFACE}")"
case "${mac}" in
"00:00:00:00:00:00") return 1;;
"44:44:44:44:44:44") return 1;;
@@ -163,7 +163,7 @@ iwconfig_setup_specific()
local key=$(iwconfig_get_wep_key)
iwconfig_set_mode "${mode}"
# Now set the key
if ! eval iwconfig "${IFACE}" key "${key}"; then
if [ "${key}" != "off" ]; then
@@ -185,10 +185,10 @@ iwconfig_setup_specific()
ewarn "${IFACE} does not support setting the channel to \"${channel:-3}\""
return 1
fi
# Finally apply the user Config
iwconfig_user_config
iwconfig_report
return 0
}
@@ -226,7 +226,7 @@ iwconfig_wait_for_association()
/proc/net/wireless)" != "0" ] && return 0
fi
fi
sleep 1
[ ${timeout} -eq 0 ] && continue
i=$((${i} + 1))
@@ -281,7 +281,7 @@ iwconfig_associate()
iwconfig "${IFACE}" freq "${freq}"
fi
[ -n "${mac}" ] && iwconfig "${IFACE}" ap "${mac}"
# Finally apply the user Config
iwconfig_user_config
@@ -377,10 +377,10 @@ iwconfig_scan()
for line; do
case "${line}" in
*Address:*)
APS=$((${APS} + 1))
APS=$((${APS} + 1))
eval MAC_${APS}="\""$(echo "${line#*: }" | tr '[:lower:]' '[:upper:]')"\""
eval QUALITY_${APS}=0
;;
;;
*ESSID:*)
x=${line#*\"}
x=${x%*\"}
@@ -455,7 +455,7 @@ iwconfig_scan()
eval a=\$QUALITY_${i}
eval b=\$QUALITY_${k}
local u=${k}
# We need to split this into two tests, otherwise bash errors
# We need to split this into two tests, otherwise bash errors
[ -n "${a}" -a -n "${b}" ] && [ "${a}" -lt "${b}" ] && u=${i}
unset MAC_${u} SSID_${u} MODE_${u} CHAN_${u} QUALITY_${u} ENC_${u}
fi
@@ -581,7 +581,7 @@ iwconfig_connect_not_preferred()
break
fi
done
if ! ${pref}; then
SSID=${e}
eval mode=\$MODE_${i}
@@ -711,10 +711,10 @@ iwconfig_pre_start()
# wait if our scan returns nothing
LC_ALL=C iwconfig "${IFACE}" | sed -e '1d' | grep -q "Tx-Power=off"
local txpowerwasoff=$?
iwconfig_defaults
iwconfig_user_config
# Set the base metric to be 2000
metric=2000

View File

@@ -24,7 +24,7 @@ macchanger_pre_start()
# The interface needs to be up for macchanger to work most of the time
_down
mac=$(echo "${mac}" | tr '[:upper:]' '[:lower:]')
local hex="[0-9a-f][0-9a-f]"
case "${mac}" in

View File

@@ -59,7 +59,7 @@ netplugd_pre_start()
ewarn "WARNING: infinite timeout set for ${IFACE} to come up"
elif [ ${timeout} -lt 0 ]; then
einfo "Backgrounding ..."
exit 1
exit 1
fi
veinfo "Waiting for ${IFACE} to be marked as started"
@@ -86,7 +86,7 @@ netplugd_stop()
local pidfile="/var/run/netplugd-${IFACE}.pid"
[ ! -e "${pidfile}" ] && return 0
ebegin "Stopping netplug on" "${IFACE}"
start-stop-daemon --stop --quiet --exec /sbin/netplugd \
--pidfile "${pidfile}"

View File

@@ -31,7 +31,7 @@ pppd_pre_start()
if yesno ${IN_BACKGROUND}; then
local config=
eval config=\$config_${IFVAR}
# If no config for ppp then don't default to DHCP
# If no config for ppp then don't default to DHCP
if [ -z "${config}" ]; then
eval config_${IFVAR}=null
fi
@@ -39,7 +39,7 @@ pppd_pre_start()
fi
local link= i= unit="${IFACE#ppp}" opts=
# PPP requires a link to communicate over - normally a serial port
# PPPoE communicates over Ethernet
# PPPoA communicates over ATM
@@ -92,7 +92,7 @@ pppd_pre_start()
&& [ -n "${password}" -o -z "${passwordset}" ]; then
opts="plugin passwordfd.so ${opts} passwordfd 0"
fi
if ! ${hasdefaultmetric}; then
local m=
eval m=\$metric_${IFVAR}
@@ -122,7 +122,7 @@ pppd_pre_start()
# Set unit
opts="unit ${unit} ${opts}"
# Setup connect script
local chatprog="/usr/sbin/chat -e -E -v" phone=
eval phone=\$phone_number_${IFVAR}

View File

@@ -35,7 +35,7 @@ pump_start()
ebegin "Running pump"
eval pump "${args}"
eend $? || return 1
eend $? || return 1
_show_address
return 0
@@ -48,7 +48,7 @@ pump_stop()
start-stop-daemon --quiet --test --stop --exec /sbin/pump || return 0
# Check that pump is running on the interface
if ! pump --status --interface "${IFACE}" >/dev/null 2>&1; then
if ! pump --status --interface "${IFACE}" >/dev/null 2>&1; then
return 0
fi

View File

@@ -80,10 +80,10 @@ _system_nis()
eval servers=\$nis_servers_${IFVAR}
[ -z "${servers}" ] && servers=${nis_servers}
eval domain=\$nis_domain_${IFVAR}
[ -z "${domain}" ] && domain=${nis_domain}
[ -z "${servers}" -a -z "${domain}" ] && return 0
buffer="# Generated by net-scripts for interface ${iface}\n"
@@ -110,8 +110,8 @@ _system_nis()
system_pre_start()
{
_system_dns
_system_ntp
_system_nis
_system_ntp
_system_nis
return 0
}

View File

@@ -26,7 +26,7 @@ tuntap_pre_start()
return 1
fi
vebegin "Waiting for /dev/net/tun"
# /dev/net/tun can take it's time to appear
# /dev/net/tun can take its time to appear
local timeout=10
while [ ! -e /dev/net/tun -a ${timeout} -gt 0 ]; do
sleep 1

View File

@@ -20,7 +20,7 @@ _is_vlan()
_get_vlans()
{
[ -e /proc/net/vlan/config ] || return 1
sed -n -e 's/^\(.*[0-9]\) \(.* \) .*'"${IFACE}"'$/\1/p' /proc/net/vlan/config
sed -n -e 's/^\W*\([^ ]*\) \(.* \) .*'"${IFACE}"'$/\1/p' /proc/net/vlan/config
}
_check_vlan()
@@ -68,7 +68,7 @@ vlan_post_start()
local vlans=
eval vlans=\$vlans_${IFVAR}
[ -z "${vlans}" ] && return 0
_check_vlan || return 1
_exists || return 1
@@ -87,7 +87,7 @@ vlan_post_start()
# We need to work out the interface name of our new vlan id
local ifname="$(sed -n -e \
's/^\([^[:space:]]*\) *| '"${vlan}"' *| .*'"${iface}"'$/\1/p' \
's/^\([^[:space:]]*\) *| '"${vlan}"' *| .*'"${IFACE}"'$/\1/p' \
/proc/net/vlan/config )"
mark_service_started "net.${ifname}"
(
@@ -95,7 +95,7 @@ vlan_post_start()
start
) || mark_service_stopped "net.${ifname}"
done
return 0
}

View File

@@ -3,10 +3,14 @@
wpa_supplicant_depend()
{
if [ -x /usr/sbin/wpa_supplicant ]; then
program start /usr/sbin/wpa_supplicant
else
program start /sbin/wpa_supplicant
wpas=/usr/sbin/wpa_supplicant
[ -x ${wpas} ] || wpas=/sbin/wpa_supplicant
if [ -x ${wpas} ]; then
program start ${wpas}
# bug 345281: if wpa_supplicant is built w/ USE=dbus, we need to start
# dbus before we can start wpa_supplicant.
${wpas} -h |grep DBus -sq
[ $? -eq 0 ] && need dbus
fi
after macnet plug
before interface
@@ -145,7 +149,7 @@ wpa_supplicant_pre_start()
if [ -z "${wpac}" ]; then
if service_started devd; then
ebegin "Backgrounding ..."
exit 1
exit 1
fi
return 0
fi
@@ -163,7 +167,7 @@ wpa_supplicant_pre_start()
-P "/var/run/wpa_cli-${IFACE}.pid" -B
if eend $?; then
ebegin "Backgrounding ..."
exit 1
exit 1
fi
# wpa_cli failed to start? OK, error here

View File

@@ -2,7 +2,8 @@ DIR= ${LIBDIR}/pkgconfig
SRCS= einfo.pc.in openrc.pc.in
INC= einfo.pc openrc.pc
sed -n -e 's/^VERSION=[[:space:]]*\([^[:space:]]*\).*/#define VERSION "\1${GITVER}\"/p' ../../Makefile > version.h
.DEFAULT:
${SED} -n -e 's/^VERSION=[[:space:]]*\([^[:space:]]*\).*/#define VERSION "\1${GITVER}\"/p' ../../Makefile > version.h
SED_EXTRA= -e 's:@VERSION@:${VERSION}:g'

View File

@@ -6,26 +6,30 @@
if [ -f /proc/acpi/ac_adapter/AC*/state ]; then
cat /proc/acpi/ac_adapter/AC*/state | while read line; do
case "$line" in
"state:"*"off-line") return 128;;
"state:"*"off-line") exit 128;;
esac
done
elif [ -f /sys/class/power_supply/AC*/online ]; then
cat /sys/class/power_supply/AC*/online | while read line; do
[ "${line}" = 0 ] && exit 128
done
elif [ -f /proc/pmu/info ]; then
cat /proc/pmu/info | while read line; do
case "$line" in
"AC Power"*": 0") return 128;;
"AC Power"*": 0") exit 128;;
esac
done
elif type envstat >/dev/null 2>&1; then
# NetBSD has envstat
envstat -d acpiacad0 2>/dev/null | while read line; do
case "$line" in
"connected:"*"OFF") return 128;;
"connected:"*"OFF") exit 128;;
esac
done
elif sysctl -q hw.acpi.acline >/dev/null 2>/dev/null; then
case $(sysctl -n hw.acpi.acline) in
0) return 1;;
*) return 0;;
0) exit 1;;
*) exit 0;;
esac
else
exit 255

View File

@@ -5,6 +5,7 @@
# All rights reserved. Released under the 2-clause BSD license.
. @SYSCONFDIR@/init.d/functions.sh
. @LIBEXECDIR@/sh/rc-functions.sh
config() {
[ -n "$*" ] && echo "$RC_SVCNAME config $*" >&3
@@ -82,24 +83,7 @@ do
if . "$_dir/$RC_SVCNAME"; then
echo "$RC_SVCNAME" >&3
depend
_rc_svcname=$(shell_var "$RC_SVCNAME")
# Add any user defined depends
for _deptype in config:CONFIG need:NEED use:USE \
after:AFTER before:BEFORE \
provide:PROVIDE keyword:KEYWORD; do
IFS=:
set -- $_deptype
unset IFS
eval _depends=\$rc_$_rc_svcname_$1
[ -z "$_depends" ] && eval _depends=\$rc_$1
[ -z "$_depends" ] && \
eval _depends=\$RC_$_rc_svcname_$2
[ -z "$_depends" ] && eval _depends=\$RC_$2
$1 ${_depends}
done
_depend
fi
)
done

View File

@@ -17,7 +17,7 @@ fi
if [ -e /etc/runlevels/"$RC_DEFAULTLEVEL"/consolefont \
-o -e /etc/runlevels/"$RC_BOOTLEVEL"/consolefont ]; then
printf "\033%s" "$termencoding" >"$CONSOLE" 2>/dev/null
if [ -r "$RC_LIBEXECDIR"/console/font -a -x /bin/setfont ]; then
if [ -r "$RC_LIBEXECDIR"/console/font -a -x /usr/bin/setfont ]; then
font="$(cat "$RC_LIBEXECDIR"/console/font)"
[ -c "$CONSOLE" ] && cons="-C $CONSOLE"
setfont $cons "$RC_LIBEXECDIR"/console/"$font" 2>/dev/null
@@ -29,7 +29,7 @@ if [ -e /etc/runlevels/"$RC_DEFAULTLEVEL"/keymaps \
-o -e /etc/runlevels/"$RC_BOOTLEVEL"/keymaps ]; then
kbd_mode $kmode -C "$CONSOLE" 2>/dev/null
if [ -r "$RC_LIBEXECDIR"/console/keymap ]; then
loadkeys "$RC_LIBEXECDIR"/console/keymap 2>/dev/null
loadkeys -q "$RC_LIBEXECDIR"/console/keymap 2>/dev/null
fi
fi

View File

@@ -6,6 +6,17 @@
# This basically mounts $RC_SVCDIR as a ramdisk.
# The tricky part is finding something our kernel supports
# tmpfs and ramfs are easy, so force one or the other.
svcdir_restorecon()
{
local rc=0
if [ -x /usr/sbin/selinuxenabled -a -c /selinux/null ] &&
selinuxenabled; then
restorecon $RC_SVCDIR
rc=$?
fi
return $rc
}
mount_svcdir()
{
# mount from fstab if we can
@@ -16,10 +27,14 @@ mount_svcdir()
# Some buggy kernels report tmpfs even when not present :(
if grep -Eq "[[:space:]]+tmpfs$" /proc/filesystems; then
mount -n -t tmpfs $fsopts,mode=755,size=${svcsize}k \
rc-svcdir "$RC_SVCDIR" && return 0
local tmpfsopts="${fsopts},mode=755,size=${svcsize}k"
mount -n -t tmpfs $tmpfsopts rc-svcdir "$RC_SVCDIR"
if [ $? -eq 0 ]; then
svcdir_restorecon
[ $? -eq 0 ] && return 0
fi
fi
if grep -Eq "[[:space:]]+ramfs$" /proc/filesystems; then
fs="ramfs"
# ramfs has no special options
@@ -38,6 +53,10 @@ mount_svcdir()
fi
mount -n -t "$fs" $fsopts rc-svcdir "$RC_SVCDIR"
if [ $? -eq 0 ]; then
svcdir_restorecon
[ $? -eq 0 ] && return 0
fi
}
. "$RC_LIBEXECDIR"/sh/functions.sh
@@ -46,19 +65,27 @@ mount_svcdir()
# By default VServer already has /proc mounted, but OpenVZ does not!
# However, some of our users have an old proc image in /proc
# NFC how they managed that, but the end result means we have to test if
# /proc actually works or not. We to this by comparing uptime to one a second
# ago
# /proc actually works or not. We to this by comparing two reads of
# /proc/self/stat. They will not match, because at least the minor fault count
# field (field 10) should have changed.
#
# We can use any file here that fills the following requirements:
# - changes between sequential reads
# - is world-readable (not blocked in hardened kernel)
# - Is only a single line (ergo entire check is doable with no forks)
mountproc=true
if [ -e /proc/uptime ]; then
up="$(cat /proc/uptime)"
sleep 1
if [ "$up" = "$(cat /proc/uptime)" ]; then
f=/proc/self/stat
if [ -e $f ]; then
exec 9<$f ; read a <&9 ; exec 9<&-
exec 9<$f ; read b <&9 ; exec 9<&-
if [ "$a" = "$b" ]; then
eerror "You have cruft in /proc that should be deleted"
else
einfo "/proc is already mounted, skipping"
mountproc=false
fi
fi
unset a b f
if $mountproc; then
procfs="proc"
@@ -70,4 +97,14 @@ if $mountproc; then
eend $?
fi
# Try to mount xenfs as early as possible, otherwise rc_sys() will always
# return RC_SYS_XENU and will think that we are in a domU while it's not.
if grep -Eq "[[:space:]]+xenfs$" /proc/filesystems; then
ebegin "Mounting xenfs"
if ! fstabinfo --mount /proc/xen; then
mount -n -t xenfs xenfs /proc/xen -o nosuid,nodev,noexec
fi
eend $?
fi
. "$RC_LIBEXECDIR"/sh/init-common-post.sh

View File

@@ -38,7 +38,8 @@ stop_addon()
( import_addon "$1-stop" )
}
net_fs_list="afs cifs coda davfs fuse gfs ncpfs nfs nfs4 ocfs2 shfs smbfs"
net_fs_list="afs cifs coda davfs fuse fuse.sshfs gfs glusterfs lustre
ncpfs nfs nfs4 ocfs2 shfs smbfs $extra_net_fs_list"
is_net_fs()
{
[ -z "$1" ] && return 1
@@ -84,6 +85,27 @@ get_bootparam()
return 1
}
# Called from runscript.sh or gendepends.sh
_depend() {
depend
local _rc_svcname=$(shell_var "$RC_SVCNAME") _deptype= _depends=
# Add any user defined depends
for _deptype in config:CONFIG need:NEED use:USE \
after:AFTER before:BEFORE \
provide:PROVIDE keyword:KEYWORD; do
IFS=:
set -- $_deptype
unset IFS
eval _depends=\$rc_${_rc_svcname}_$1
[ -z "$_depends" ] && eval _depends=\$rc_$1
[ -z "$_depends" ] && eval _depends=\$RC_${_rc_svcname}_$2
[ -z "$_depends" ] && eval _depends=\$RC_$2
$1 $_depends
done
}
# Add our sbin to $PATH
case "$PATH" in
"$RC_LIBEXECDIR"/sbin|"$RC_LIBEXECDIR"/sbin:*);;

View File

@@ -26,6 +26,8 @@ do_unmount()
# Unmounting a shared mount can unmount other mounts, so
# we need to check the mount is still valid
mountinfo --quiet "$mnt" || continue
# Ensure we interpret all characters properly.
mnt=$(printf "$mnt")
case "$cmd" in
umount)
@@ -36,7 +38,7 @@ do_unmount()
;;
esac
retry=3
retry=4 # Effectively TERM, sleep 1, TERM, sleep 1, KILL, sleep 1
while ! LC_ALL=C $cmd "$mnt" 2>/dev/null; do
if type fuser >/dev/null 2>&1; then
pids="$(fuser $f_opts "$mnt" 2>/dev/null)"
@@ -53,13 +55,16 @@ do_unmount()
eend 1 "in use but fuser finds nothing"
retry=0;;
*)
local sig="KILL"
[ $retry -gt 0 ] && sig="TERM"
fuser $f_kill$sig -k $f_opts \
"$mnt" >/dev/null 2>&1
sleep 1
retry=$(($retry - 1))
[ $retry -le 0 ] && eend 1
if [ $retry -le 0 ]; then
eend 1
else
local sig="TERM"
retry=$(($retry - 1))
[ $retry = 1 ] && sig="KILL"
fuser $f_kill$sig -k $f_opts \
"$mnt" >/dev/null 2>&1
sleep 1
fi
;;
esac
[ $retry -le 0 ] && break

View File

@@ -4,12 +4,24 @@
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license.
. @SYSCONFDIR@/init.d/functions.sh
. @LIBEXECDIR@/sh/rc-functions.sh
sourcex()
{
if [ "$1" = "-e" ]; then
shift
[ -e "$1" ] || return 1
fi
if ! . "$1"; then
eerror "$RC_SVCNAME: error loading $1"
exit 1
fi
}
sourcex "@SYSCONFDIR@/init.d/functions.sh"
sourcex "@LIBEXECDIR@/sh/rc-functions.sh"
# Support LiveCD foo
if [ -r /sbin/livecd-functions.sh ]; then
. /sbin/livecd-functions.sh
sourcex "/sbin/livecd-functions.sh"
livecd_read_commandline
fi
@@ -89,7 +101,7 @@ _status()
return 0
else
einfo "status: stopped"
return 1
return 3
fi
}
@@ -99,7 +111,7 @@ start()
[ -n "$command" ] || return 0
local _background=
ebegin "Starting ${name:-$RC_SVCNAME}"
if yesno "${command_background}"; then
if yesno "${command_background}"; then
_background="--background --pidfile"
fi
if yesno "$start_inactive"; then
@@ -145,30 +157,26 @@ _conf_d=${RC_SERVICE%/*}/../conf.d
# If we're net.eth0 or openvpn.work then load net or openvpn config
_c=${RC_SVCNAME%%.*}
if [ -n "$_c" -a "$_c" != "$RC_SVCNAME" ]; then
if [ -e "$_conf_d/$_c.$RC_RUNLEVEL" ]; then
. "$_conf_d/$_c.$RC_RUNLEVEL"
elif [ -e "$_conf_d/$_c" ]; then
. "$_conf_d/$_c"
if ! sourcex -e "$_conf_d/$_c.$RC_RUNLEVEL"; then
sourcex -e "$_conf_d/$_c"
fi
fi
unset _c
# Overlay with our specific config
if [ -e "$_conf_d/$RC_SVCNAME.$RC_RUNLEVEL" ]; then
. "$_conf_d/$RC_SVCNAME.$RC_RUNLEVEL"
elif [ -e "$_conf_d/$RC_SVCNAME" ]; then
. "$_conf_d/$RC_SVCNAME"
if ! sourcex -e "$_conf_d/$RC_SVCNAME.$RC_RUNLEVEL"; then
sourcex -e "$_conf_d/$RC_SVCNAME"
fi
unset _conf_d
# Load any system overrides
[ -e @SYSCONFDIR@/rc.conf ] && . @SYSCONFDIR@/rc.conf
sourcex -e "@SYSCONFDIR@/rc.conf"
# Apply any ulimit defined
[ -n "${rc_ulimit:-$RC_ULIMIT}" ] && ulimit ${rc_ulimit:-$RC_ULIMIT}
# Load our script
. "$RC_SERVICE"
sourcex "$RC_SERVICE"
for _d in $required_dirs; do
if [ ! -d $_d ]; then
@@ -187,8 +195,14 @@ done
unset _f
while [ -n "$1" ]; do
# Sepcial case depend
if [ "$1" = depend ]; then
shift
_depend
continue
fi
# See if we have the required function and run it
for _cmd in describe start stop status depend ${extra_commands:-$opts} \
for _cmd in describe start stop status ${extra_commands:-$opts} \
$extra_started_commands
do
if [ "$_cmd" = "$1" ]; then
@@ -238,7 +252,7 @@ while [ -n "$1" ]; do
eerror "$RC_SVCNAME: function \`$1' defined but does not exist"
exit 1
fi
fi
fi
fi
done
eerror "$RC_SVCNAME: unknown function \`$1'"

View File

@@ -643,7 +643,7 @@ static int EINFO_PRINTF(3, 0)
fprintf(f, "\n");
if (_eprefix)
fprintf(f, "%s%s%s|", _ecolor(f, color), _eprefix, _ecolor(f, ECOLOR_NORMAL));
fprintf(f, "%s*%s ", _ecolor(f, color), _ecolor(f, ECOLOR_NORMAL));
fprintf(f, " %s*%s ", _ecolor(f, color), _ecolor(f, ECOLOR_NORMAL));
retval += _eindent(f);
va_copy(ap, va);
retval += vfprintf(f, fmt, ap) + 3;
@@ -800,7 +800,7 @@ ebegin(const char *EINFO_RESTRICT fmt, ...)
va_start(ap, fmt);
retval = _einfovn(fmt, ap);
va_end(ap);
retval += printf("...");
retval += printf(" ...");
if (colour_terminal(stdout))
retval += printf("\n");
LASTCMD("ebegin");
@@ -817,7 +817,7 @@ _eend(FILE * EINFO_RESTRICT fp, int col, ECOLOR color, const char *msg)
if (!msg)
return;
cols = get_term_columns(fp) - (strlen(msg) + 3);
cols = get_term_columns(fp) - (strlen(msg) + 5);
/* cons25 is special - we need to remove one char, otherwise things
* do not align properly at all. */
@@ -831,18 +831,15 @@ _eend(FILE * EINFO_RESTRICT fp, int col, ECOLOR color, const char *msg)
if (term_is_cons25)
cols--;
/* If extra spacing is required around msg, then please change
* via a runtime knob and leave this default as is as it saves 2
* valuable columns when running on 80 column screens. */
if (cols > 0 && colour_terminal(fp)) {
fprintf(fp, "%s%s %s[%s%s%s]%s\n", up, tgoto(goto_column, 0, cols),
fprintf(fp, "%s%s %s[%s %s %s]%s\n", up, tgoto(goto_column, 0, cols),
ecolor(ECOLOR_BRACKET), ecolor(color), msg,
ecolor(ECOLOR_BRACKET), ecolor(ECOLOR_NORMAL));
} else {
if (col > 0)
for (i = 0; i < cols - col; i++)
fprintf(fp, " ");
fprintf(fp, " [%s]\n", msg);
fprintf(fp, " [ %s ]\n", msg);
}
}
@@ -1030,7 +1027,7 @@ ebeginv(const char *EINFO_RESTRICT fmt, ...)
va_start(ap, fmt);
retval = _einfovn(fmt, ap);
retval += printf("...");
retval += printf(" ...");
if (colour_terminal(stdout))
retval += printf("\n");
va_end(ap);

View File

@@ -40,7 +40,7 @@ pid_is_exec(pid_t pid, const char *exec)
int c;
bool retval = false;
exec = basename_c(exec);
exec = basename_c(exec);
snprintf(buffer, sizeof(buffer), "/proc/%d/stat", pid);
if ((fp = fopen(buffer, "r"))) {
while ((c = getc(fp)) != EOF && c != '(')
@@ -283,7 +283,7 @@ _match_daemon(const char *path, const char *file, RC_STRINGLIST *match)
}
static RC_STRINGLIST *
_match_list(const char *exec, const char* const* argv, const char *pidfile)
_match_list(const char *exec, const char *const *argv, const char *pidfile)
{
RC_STRINGLIST *match = rc_stringlist_new();
int i = 0;
@@ -297,7 +297,7 @@ _match_list(const char *exec, const char* const* argv, const char *pidfile)
rc_stringlist_add(match, m);
free(m);
}
while (argv && argv[i]) {
l = strlen(*argv) + strlen("argv_=") + 16;
m = xmalloc(sizeof(char) * l);
@@ -323,7 +323,7 @@ rc_service_daemon_set(const char *service, const char *exec,
const char *pidfile, bool started)
{
char dirpath[PATH_MAX];
char file[PATH_MAX];
char file[PATH_MAX];
int nfiles = 0;
char oldfile[PATH_MAX] = { '\0' };
bool retval = false;

View File

@@ -114,7 +114,13 @@ get_deptype(const RC_DEPINFO *depinfo, const char *type)
}
RC_DEPTREE *
rc_deptree_load(void)
rc_deptree_load(void) {
return rc_deptree_load_file(RC_DEPTREE_CACHE);
}
librc_hidden_def(rc_deptree_load)
RC_DEPTREE *
rc_deptree_load_file(const char *deptree_file)
{
FILE *fp;
RC_DEPTREE *deptree;
@@ -127,7 +133,7 @@ rc_deptree_load(void)
char *e;
int i;
if (!(fp = fopen(RC_DEPTREE_CACHE, "r")))
if (!(fp = fopen(deptree_file, "r")))
return NULL;
deptree = xmalloc(sizeof(*deptree));
@@ -172,16 +178,16 @@ rc_deptree_load(void)
}
fclose(fp);
free(line);
return deptree;
}
librc_hidden_def(rc_deptree_load)
librc_hidden_def(rc_deptree_load_file)
static bool
valid_service(const char *runlevel, const char *service, const char *type)
{
RC_SERVICE state;
if (!runlevel ||
strcmp(type, "ineed") == 0 ||
strcmp(type, "needsme") == 0)
@@ -393,7 +399,7 @@ visit_service(const RC_DEPTREE *deptree,
if (!(di = get_depinfo(deptree, service->value)))
continue;
provided = get_provided(di, runlevel, options);
if (TAILQ_FIRST(provided)) {
TAILQ_FOREACH(p, provided, entries) {
di = get_depinfo(deptree, p->value);
@@ -767,14 +773,14 @@ rc_deptree_update(void)
if (!depinfo || strcmp(depinfo->service, service) != 0) {
deptype = NULL;
depinfo = get_depinfo(deptree, service);
if (!depinfo) {
if (!depinfo) {
depinfo = xmalloc(sizeof(*depinfo));
TAILQ_INIT(&depinfo->depends);
depinfo->service = xstrdup(service);
TAILQ_INSERT_TAIL(deptree, depinfo, entries);
}
}
/* We may not have any depends */
if (!type || !depends)
continue;
@@ -815,7 +821,7 @@ rc_deptree_update(void)
depend[l - 2] == 's' &&
depend[l - 1] == 'h')
continue;
/* Remove our dependency if instructed */
if (depend[0] == '!') {
rc_stringlist_delete(deptype->services, depend + 1);

View File

@@ -61,7 +61,7 @@ rc_getline(char **line, size_t *len, FILE *fp)
char *p;
size_t last = 0;
while(!feof(fp)) {
while (!feof(fp)) {
if (*line == NULL || last != 0) {
*len += BUFSIZ;
*line = xrealloc(*line, *len);
@@ -218,3 +218,52 @@ rc_config_value(RC_STRINGLIST *list, const char *entry)
return NULL;
}
librc_hidden_def(rc_config_value)
/* Global for caching the strings loaded from rc.conf to avoid reparsing for
* each rc_conf_value call */
static RC_STRINGLIST *rc_conf = NULL;
char *
rc_conf_value(const char *setting)
{
RC_STRINGLIST *old;
RC_STRING *s;
char *p;
if (! rc_conf) {
rc_conf = rc_config_load(RC_CONF);
#ifdef DEBUG_MEMORY
atexit(_free_rc_conf);
#endif
/* Support old configs */
if (exists(RC_CONF_OLD)) {
old = rc_config_load(RC_CONF_OLD);
TAILQ_CONCAT(rc_conf, old, entries);
#ifdef DEBUG_MEMORY
free(old);
#endif
}
/* Convert old uppercase to lowercase */
TAILQ_FOREACH(s, rc_conf, entries) {
p = s->value;
while (p && *p && *p != '=') {
if (isupper((unsigned char)*p))
*p = tolower((unsigned char)*p);
p++;
}
}
}
return rc_config_value(rc_conf, setting);
}
librc_hidden_def(rc_conf_value)
#ifdef DEBUG_MEMORY
static void
_free_rc_conf(void)
{
rc_stringlist_free(rc_conf);
}
#endif

View File

@@ -146,7 +146,7 @@ librc_hidden_def(rc_stringlist_sort)
void
rc_stringlist_free(RC_STRINGLIST *list)
{
RC_STRING *s1;
RC_STRING *s1;
RC_STRING *s2;
if (!list)

View File

@@ -72,7 +72,7 @@ ls_dir(const char *dir, int options)
{
DIR *dp;
struct dirent *d;
RC_STRINGLIST *list = NULL;
RC_STRINGLIST *list = NULL;
struct stat buf;
size_t l;
char file[PATH_MAX];
@@ -198,12 +198,58 @@ file_regex(const char *file, const char *regex)
}
#endif
/* New sys identification code
* Not to be used for any binaries outside of openrc. */
const char *
rc_sys(void)
rc_sys_v2(void)
{
#define __STRING_SWITCH(x) { char *__string_switch = x; if (false) {}
#define __STRING_CASE(y) else if (strcmp(__string_switch,y) == 0)
#define __STRING_SWITCH_END() }
char *systype = rc_conf_value("rc_sys");
if (systype) {
char *s = systype;
/* Convert to uppercase */
while (s && *s) {
if (islower((unsigned char) *s))
*s = toupper((unsigned char) *s);
s++;
}
/* Now do detection */
__STRING_SWITCH(systype)
__STRING_CASE(RC_SYS_PREFIX) { return RC_SYS_PREFIX; }
#ifdef __FreeBSD__
__STRING_CASE(RC_SYS_JAIL) { return RC_SYS_JAIL; }
#endif /* __FreeBSD__ */
#ifdef __NetBSD__
__STRING_CASE(RC_SYS_XEN0) { return RC_SYS_XEN0; }
__STRING_CASE(RC_SYS_XENU) { return RC_SYS_XENU; }
#endif /* __NetBSD__ */
#ifdef __linux__
__STRING_CASE(RC_SYS_XEN0) { return RC_SYS_XEN0; }
__STRING_CASE(RC_SYS_XENU) { return RC_SYS_XENU; }
__STRING_CASE(RC_SYS_UML) { return RC_SYS_UML; }
__STRING_CASE(RC_SYS_VSERVER) { return RC_SYS_VSERVER; }
__STRING_CASE(RC_SYS_OPENVZ) { return RC_SYS_OPENVZ; }
__STRING_CASE(RC_SYS_LXC) { return RC_SYS_LXC; }
#endif /* __linux__ */
__STRING_SWITCH_END()
}
#undef __STRING_SWITCH
#undef __STRING_CASE
#undef __STRING_SWITCH_END
return NULL;
}
librc_hidden_def(rc_sys_v2)
/* Old sys identification code.
* Not to be used for any binaries outside of openrc. */
const char *
rc_sys_v1(void)
{
#ifdef PREFIX
return RC_SYS_PREFIX;
#else
#else
#ifdef __FreeBSD__
int jailed = 0;
@@ -233,8 +279,6 @@ rc_sys(void)
return RC_SYS_VSERVER;
else if (exists("/proc/vz/veinfo") && !exists("/proc/vz/version"))
return RC_SYS_OPENVZ;
else if (file_regex("/proc/self/cgroup", ":/.+$"))
return RC_SYS_LXC;
else if (file_regex("/proc/self/status",
"envID:[[:space:]]*[1-9]"))
return RC_SYS_OPENVZ; /* old test */
@@ -243,6 +287,17 @@ rc_sys(void)
return NULL;
#endif /* PREFIX */
}
librc_hidden_def(rc_sys_v1)
const char *
rc_sys(void)
{
if (rc_conf_value("rc_sys")) {
return rc_sys_v2();
} else {
return rc_sys_v1();
}
}
librc_hidden_def(rc_sys)
static const char *
@@ -336,7 +391,7 @@ bool
rc_runlevel_stack(const char *dst, const char *src)
{
char d[PATH_MAX], s[PATH_MAX];
if (!rc_runlevel_exists(dst) || !rc_runlevel_exists(src))
return false;
snprintf(s, sizeof(s), "../%s", src);
@@ -349,7 +404,7 @@ bool
rc_runlevel_unstack(const char *dst, const char *src)
{
char path[PATH_MAX];
snprintf(path, sizeof(path), "%s/%s/%s", RC_RUNLEVELDIR, dst, src);
return (unlink(path) == 0 ? true : false);
}
@@ -377,7 +432,7 @@ rc_runlevel_stacks(const char *runlevel)
}
librc_hidden_def(rc_runlevel_stacks)
/* Resolve a service name to it's full path */
/* Resolve a service name to its full path */
char *
rc_service_resolve(const char *service)
{
@@ -585,7 +640,7 @@ rc_service_mark(const char *service, const RC_SERVICE state)
}
skip_state = state;
}
if (state == RC_SERVICE_HOTPLUGGED || state == RC_SERVICE_FAILED) {
free(init);
return true;
@@ -733,7 +788,7 @@ rc_service_value_set(const char *service, const char *option,
{
FILE *fp;
char file[PATH_MAX];
char *p = file;
char *p = file;
p += snprintf(file, sizeof(file), RC_SVCDIR "/options/%s", service);
if (mkdir(file, 0755) != 0 && errno != EEXIST)

View File

@@ -72,6 +72,7 @@
#define librc_hidden_proto(x) hidden_proto(x)
#define librc_hidden_def(x) hidden_def(x)
librc_hidden_proto(rc_conf_value)
librc_hidden_proto(rc_config_list)
librc_hidden_proto(rc_config_load)
librc_hidden_proto(rc_config_value)
@@ -79,6 +80,7 @@ librc_hidden_proto(rc_deptree_depend)
librc_hidden_proto(rc_deptree_depends)
librc_hidden_proto(rc_deptree_free)
librc_hidden_proto(rc_deptree_load)
librc_hidden_proto(rc_deptree_load_file)
librc_hidden_proto(rc_deptree_order)
librc_hidden_proto(rc_deptree_update)
librc_hidden_proto(rc_deptree_update_needed)
@@ -125,6 +127,8 @@ librc_hidden_proto(rc_stringlist_new)
librc_hidden_proto(rc_stringlist_split)
librc_hidden_proto(rc_stringlist_sort)
librc_hidden_proto(rc_sys)
librc_hidden_proto(rc_sys_v1)
librc_hidden_proto(rc_sys_v2)
librc_hidden_proto(rc_yesno)
#endif

View File

@@ -43,6 +43,14 @@ __BEGIN_DECLS
#define RC_CONFDIR RC_SYSCONFDIR "/conf.d"
#define RC_PLUGINDIR RC_LIBDIR "/plugins"
#define RC_PROFILE_ENV RC_SYSCONFDIR "/profile.env"
#define RC_SYS_WHITELIST RC_LIBEXECDIR "/conf.d/env_whitelist"
#define RC_USR_WHITELIST RC_SYSCONFDIR "/conf.d/env_whitelist"
#define RC_CONF RC_SYSCONFDIR "/rc.conf"
#define RC_CONF_OLD RC_SYSCONFDIR "/conf.d/rc"
#define RC_PATH_PREFIX RC_LIBEXECDIR "/bin:/bin:/sbin:/usr/bin:/usr/sbin"
/* PKG_PREFIX is where packages are installed if different from the base OS
* On Gentoo this is normally unset, on FreeBSD /usr/local and on NetBSD
* /usr/pkg. */
@@ -117,7 +125,7 @@ bool rc_runlevel_stopping(void);
/*! @name RC
* A service can be given as a full path or just its name.
* If its just a name then we try to resolve the service to a full path.
* If it's just a name then we try to resolve the service to a full path.
* This should allow the use if local init.d directories in the future. */
/*! @brief States a service can be in */
@@ -274,8 +282,19 @@ bool rc_service_daemons_crashed(const char *);
#define RC_SYS_VSERVER "VSERVER"
#define RC_SYS_XEN0 "XEN0"
#define RC_SYS_XENU "XENU"
/*! Returns the type of subsystem
* @return string from RC_SYS_* types or NULL if none detected */
const char *rc_sys(void);
/*! Returns the type of subsystem using old automatic code
* @return string from RC_SYS_* types or NULL if none detected */
const char *rc_sys_v1(void);
/*! Returns the type of subsystem using new rc.conf rc_sys value
* @return string from RC_SYS_* types or NULL if none detected */
const char *rc_sys_v2(void);
/*! @name Dependency options
* These options can change the services found by the rc_get_depinfo and
* rc_get_depends functions. */
@@ -326,21 +345,21 @@ typedef void *RC_DEPTREE;
#endif
/*! Check to see if source is newer than target.
* If target is a directory then we traverse it and it's children.
* If target is a directory then we traverse it and its children.
* @param source
* @param target
* @param mtime of newest target
* @param filename of the newest target (needs mtime param)
* @return true if source is newer than target, otherwise false */
* @return true if source is newer than target, otherwise false */
bool rc_newer_than(const char *, const char *, time_t *, char *);
/*! Check to see if source is older than target.
* If target is a directory then we traverse it and it's children.
* If target is a directory then we traverse it and its children.
* @param source
* @param target
* @param mtime of oldest target
* @param filename of the oldest target (needs mtime param)
* @return true if source is older than target, otherwise false */
* @return true if source is older than target, otherwise false */
bool rc_older_than(const char *, const char *, time_t *, char *);
/*! Update the cached dependency tree if it's older than any init script,
@@ -364,6 +383,11 @@ bool rc_deptree_update_needed(time_t *, char *);
* @return pointer to the dependency tree */
RC_DEPTREE *rc_deptree_load(void);
/*! Load a cached dependency tree from the specified file and return a pointer
* to it. This pointer should be freed with rc_deptree_free when done.
* @return pointer to the dependency tree */
RC_DEPTREE *rc_deptree_load_file(const char *);
/*! List the depend for the type of service
* @param deptree to search
* @param type to use (keywords, etc)
@@ -446,7 +470,10 @@ RC_STRINGLIST *rc_config_load(const char *);
/*! Return the value of the entry from a key=value list. */
char *rc_config_value(RC_STRINGLIST *, const char *);
/*! Check if a variable is a boolean and return it's value.
/*! Return the value of the entry from rc.conf. */
char *rc_conf_value(const char *);
/*! Check if a variable is a boolean and return its value.
* If variable is not a boolean then we set errno to be ENOENT when it does
* not exist or EINVAL if it's not a boolean.
* @param variable to check
@@ -485,14 +512,14 @@ bool rc_stringlist_delete(RC_STRINGLIST *, const char *);
* @return pointer to item */
RC_STRING *rc_stringlist_find(RC_STRINGLIST *, const char *);
/*! Split a string into a stringlist based on seperator.
/*! Split a string into a stringlist based on separator.
* @param string to split
* @param seperator
* @param separator
* @return new list */
RC_STRINGLIST *rc_stringlist_split(const char *, const char *);
/*! Sort the list according to C locale
/*! Sort the list according to C locale
* @param list to sort */
void rc_stringlist_sort(RC_STRINGLIST **);

View File

@@ -1,5 +1,6 @@
RC_1.0 {
global:
rc_conf_value;
rc_config_list;
rc_config_load;
rc_config_value;
@@ -7,6 +8,7 @@ global:
rc_deptree_depends;
rc_deptree_free;
rc_deptree_load;
rc_deptree_load_file;
rc_deptree_order;
rc_deptree_update;
rc_deptree_update_needed;
@@ -55,6 +57,8 @@ global:
rc_stringlist_sort;
rc_stringlist_free;
rc_sys;
rc_sys_v1;
rc_sys_v2;
rc_yesno;
local:

View File

@@ -38,7 +38,7 @@
#include <string.h>
#include <unistd.h>
/* Yay for linux and it's non liking of POSIX functions.
/* Yay for linux and its non liking of POSIX functions.
Okay, we could use getfsent but the man page says use getmntent instead
AND we don't have getfsent on uclibc or dietlibc for some odd reason. */
#ifdef __linux__
@@ -109,7 +109,7 @@ do_mount(struct ENT *ent)
argv[6] = ENT_FILE(*ent);
argv[7] = NULL;
switch (pid = vfork()) {
case -1:
case -1:
eerrorx("%s: vfork: %s", applet, strerror(errno));
/* NOTREACHED */
case 0:

View File

@@ -152,7 +152,7 @@ do_e(int argc, char **argv)
ts.tv_nsec = WAIT_INTERVAL;
for (i = 0; i < argc; i++) {
ebeginv("Waiting for %s", argv[i]);
for (;;){
for (;;) {
if (exists(argv[i]))
break;
if (nanosleep(&ts, NULL) == -1)
@@ -298,7 +298,7 @@ do_service(int argc, char **argv)
}
}
ok = rc_service_started_daemon(service, exec, NULL, idx);
} else if (strcmp(applet, "service_crashed") == 0) {
ok = (_rc_can_find_pids() &&
rc_service_daemons_crashed(service) &&
@@ -467,7 +467,7 @@ run_applets(int argc, char **argv)
}
exit(EXIT_FAILURE);
};
/* This tets is correct as it's not present in baselayout */
/* This test is correct as it's not present in baselayout */
if (strcmp(applet, "is_newer_than") == 0) {
if (argc < 3)
exit (EXIT_FAILURE);
@@ -476,7 +476,7 @@ run_applets(int argc, char **argv)
exit(EXIT_FAILURE);
}
exit(EXIT_SUCCESS);
};
};
if (applet[0] == 'e' || (applet[0] == 'v' && applet[1] == 'e'))
exit(do_e(argc, argv));

View File

@@ -106,7 +106,7 @@ _rc_deptree_load(int force, int *regen) {
}
#include "_usage.h"
#define getoptstring "aot:suT" getoptstring_COMMON
#define getoptstring "aot:suTF:" getoptstring_COMMON
static const struct option longopts[] = {
{ "starting", 0, NULL, 'a'},
{ "stopping", 0, NULL, 'o'},
@@ -114,6 +114,7 @@ static const struct option longopts[] = {
{ "notrace", 0, NULL, 'T'},
{ "strict", 0, NULL, 's'},
{ "update", 0, NULL, 'u'},
{ "deptree-file", 1, NULL, 'F'},
longopts_COMMON
};
static const char * const longopts_help[] = {
@@ -123,6 +124,7 @@ static const char * const longopts_help[] = {
"Don't trace service dependencies",
"Only use what is in the runlevels",
"Force an update of the dependency tree",
"File to load cached deptree from",
longopts_help_COMMON
};
#include "_usage.c"
@@ -141,6 +143,7 @@ rc_depend(int argc, char **argv)
char *runlevel = xstrdup(getenv("RC_RUNLEVEL"));
int opt;
char *token;
char *deptree_file = NULL;
types = rc_stringlist_new();
while ((opt = getopt_long(argc, argv, getoptstring,
@@ -166,13 +169,21 @@ rc_depend(int argc, char **argv)
case 'T':
options &= RC_DEP_TRACE;
break;
case 'F':
deptree_file = xstrdup(optarg);
break;
case_RC_COMMON_GETOPT
case_RC_COMMON_GETOPT
}
}
if (!(deptree = _rc_deptree_load(update, NULL)))
eerrorx("failed to load deptree");
if (deptree_file) {
if (!(deptree = rc_deptree_load_file(deptree_file)))
eerrorx("failed to load deptree");
} else {
if (!(deptree = _rc_deptree_load(update, NULL)))
eerrorx("failed to load deptree");
}
if (!runlevel)
runlevel = rc_runlevel_get();

View File

@@ -172,7 +172,7 @@ rc_logger_open(const char *level)
ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws);
if (openpty(&rc_logger_tty, &slave_tty, NULL, &tt, &ws))
return;
} else
} else
if (openpty(&rc_logger_tty, &slave_tty, NULL, NULL, NULL))
return;

View File

@@ -52,61 +52,7 @@
#include "rc-misc.h"
#include "version.h"
#define PROFILE_ENV RC_SYSCONFDIR "/profile.env"
#define SYS_WHITELIST RC_LIBEXECDIR "/conf.d/env_whitelist"
#define USR_WHITELIST RC_SYSCONFDIR "/conf.d/env_whitelist"
#define RC_CONF RC_SYSCONFDIR "/rc.conf"
#define RC_CONF_OLD RC_SYSCONFDIR "/conf.d/rc"
#define PATH_PREFIX RC_LIBEXECDIR "/bin:/bin:/sbin:/usr/bin:/usr/sbin"
static RC_STRINGLIST *rc_conf = NULL;
extern char** environ;
#ifdef DEBUG_MEMORY
static void
_free_rc_conf(void)
{
rc_stringlist_free(rc_conf);
}
#endif
char *
rc_conf_value(const char *setting)
{
RC_STRINGLIST *old;
RC_STRING *s;
char *p;
if (! rc_conf) {
rc_conf = rc_config_load(RC_CONF);
#ifdef DEBUG_MEMORY
atexit(_free_rc_conf);
#endif
/* Support old configs */
if (exists(RC_CONF_OLD)) {
old = rc_config_load(RC_CONF_OLD);
TAILQ_CONCAT(rc_conf, old, entries);
#ifdef DEBUG_MEMORY
free(old);
#endif
}
/* Convert old uppercase to lowercase */
TAILQ_FOREACH(s, rc_conf, entries) {
p = s->value;
while (p && *p && *p != '=') {
if (isupper((unsigned char)*p))
*p = tolower((unsigned char)*p);
p++;
}
}
}
return rc_config_value(rc_conf, setting);
}
extern char **environ;
bool
rc_conf_yesno(const char *setting)
@@ -135,7 +81,7 @@ env_filter(void)
/* Add the user defined list of vars */
env_allow = rc_stringlist_split(rc_conf_value("rc_env_allow"), " ");
profile = rc_config_load(PROFILE_ENV);
profile = rc_config_load(RC_PROFILE_ENV);
/* Copy the env and work from this so we can manipulate it safely */
env_list = rc_stringlist_new();
@@ -181,7 +127,7 @@ env_filter(void)
void
env_config(void)
{
size_t pplen = strlen(PATH_PREFIX);
size_t pplen = strlen(RC_PATH_PREFIX);
char *path;
char *p;
char *e;
@@ -199,16 +145,16 @@ env_config(void)
for a little extra security */
path = getenv("PATH");
if (! path)
setenv("PATH", PATH_PREFIX, 1);
else if (strncmp (PATH_PREFIX, path, pplen) != 0) {
setenv("PATH", RC_PATH_PREFIX, 1);
else if (strncmp (RC_PATH_PREFIX, path, pplen) != 0) {
l = strlen(path) + pplen + 3;
e = p = xmalloc(sizeof(char) * l);
p += snprintf(p, l, "%s", PATH_PREFIX);
p += snprintf(p, l, "%s", RC_PATH_PREFIX);
/* Now go through the env var and only add bits not in our
* PREFIX */
while ((token = strsep(&path, ":"))) {
np = npp = xstrdup(PATH_PREFIX);
np = npp = xstrdup(RC_PATH_PREFIX);
while ((tok = strsep(&npp, ":")))
if (strcmp(tok, token) == 0)
break;
@@ -316,7 +262,7 @@ exec_service(const char *service, const char *arg)
fd = svc_lock(basename_c(service));
if (fd == -1)
return -1;
file = rc_service_resolve(service);
if (!exists(file)) {
rc_service_mark(service, RC_SERVICE_STOPPED);

View File

@@ -105,7 +105,7 @@ rc_plugin_load(void)
continue;
}
fptr = (int (*)(RC_HOOK, const char*))
fptr = (int (*)(RC_HOOK, const char *))
dlfunc(h, RC_PLUGIN_HOOK);
if (fptr == NULL) {
eerror("%s: cannot find symbol `%s'",
@@ -200,7 +200,7 @@ rc_plugin_run(RC_HOOK hook, const char *value)
sigaction(SIGUSR1, &sa, NULL);
sigaction(SIGWINCH, &sa, NULL);
sigprocmask(SIG_SETMASK, &old, NULL);
rc_in_plugin = true;
close(pfd[0]);
rc_environ_fd = fdopen(pfd[1], "w");

View File

@@ -219,6 +219,7 @@ static const char * const longopts_help[] = {
int
rc_update(int argc, char **argv)
{
RC_DEPTREE *deptree;
RC_STRINGLIST *runlevels;
RC_STRING *runlevel;
char *service = NULL;
@@ -238,7 +239,9 @@ rc_update(int argc, char **argv)
stack = true;
break;
case 'u':
_rc_deptree_load(-1, &ret);
deptree = _rc_deptree_load(-1, &ret);
if (deptree)
rc_deptree_free(deptree);
return ret;
case_RC_COMMON_GETOPT;
}

Some files were not shown because too many files have changed in this diff Show More