Commit Graph

329 Commits

Author SHA1 Message Date
Roy Marples dbea63b76d Fix logic for templates. 2008-04-21 21:34:52 +00:00
Roy Marples 6a5287dbb5 Typo 2008-04-21 19:26:56 +00:00
Roy Marples df8eeba2fb Punt is_function in favour of POSIX shell builtin command, thanks to Harald van Dijk for the idea. 2008-04-21 17:32:17 +00:00
Roy Marples e96347523f We should check type output to ensure that we're really calling a shell function and not some badly named binary like stop from boinc, Gentoo #218063. 2008-04-18 23:00:43 +00:00
Roy Marples 809ac86c69 We should only check dependencies in files. 2008-04-16 15:01:52 +00:00
Roy Marples 034b9b7a12 Add a silly rc_runlevel function to appease SpanKY :) 2008-04-08 16:01:40 +00:00
Roy Marples 594d98eddc Tests now work on NetBSD. 2008-04-07 09:37:14 +00:00
Roy Marples dcdfdb442f Some systems are only detectable after /proc is mounted, so re-test if unknown. 2008-04-06 20:06:07 +00:00
Roy Marples 742310744d We would sanitize $RC_LIBDIR/sbin as well. If it's really needed then rc-functions.sh will add it back. 2008-03-27 18:34:12 +00:00
Roy Marples 4e9b58b07d Sanitize the write rc dir. 2008-03-27 17:09:18 +00:00
Roy Marples c564043f86 No need for the extra rc. 2008-03-27 16:59:33 +00:00
Roy Marples b3d1182a2f Fix mulitlib issues. 2008-03-27 16:53:22 +00:00
Roy Marples 864e17fabc Ignore more files. 2008-03-26 17:34:23 +00:00
Roy Marples ac834ddc56 Fix linux compile. 2008-03-26 14:39:13 +00:00
Roy Marples 833903fc78 use $CP and $SED instead of cp and sed 2008-03-26 14:27:46 +00:00
Roy Marples 55858eca2e .sh.BSD.in is a better extension. 2008-03-26 14:02:59 +00:00
Roy Marples 6af2b20297 Split sysctl into Linux and BSD specific files. 2008-03-26 09:36:34 +00:00
Roy Marples 5866d829bb Try and fix more prefix stuff. 2008-03-25 18:33:45 +00:00
Roy Marples c807b3a815 INITDIR should already be prefixed. 2008-03-25 17:19:41 +00:00
Roy Marples 4d6b84290a These now need to be prefixed. 2008-03-25 17:17:15 +00:00
Roy Marples 08791ec4a2 INITDIR should already be prefixed. 2008-03-25 17:11:44 +00:00
Roy Marples 55eb3794fb Rework our folder structure so that we don't have OS specific dirs, making it easier to share init and conf files per OS. 2008-03-25 14:06:05 +00:00
Mike Frysinger 486d517674 setup a bit of a test framework 2008-03-24 07:17:05 +00:00
Mike Frysinger 02e7e1b988 dont leak the _e var 2008-03-24 05:54:18 +00:00
Roy Marples 4079b4d65d Clean up error display. 2008-03-21 11:20:03 +00:00
Roy Marples eca292e5d9 Some OS's block on umount -f, so don't use it. 2008-03-21 11:02:02 +00:00
Roy Marples e47661449a More pathing fixes. 2008-03-21 00:30:22 +00:00
Roy Marples 04b0acb010 Fix pathing again. 2008-03-20 19:57:31 +00:00
Roy Marples 6159a32f39 SVCNAME -> RC_SVCNAME, but export SVCNAME still for compat. 2008-03-19 19:57:24 +00:00
Roy Marples 6d2e1f7add Fix building on Linux. 2008-03-19 19:43:08 +00:00
Roy Marples d9ec62b22a Add rc-service and update all softlevel refs to runlevel. 2008-03-19 17:11:50 +00:00
Roy Marples 0e6eb0f764 Ensure that our path includes packages and local 2008-03-19 15:21:42 +00:00
Roy Marples 40e12f6ba0 RC_SERVICE now points to the service file, so daemons can recall us directly. 2008-03-11 15:00:16 +00:00
Roy Marples f20099bc33 Fix the old RC_USE names. 2008-03-10 11:33:39 +00:00
Roy Marples c4a54605e0 Support baselayout-2 uppercase RC_NEED vars, #38. 2008-03-08 15:22:29 +00:00
Roy Marples a689b66023 Add tunable SYSCONFDIR 2008-03-05 12:27:11 +00:00
Roy Marples ff162b39ac Don't rely on fuser being present 2008-03-04 22:03:41 +00:00
Roy Marples 15cf41e713 Split VPS into VSERVER and OPENVZ 2008-03-03 17:19:56 +00:00
Roy Marples 7a8e9d4ddb Add a gitignore make target. 2008-03-03 13:04:08 +00:00
Roy Marples 61c476e72d Use exlicit make targets, not directory contents. 2008-03-03 12:34:51 +00:00
Roy Marples 0aedc02860 Introduce LOCAL_PREFIX for a user maintained script location. 2008-03-03 10:33:42 +00:00
Roy Marples dca4034bd5 Fix prefixed net.sh 2008-03-03 08:47:37 +00:00
Roy Marples 67c5fd6bb8 Ensure that our scripts call prefixed runscript. 2008-03-02 21:14:01 +00:00
Roy Marples a135d0d93b Fix installing into PREFIX. 2008-03-01 22:12:33 +00:00
Roy Marples 0a0961f3f4 ignore more stuff 2008-02-28 21:49:52 +00:00
Roy Marples 988289d98d Typo 2008-02-28 21:04:28 +00:00
Roy Marples f092045650 Support the use of PREFIX and PKG_PREFIX. 2008-02-28 11:08:49 +00:00
Roy Marples c2648ca5f5 Makefile SH variable now tweaks the default shell used by our scripts. 2008-02-27 20:29:32 +00:00
Roy Marples e1e36b2872 keywords -> keyword 2008-02-19 14:36:22 +00:00
Roy Marples 0364bb2c84 Add the nojail keyword which excludes services marked as such from the dependency tree when in a jail, #bug 22 2008-02-19 14:15:53 +00:00
Roy Marples 5e470afb52 Ignore resolvconf error messages if the interface does not exist. 2008-02-11 20:04:15 +00:00
Roy Marples 9300fa240d Tidy up some code and remove the redundant single_user function as we now use exit codes. 2008-01-31 09:48:58 +00:00
Roy Marples 0c75e888fc Allow rc_need to work with net scripts, and allow for loopback also. 2008-01-30 13:20:47 +00:00
Roy Marples c1d18354c6 Fix unmounting shared and bind mounts, Gentoo bug #207611. 2008-01-30 11:58:21 +00:00
Roy Marples 4f6e778758 Only allow .sh files to be used as net modules. 2008-01-29 15:41:10 +00:00
Roy Marples 3e5743426b Fix restart --nodeps again. 2008-01-26 16:46:53 +00:00
Roy Marples 8793fb8d4c No need to specify SVCNAME anymore. 2008-01-23 12:17:50 +00:00
Roy Marples a16428da20 We need to shift here. 2008-01-22 20:48:24 +00:00
Roy Marples 5338b568ca Allow stop start to work when stop is not defined. 2008-01-22 19:39:03 +00:00
Roy Marples 18da799040 Allow things after the /32 for host routes. 2008-01-15 12:13:42 +00:00
Roy Marples 6e1251b925 Ignore functions.sh and rc-functions.sh as these are now created by make. 2008-01-14 14:03:46 +00:00
Roy Marples b054a7251b INSTALLAFTER needs to be defined before we include our mk's to work. 2008-01-13 17:49:29 +00:00
Roy Marples f755187020 Change lib name during make, not install. 2008-01-13 13:55:23 +00:00
Roy Marples 8ef2bf78f7 Don't print an extra eend on failure. 2008-01-11 17:41:19 +00:00
Roy Marples fec312d448 Update copyrights, my email and license. 2008-01-11 15:31:10 +00:00
Roy Marples 3bf49a9bd1 Adopt a more C style for scripts and remove vim settings. 2008-01-11 12:13:46 +00:00
Roy Marples 1f4422c72f Remove full license text from shell cripts. 2008-01-11 11:45:59 +00:00
Roy Marples 50d73fa223 Add /usr/pkg to the PATH for NetBSD packages. 2008-01-10 23:51:58 +00:00
Roy Marples acbaacb2c1 dhcpcd could be anywhere, so allow this. 2008-01-10 23:23:39 +00:00
Roy Marples 6244bcbe84 massage netmask to cidr for buggy shells. 2008-01-10 18:11:02 +00:00
Roy Marples 6ca21b4c6a More make fixes 2008-01-10 16:57:05 +00:00
Roy Marples 4314784520 Allow for OS and SUBOS folders so we can introduce NetBSD scripts whilst keeping BSD for all BSD's. 2008-01-10 16:35:59 +00:00
Roy Marples da4217fec8 Add net config's to have their own depend function per interface. 2008-01-06 13:06:56 +00:00
Roy Marples ddb3ab4704 Use LIBNAME for multilib so as not to conflict with LIB 2008-01-05 21:05:19 +00:00
Roy Marples cc96c0933d Juggle the Makefiles so that sh knows about NET_LO 2008-01-03 15:48:33 +00:00
Roy Marples 19765f289c Move the linking of files in /etc/init.d into the sh/Makefile so that install -jN works. 2008-01-03 14:49:34 +00:00
Roy Marples 28d7a19201 Allow rc_$service_$deptype in rc.conf 2008-01-02 15:42:52 +00:00
Roy Marples fadee8e656 Move _shell_var shell function to shell_var C applet 2008-01-02 15:38:37 +00:00
Roy Marples a273f8df55 Fix the adding of default routes 2007-12-31 09:28:53 +00:00
Roy Marples b6aa56ce14 Fix metric_$IFVAR 2007-12-31 09:28:34 +00:00
Roy Marples b6fcfd1157 We should export SVCNAME so service_* functions work in depend 2007-12-30 16:59:56 +00:00
Roy Marples cbea91cae5 Remove rc-help.sh and replace with a man page for runscript 8. 2007-12-20 17:39:13 +00:00
Roy Marples e4b73c506b Describe extra_started_commands also. 2007-12-17 14:29:19 +00:00
Roy Marples a010d0bb69 Remove the try and check_statedir functions 2007-12-14 14:19:03 +00:00
Roy Marples 9f2403dffa Remove Gentoo copyright from all files that I know I have written 2007-12-14 14:12:38 +00:00
Roy Marples a3db3bac62 Allow services to be in /usr/local/etc/init.d, but disallow them being added to the boot runlevel. 2007-12-14 12:24:16 +00:00
Roy Marples f8db842dd2 Default to correct init dir and preserve depconfig 2007-12-14 12:17:57 +00:00
Roy Marples 5541d3e385 We should only do colours if fd1 is a terminal by default 2007-12-14 12:16:05 +00:00
Roy Marples a178d53202 Move RC_ to EINFO_ for all env vars related to einfo. 2007-12-06 10:48:00 +00:00
Roy Marples 0490a9290a Remove rc_service_wait as runscript.c should do the waiting. rc_deptree_depend now returns the exact depends as listed. This is so we can support a new 'keywords' directive. We can add whatever here, like 'notimeout' which means that an init script doesn't timeout. This removes the hardcoded check on checkfs and checkroot. 2007-12-05 17:48:07 +00:00
Roy Marples 07e3d69c52 Our default start command should correctly recover on failed re-entrant services 2007-12-04 16:15:32 +00:00
Roy Marples ba3248e6d2 Preserve IFS correctly 2007-12-04 14:18:41 +00:00
Roy Marples bf8d8a9be7 rc-help.sh should use standard ecolours vs its internal ideas 2007-12-03 16:16:48 +00:00
Roy Marples 7683c5056a fix last stupid error 2007-11-30 09:59:10 +00:00
Roy Marples a6d8b76876 Ensure that lo0 gets 127.0.0.1/8 with a space separated config 2007-11-30 09:38:01 +00:00
Roy Marples 16ad975b2d Allow services to define which extra commands require the service to be started 2007-11-29 16:23:59 +00:00
Roy Marples 82df7e4584 Use shorthand for loops 2007-11-29 11:23:06 +00:00
Roy Marples 50161bef0e Allow space separated configs to work for CIDR address styles 2007-11-29 11:17:50 +00:00
Roy Marples f0aa06b586 Fix whitespace in configs 2007-11-29 09:45:57 +00:00
Roy Marples ac9279cc0d Massive whitespace cleanup 2007-11-28 15:45:03 +00:00
Roy Marples 444f23e2d1 resolvconf may not be in /sbin 2007-11-28 14:32:24 +00:00
Roy Marples d651155b61 Sanitize our PATH a bit better, and terminate it correctly in start-stop-daemon. 2007-11-28 13:40:15 +00:00
Roy Marples 8ea741d699 Support required_dirs and required_files. Allow services to mark inactive if using templates and fake commands if in background. 2007-11-28 13:08:25 +00:00
Roy Marples 8a328b7408 Allow whitespace in routing commands, Gentoo bug #200458. 2007-11-28 10:04:15 +00:00
Roy Marples 49edf58fc1 Don't rely on sed being available when calculating deps 2007-11-26 09:56:22 +00:00
Roy Marples 6bc37fd203 this is still an env var 2007-11-23 22:22:18 +00:00
Roy Marples d7ea2987d6 grep isn't always in /bin 2007-11-23 13:52:15 +00:00
Roy Marples d81def80b0 Move /etc/conf.d/rc to /etc/rc.conf.
Lowercase all configurable variables, non configurations remain uppercase.
Replace rc_env_bool with rc_yesno.
Split localmount info procfs (Linux) and dumpon, savecore (BSD)
2007-11-23 12:04:11 +00:00
Roy Marples a1b9dabf4e Use yesno for more robustness 2007-11-22 13:37:24 +00:00
Roy Marples 09c5e5d415 Use yesno for more robustness 2007-11-22 13:28:14 +00:00
Roy Marples ee61f46309 Use yesno 2007-11-22 12:20:40 +00:00
Roy Marples 4b28587704 Add a yesno function to check the boolean value of a variable 2007-11-22 12:18:24 +00:00
Roy Marples b321c6891e The BSD's don't need to umount cleanly when shuttind down, as they have a special kernel service to handle this. As sch, don't error if we don't have fuser 2007-11-21 15:41:45 +00:00
Roy Marples 95f8344874 We should include local paths 2007-11-21 15:40:42 +00:00
Roy Marples a76f2c20e4 opts -> extra_commands. This is much more descriptive. 2007-11-20 18:19:48 +00:00
Roy Marples 42b057edbe Add a rarpd init script and allow templates to add start-stop-daemon arguments 2007-11-20 17:10:35 +00:00
Roy Marples ed0074cb44 start -> stop 2007-11-20 10:32:47 +00:00
Roy Marples df523ccfee runscript.sh now provides default start/stop functions if command and pidfile variables are set. We also run $cmd_pre and $cmd_post commands and return accordingly. 2007-11-20 10:24:40 +00:00
Roy Marples 88ccccc22a Move runlevel and lib logic to the sub Makefiles 2007-11-19 16:42:28 +00:00
Roy Marples 5f8cf73b22 Our build chain now works with GNU and BSD make implementations 2007-11-19 13:48:43 +00:00
Roy Marples 0c25b359de Allow bash arrays to be flattened to make some configs easier. 2007-11-14 18:23:59 +00:00
Roy Marples 39227ede1d relicense as 2-clause BSD, with the kind permission of Gentoo 2007-11-14 15:22:04 +00:00
Roy Marples 388f3ab9c5 Fix up display for tab delimited foo 2007-11-02 17:03:29 +00:00
Roy Marples 80124a050c Work cleanly with bridges on kernels without TCP, #197791. 2007-11-01 22:25:53 +00:00
Roy Marples be13c0018b Fix fallback, #197788. 2007-11-01 18:15:30 +00:00
Roy Marples 7cd70aee4d You can now log baselayout-2 again, through the RC_LOGGER conf.d/rc
setting. The log is temp stored in /lib/rc/init.d/rc.log and appended
to /var/log/rc.log if it's writeable. sysinit cannot be logged in Linux
as we rely on sysinit to bring the system up to a point where we can log.
single user cannot be logged on FreeBSD due to waitpid(0,0,0) incorrectly
waiting for the log daemon in another process group.
2007-10-31 15:46:56 +00:00
Roy Marples 7d2c240c25 Embed newlines in __IFS to save our identing 2007-10-30 11:37:49 +00:00
Roy Marples e372729b8c Network config arrays are now split by embedded new lines instead of being evaled into space separated values. This makes it easier to read, maintain and document as discussed on gentoo-dev. 2007-10-29 09:45:49 +00:00
Roy Marples dc0ba7ebf3 netmount, localmount, halt.sh and net scripts now check OS specific flags to see if a mount is network mounted (linux = fstab, *bsd = "local" in mount options) or not, #192772. 2007-10-09 15:33:05 +00:00
Roy Marples bd83448633 Document help and status 2007-10-04 14:57:51 +00:00
Roy Marples 24e0790e38 Fix rc-help regarding per runlevel config files 2007-10-04 14:44:13 +00:00
Roy Marples 162887c364 -C should force no colour as well 2007-09-28 19:29:59 +00:00
Roy Marples b894cdb738 net.sh now checks to see if root is net mounted if no predown function
exists, #194074.
2007-09-28 12:46:59 +00:00
Roy Marples cb2959ef76 Use mkdir to test. 2007-09-24 15:28:48 +00:00
Roy Marples e95cea3d86 Split our rc commands out into general use vs service commands 2007-09-24 12:09:43 +00:00
Roy Marples faa555efe2 No need for this convulted sed now our prefixed output is on a direct terminal again :) 2007-09-21 08:54:36 +00:00
Roy Marples 77f9015f0b /lib/rcscripts -> /lib/rc 2007-09-19 13:53:40 +00:00
Roy Marples 47f21d06a0 Fix fallback configurations 2007-09-17 21:38:58 +00:00
Roy Marples fac4de2b46 Portability 2007-09-17 20:59:55 +00:00
Roy Marples 2d39857170 Don't use local here 2007-09-02 12:55:18 +00:00
Roy Marples a9ebc7a2af Only generate dependencies for Gentoo scripts, #190547. 2007-08-31 16:21:19 +00:00
Roy Marples 144d9653e1 Undocument pause action, fix --nodeps and --ifstarted, #190045. 2007-08-28 13:06:44 +00:00
Mike Frysinger 4a23e42be8 Make sure we list all config files in rc help output. 2007-08-25 18:17:05 +00:00
Roy Marples eba9b8ac14 Fully move esyslog into rc 2007-08-16 17:09:57 +00:00
Roy Marples b8b1352b38 whitespace 2007-08-15 17:47:25 +00:00
Roy Marples 2ad4a5ba4a Add config to rc-help.sh 2007-08-15 16:58:51 +00:00
Roy Marples 3950eb6eba `config /etc/fstab' can now be used in depend() functions to show that
the deptree should be regenerated if /etc/fstab has changed.
2007-08-15 14:49:41 +00:00
Roy Marples f1f5b0c367 whitespace 2007-07-22 11:28:38 +00:00
Roy Marples 6c54d47341 Had a brain fart - just echo to fd3 2007-07-22 11:27:26 +00:00
Roy Marples 52664d77f9 Cater for einfo calls inside the depend function 2007-07-22 11:23:56 +00:00
Roy Marples b67f71ca5d Harden gendepends.sh some more so we only capture the stdout we want from
the depend function, #186072.
2007-07-22 10:45:56 +00:00
Roy Marples 26d11b33cf Use printf so we don't put blank lines at the top of new files and fix mountinfo for nfs roots 2007-07-16 17:07:15 +00:00
Roy Marples 42a5cb043b Allow zsh to work as our shell 2007-07-16 16:22:37 +00:00
Roy Marples cffbaa6c4e Use echo instead of touch - saves on forking 2007-07-13 00:04:20 +00:00
Roy Marples 5257ba51b9 Don't unmount network filesystems in localmount or halt.sh, #175602. 2007-07-11 17:27:46 +00:00
Roy Marples 356c41f77c Punt the dodgy ebuffer code. We now force prefixing for parallel starts which also reduces our variable pollution. 2007-07-11 12:06:37 +00:00
Roy Marples 05201b514b init scripts and their extra options can now have descriptions, #184327. 2007-07-10 19:09:41 +00:00
Roy Marples 0234605bf4 Up the interface after preup incase preup brings it down 2007-07-04 14:21:24 +00:00
Roy Marples 27344f7f27 Use killall5 again so we can cleanly remount / readonly, #168977
and #177689.
2007-05-30 22:30:54 +00:00
Roy Marples 1c1b0b0a4c Don't use -f with mount 2007-05-30 15:47:54 +00:00
Roy Marples e81ab8ecf8 Call umount with LC_ALL=C so that we can umount /usr 2007-05-30 15:24:21 +00:00
Roy Marples 49347d6f77 Be more resilient when the nettree is invalid 2007-05-18 20:09:10 +00:00
Roy Marples ea28d7e78d Better fix 2007-05-05 21:22:46 +00:00
Roy Marples 2ad5c3eb33 Fix KV_to_int working with funky kernel versions, #177197. 2007-05-05 20:27:50 +00:00
Roy Marples b4a3796b01 Load the config file before the init script to stop badly coded init scripts from erroring, #176548 2007-05-03 08:08:59 +00:00
Roy Marples d599a40680 Correct tabs 2007-05-02 11:04:52 +00:00
Roy Marples 82361c0feb Don't delete addresses for PPP interfaces, #176764. 2007-05-02 10:59:34 +00:00
Roy Marples d658c2dc6d Fix carrier_timeout 2007-04-30 13:17:28 +00:00
Roy Marples 00d596fb43 Fix Makefile to clean and remove .svn when making dist. rc-mount no longer appends -f for linux mount and uses -i instead to ignore helpers 2007-04-25 12:32:47 +00:00
Roy Marples a44abb9577 We now buffer stdout and stderr to a file and flush that when running in parallel. RC_PARALLEL_STARTUP has been renamed to RC_PARALLEL. 2007-04-24 11:29:19 +00:00
Roy Marples f05ac25185 Fix bridge some more, remove superflous warning from vewarn and error when no interface correctly 2007-04-19 06:46:29 +00:00
Roy Marples f657d87b99 Rationalise our colour usage a little. 2007-04-17 09:32:18 +00:00
Roy Marples 0f92b5e7df Allow user vars for colours in our shell scripts too 2007-04-17 07:11:27 +00:00
Mike Frysinger 2266255ac5 Allow addons to pass up their exit status in import_addon. Simplify /dev handling in init.sh and add mdev as an option. 2007-04-17 00:07:09 +00:00
Roy Marples eabcb48f71 netmask -> CIDR is worked out correctly #174341. 2007-04-13 10:30:57 +00:00
Roy Marples 64c4d3875d Move carrier detection back into net.sh. Reserve a new hook numbers 2007-04-11 10:40:53 +00:00
Roy Marples 0c98067d57 Misc network fixes so we work on my stable server. Splash plugin removed as splashtuils-1.4 now ships with its own. 2007-04-10 10:33:44 +00:00
Roy Marples 5076114aa7 routes_SSID now works, as does iwconfig.sh for BSD 2007-04-09 18:56:26 +00:00
Roy Marples 5af58b4514 Rewrite the core parts in C. We now provide librc so other programs can
query runlevels, services and state without using bash. We also provide
libeinfo so other programs can easily use our informational functions.

As such, we have dropped the requirement of using bash as the init script
shell. We now use /bin/sh and have strived to make the scripts as portable
as possible. Shells that work are bash and dash. busybox works provided
you disable s-s-d. If you have WIPE_TMP set to yes in conf.d/bootmisc you
should disable find too.
zsh and ksh do not work at this time.

Networking support is currently being re-vamped also as it was heavily bash
array based. As such, a new config format is available like so
config_eth0="1.2.3.4/24 5.6.7.8/16"
or like so
config_eth0="'1.2.3.4 netmask 255.255.255.0' '5.6.7.8 netmask 255.255.0.0'"

We will still support the old bash array format provided that /bin/sh IS
a link it bash.

ChangeLog for baselayout-1 can be found in our SVN repo.
2007-04-05 11:18:42 +00:00