From d81def80b00a3dbcb4f8980f4503c4d659b48a2a Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Fri, 23 Nov 2007 12:04:11 +0000 Subject: 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) --- sh/Makefile | 8 ++++---- sh/gendepends.sh | 12 ++++++------ sh/init-functions.sh | 8 ++++++-- sh/rc-functions.sh | 3 ++- sh/rc-help.sh | 10 ++++------ sh/runscript.sh | 26 +++++++++++++------------- 6 files changed, 35 insertions(+), 32 deletions(-) (limited to 'sh') diff --git a/sh/Makefile b/sh/Makefile index af610ca7..c76d622c 100644 --- a/sh/Makefile +++ b/sh/Makefile @@ -1,7 +1,7 @@ -DIR = $(RC_LIB)/sh -CONF = functions.sh init-functions.sh init-common-post.sh \ - rc-functions.sh rc-mount.sh -BIN = gendepends.sh net.sh rc-mount.sh rc-help.sh runscript.sh +DIR = $(RC_LIB)/sh +INC = functions.sh init-functions.sh init-common-post.sh \ + rc-functions.sh rc-mount.sh +BIN = gendepends.sh net.sh rc-mount.sh rc-help.sh runscript.sh TOPDIR = .. include $(TOPDIR)/default.mk diff --git a/sh/gendepends.sh b/sh/gendepends.sh index 6f93e7c3..12db5a02 100755 --- a/sh/gendepends.sh +++ b/sh/gendepends.sh @@ -77,12 +77,12 @@ for SVCNAME in * ; do depend # Add any user defined depends - config ${RC_CONFIG} - need ${RC_NEED} - use ${RC_USE} - before ${RC_BEFORE} - after ${RC_AFTER} - provide ${RC_PROVIDE} + config ${rc_config} ${RC_CONFIG} + need ${rc_need} ${RC_NEED} + use ${rc_use} ${RC_USE} + before ${rc_before} ${RC_BEFORE} + after ${rc_after} ${RC_AFTER} + provide ${rc_provide} ${RC_PROVIDE} fi ) done diff --git a/sh/init-functions.sh b/sh/init-functions.sh index ced84897..400a82b4 100644 --- a/sh/init-functions.sh +++ b/sh/init-functions.sh @@ -63,9 +63,13 @@ check_statedir() { #splash "critical" & echo eerror "To function properly, \"$1\" needs to exist." - if yesno ${RC_FORCE_AUTO}; then + if yesno ${rc_force_auto:-${RC_FORCE_AUTO}}; then eerror "Attempting to create \"$1\" for you ..." - mount -o remount,rw / + if [ "${RC_UNAME}" = "Linux" ]; then + mount -o remount,rw / + else + mount -u -o rw / + fi mkdir -p "$1" fi if [ ! -d "$1" ] ; then diff --git a/sh/rc-functions.sh b/sh/rc-functions.sh index a346796f..571a0cf1 100755 --- a/sh/rc-functions.sh +++ b/sh/rc-functions.sh @@ -45,6 +45,7 @@ stop_addon() { ( import_addon "$1-stop" ) } +net_fs_list="afs cifs coda davfs fuse gfs ncpfs nfs nfs4 ocfs2 shfs smbfs" is_net_fs() { [ -z "$1" ] && return 1 @@ -54,7 +55,7 @@ is_net_fs() { # Fall back on fs types local t=$(mountinfo --fstype "$1") - for x in ${RC_NET_FS_LIST}; do + for x in ${net_fs_list}; do [ "${x}" = "${t}" ] && return 0 done return 1 diff --git a/sh/rc-help.sh b/sh/rc-help.sh index 45f939f0..a7177485 100755 --- a/sh/rc-help.sh +++ b/sh/rc-help.sh @@ -146,7 +146,7 @@ if yesno ${BE_VERBOSE}; then printf " ${CYAN}Dependencies:${OFF} - This is the heart of the Gentoo RC-Scripts, as it determines the order + This is the heart of the OpenRC, as it determines the order in which services gets started, and also to some extend what services get started in the first place. @@ -252,9 +252,7 @@ printf " " fi -printf " /etc/conf.d/rc - /etc/conf.d/rc.\${RC_SOFTLEVEL} - /etc/conf.d/${SERVICE} +printf " /etc/conf.d/${SERVICE} /etc/conf.d/${SERVICE}.\${RC_SOFTLEVEL} /etc/rc.conf \${RC_SOFTLEVEL} denotes the name of the runlevel" @@ -263,8 +261,8 @@ if yesno ${BE_VERBOSE}; then printf " You can add extra dependencies to ${SERVICE} by adding some variables to /etc/conf.d/${SERVICE} - RC_NEED=\"openvpn ntpd\" - RC_USE=\"dns\" + rc_need=\"openvpn ntpd\" + rc_use=\"dns\" This makes ${SERVICE} need openvpn and ntpd, while it just uses dns. diff --git a/sh/runscript.sh b/sh/runscript.sh index 5ba1004d..78433e87 100755 --- a/sh/runscript.sh +++ b/sh/runscript.sh @@ -59,18 +59,18 @@ describe() { done } -yesno ${RC_DEBUG} && set -x +yesno ${rc_debug} && set -x # If we're net.eth0 or openvpn.work then load net or openvpn config -rc_c=${SVCNAME%%.*} -if [ -n "${rc_c}" -a "${rc_c}" != "${SVCNAME}" ]; then - if [ -e "/etc/conf.d/${rc_c}.${RC_SOFTLEVEL}" ]; then - . "/etc/conf.d/${rc_c}.${RC_SOFTLEVEL}" - elif [ -e "/etc/conf.d/${rc_c}" ]; then - . "/etc/conf.d/${rc_c}" +_c=${SVCNAME%%.*} +if [ -n "${_c}" -a "${_c}" != "${SVCNAME}" ]; then + if [ -e "/etc/conf.d/${_c}.${RC_SOFTLEVEL}" ]; then + . "/etc/conf.d/${_c}.${RC_SOFTLEVEL}" + elif [ -e "/etc/conf.d/${_c}" ]; then + . "/etc/conf.d/${_c}" fi fi -unset rc_c +unset _c # Overlay with our specific config if [ -e "/etc/conf.d/${SVCNAME}.${RC_SOFTLEVEL}" ]; then @@ -83,7 +83,7 @@ fi [ -e /etc/rc.conf ] && . /etc/rc.conf # Apply any ulimit defined -[ -n "${RC_ULIMIT}" ] && ulimit ${RC_ULIMIT} +[ -n "${rc_ulimit:-${RC_ULIMIT}}" ] && ulimit ${rc_ulimit:-${RC_ULIMIT}} # Load our script . $1 @@ -128,10 +128,10 @@ fi while [ -n "$1" ]; do # See if we have the required function and run it - for rc_x in describe start stop ${extra_commands:-${opts}}; do - if [ "${rc_x}" = "$1" ]; then + for _cmd in describe start stop ${extra_commands:-${opts}}; do + if [ "${_cmd}" = "$1" ]; then if type "$1" >/dev/null 2>&1; then - unset rc_x + unset _cmd if type "$1"_pre >/dev/null 2>&1; then "$1"_pre || exit $? fi @@ -142,7 +142,7 @@ while [ -n "$1" ]; do shift continue 2 else - if [ "${rc_x}" = "start" -o "${rc_x}" = "stop" ]; then + if [ "${_cmd}" = "start" -o "${_cmd}" = "stop" ]; then exit 0 else eerror "${SVCNAME}: function \`$1' defined but does not exist" -- cgit v1.2.3