summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/functions.sh')
-rwxr-xr-xsbin/functions.sh29
1 files changed, 15 insertions, 14 deletions
diff --git a/sbin/functions.sh b/sbin/functions.sh
index dc7997f..ea09893 100755
--- a/sbin/functions.sh
+++ b/sbin/functions.sh
@@ -1,4 +1,4 @@
-# Copyright 1999-2005 Gentoo Foundation
+# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
RC_GOT_FUNCTIONS="yes"
@@ -108,7 +108,7 @@ setup_defaultlevels() {
if [[ -f "${svcdir}/softlevel" ]] ; then
export SOFTLEVEL=$(< "${svcdir}/softlevel")
else
- export SOFTLEVEL=${BOOTLEVEL}
+ export SOFTLEVEL="${BOOTLEVEL}"
fi
fi
@@ -121,7 +121,7 @@ setup_defaultlevels() {
#
get_libdir() {
if [[ -n ${CONF_LIBDIR_OVERRIDE} ]] ; then
- CONF_LIBDIR=${CONF_LIBDIR_OVERRIDE}
+ CONF_LIBDIR="${CONF_LIBDIR_OVERRIDE}"
elif [[ -x /usr/bin/portageq ]] ; then
CONF_LIBDIR=$(/usr/bin/portageq envvar CONF_LIBDIR)
fi
@@ -137,8 +137,8 @@ esyslog() {
local tag=
if [[ -x /usr/bin/logger ]] ; then
- pri=$1
- tag=$2
+ pri="$1"
+ tag="$2"
shift 2
[[ -z "$*" ]] && return 0
@@ -154,7 +154,7 @@ esyslog() {
# increase the indent used for e-commands.
#
eindent() {
- local i=$1
+ local i="$1"
(( i > 0 )) || (( i = RC_DEFAULT_INDENT ))
esetdent $(( ${#RC_INDENTATION} + i ))
}
@@ -164,7 +164,7 @@ eindent() {
# decrease the indent used for e-commands.
#
eoutdent() {
- local i=$1
+ local i="$1"
(( i > 0 )) || (( i = RC_DEFAULT_INDENT ))
esetdent $(( ${#RC_INDENTATION} - i ))
}
@@ -175,7 +175,7 @@ eoutdent() {
# num defaults to 0
#
esetdent() {
- local i=$1
+ local i="$1"
(( i < 0 )) && (( i = 0 ))
RC_INDENTATION=$(printf "%${i}s" '')
}
@@ -471,7 +471,7 @@ dolisting() {
# save the settings ("optstring") for "option"
#
save_options() {
- local myopts=$1
+ local myopts="$1"
shift
if [[ ! -d "${svcdir}/options/${myservice}" ]] ; then
@@ -502,6 +502,7 @@ get_options() {
# appended to it. For use with multi-config services.
add_suffix() {
echo "$1"
+
return 0
}
@@ -529,7 +530,7 @@ NET_FS_LIST="afs cifs coda davfs gfs ncpfs nfs nfs4 ocfs2 shfs smbfs"
is_net_fs() {
local fstype
# /proc/mounts is always accurate
- fstype=$( sed -n -e '/^rootfs/!s:.* '"$1"' \([^ ]*\).*:\1:p' /proc/mounts )
+ fstype=$( mount | sed -n -e 's:.* on '"$1"' type \([^ ]*\).*:\1:p' )
[[ " ${NET_FS_LIST} " == *" ${fstype} "* ]]
return $?
}
@@ -591,7 +592,7 @@ reverse_list() {
# Starts addon.
#
start_addon() {
- local addon=$1
+ local addon="$1"
(import_addon "${addon}-start.sh")
return 0
}
@@ -630,7 +631,7 @@ stop_volumes() {
# EXAMPLE: if is_older_than a.out *.o ; then ...
is_older_than() {
local x=
- local ref=$1
+ local ref="$1"
shift
for x in "$@" ; do
@@ -708,7 +709,7 @@ else
# Should we use colors ?
if [[ $* != *depend* ]] ; then
# Check user pref in portage
- RC_NOCOLOR=$(portageq envvar NOCOLOR 2>/dev/null)
+ RC_NOCOLOR="$(portageq envvar NOCOLOR 2>/dev/null)"
[[ ${RC_NOCOLOR} == "true" ]] && RC_NOCOLOR="yes"
else
# We do not want colors during emerge depend
@@ -724,7 +725,7 @@ if [[ -n ${EBUILD} && $* == *depend* ]] ; then
else
# Setup COLS and ENDCOL so eend can line up the [ ok ]
COLS=${COLUMNS:-0} # bash's internal COLUMNS variable
- (( COLS == 0 )) && COLS=$(stty size 2>/dev/null | cut -d' ' -f2)
+ (( COLS == 0 )) && COLS=$(set -- `stty size 2>/dev/null` ; echo $2)
(( COLS > 0 )) || (( COLS = 80 )) # width of [ ok ] == 7
fi