#RC_DOT_PATTERN=' .'
RC_DOT_PATTERN=''
-# void get_bootconfig()
-#
-# Get the BOOTLEVEL and SOFTLEVEL by setting
-# 'bootlevel' and 'softlevel' via kernel
-# parameters.
-#
-get_bootconfig() {
- local copt
- local newbootlevel
- local newsoftlevel
-
- for copt in $(</proc/cmdline) ; do
- case "${copt%=*}" in
- "bootlevel")
- newbootlevel="${copt##*=}"
- ;;
- "softlevel")
- newsoftlevel="${copt##*=}"
- ;;
- esac
- done
-
- if [ -n "${newbootlevel}" ] ; then
- export BOOTLEVEL="${newbootlevel}"
- else
- export BOOTLEVEL="boot"
- fi
-
- if [ -n "${newsoftlevel}" ] ; then
- export DEFAULTLEVEL="${newsoftlevel}"
- else
- export DEFAULTLEVEL="default"
- fi
-
- return 0
-}
-
# void esyslog(char* priority, char* tag, char* message)
#
# use the system logger to log a message
return $retval
}
-# v-e-commands honor RC_VERBOSE which defaults to no.
-# The condition is negated so the return value will be zero.
-veinfo() { [ "${RC_VERBOSE}" != "yes" ] || einfo "$@"; }
-veinfon() { [ "${RC_VERBOSE}" != "yes" ] || einfon "$@"; }
-vewarn() { [ "${RC_VERBOSE}" != "yes" ] || ewarn "$@"; }
-veerror() { [ "${RC_VERBOSE}" != "yes" ] || eerror "$@"; }
-vebegin() { [ "${RC_VERBOSE}" != "yes" ] || ebegin "$@"; }
-veend() {
- [ "${RC_VERBOSE}" = "yes" ] && { eend "$@"; return $?; }
- return ${1:-0}
-}
-veend() {
- [ "${RC_VERBOSE}" = "yes" ] && { ewend "$@"; return $?; }
- return ${1:-0}
-}
-
-# bool get_bootparam(param)
-#
-# return 0 if gentoo=param was passed to the kernel
-#
-# EXAMPLE: if get_bootparam "nodevfs" ; then ....
-#
-get_bootparam() {
- local x copt params retval=1
-
- [ ! -r "/proc/cmdline" ] && return 1
-
- for copt in $(< /proc/cmdline)
- do
- if [ "${copt%=*}" = "gentoo" ]
- then
- params="$(gawk -v PARAMS="${copt##*=}" '
- BEGIN {
- split(PARAMS, nodes, ",")
- for (x in nodes)
- print nodes[x]
- }')"
-
- # Parse gentoo option
- for x in ${params}
- do
- if [ "${x}" = "$1" ]
- then
-# printf "YES\n"
- retval=0
- fi
- done
- fi
- done
-
- return ${retval}
-}
-
# char *add_suffix(char * configfile)
#
# Returns a config file name with the softlevel suffix
return 0
}
-# bool get_mount_fstab(path)
-#
-# return the parameters to pass to the mount command generated from fstab
-#
-# EXAMPLE: cmd=$( get_mount_fstab /proc )
-# cmd=${cmd:--t proc none /proc}
-# mount -n ${cmd}
-#
-get_mount_fstab() {
- awk '$1 ~ "^#" { next }
- $2 == "'$*'" { if (found++ == 0) { print "-t "$3,"-o "$4,$1,$2 } }
- END { if (found > 1) { print "More than one entry for '$*' found in /etc/fstab!" > "/dev/stderr" } }
- ' /etc/fstab
-}
-
# char *reverse_list(list)
#
# Returns the reversed order of list