/[baselayout]/trunk/sh/rc-functions.sh
Gentoo

Contents of /trunk/sh/rc-functions.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2911 - (show annotations) (download) (as text)
Mon Sep 24 12:09:43 2007 UTC (7 years, 3 months ago) by uberlord
File MIME type: text/x-sh
File size: 1230 byte(s)
Split our rc commands out into general use vs service commands
1 # Copyright 2007 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 has_addon() {
5 [ -e "${RC_LIBDIR}/addons/$1.sh" ] || [ -e /lib/rcscripts/addons/"$1".sh ]
6 }
7
8 import_addon() {
9 if [ -e "${RC_LIBDIR}/addons/$1.sh" ]; then
10 . "${RC_LIBDIR}/addons/$1.sh"
11 elif [ -e /lib/rcscripts/addons/"$1".sh ]; then
12 . /lib/rcscripts/addons/"$1".sh
13 else
14 return 1
15 fi
16 }
17
18 start_addon() {
19 ( import_addon "$1-start" )
20 }
21
22 stop_addon() {
23 ( import_addon "$1-stop" )
24 }
25
26 is_net_fs() {
27 [ -z "$1" ] && return 1
28
29 local t=$(mountinfo --fstype "$1")
30 for x in ${RC_NET_FS_LIST}; do
31 [ "${x}" = "${t}" ] && return 0
32 done
33 return 1
34 }
35
36 is_union_fs() {
37 [ ! -x /sbin/unionctl ] && return 1
38 unionctl "$1" --list >/dev/null 2>/dev/null
39 }
40
41 get_bootparam() {
42 local match="$1"
43 [ -z "${match}" -o ! -r /proc/cmdline ] && return 1
44
45 set -- $(cat /proc/cmdline)
46 while [ -n "$1" ]; do
47 case "$1" in
48 gentoo=*)
49 local params="${1##*=}"
50 local IFS=, x=
51 for x in ${params}; do
52 [ "${x}" = "${match}" ] && return 0
53 done
54 ;;
55 esac
56 shift
57 done
58
59 return 1
60 }
61
62 # Add our sbin to $PATH
63 case "${PATH}" in
64 /lib/rc/sbin|/lib/rc/sbin:*) ;;
65 *) export PATH="/lib/rc/sbin:${PATH}" ;;
66 esac
67
68 # vim: set ts=4 :

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20