Functions.sh
From Gentoo Linux Wiki
Please format this article according to the guidelines and Wikification suggestions, then remove this notice {{Wikify}} from the article
The /sbin/functions.sh definitions file is included by the rc initscript. It performs the following series of functions:
- Flag RC_GOT_FUNCTIONS="yes" to avoid repetition
- Obtain the configuration Variables from /etc/conf.d/rc configuration file
- Define a series of variables
- Define a series of functions
- Run some finalization code
[edit] Defined Functions
The following functions are defined within functions.sh:
| !_eend | A private function to indicate the end of a process |
| addsuffix | Echos the config filename with the softlevel suffix added, for use with multi-config services. |
| bootlog | A function to notify the [bootlogger] of important events |
| dolisting | Echo a list of the contents of a directory |
| ebegin | Show a message indicating the start of a process |
| eend | Indicate the completion of a process (show errstr via eerror) |
| eerror | Show and log an error message |
| eindent | Increase the indent used for [ecommands] |
| einfo | Show an informative message (with a newline) |
| einfon | Show an informative message (without a newline) |
| eoutdent | Decrease the indent used for [ecommands] |
| esetdent | Hard set the indent used for [ecommands] |
| esyslog | Log a messge via the system [logger] |
| ewarn | Show and log a warning messagev |
| ewend | Indicate the completion of a process (show errstr via ewarn) |
| is_net_fs | Return zero if path is the mountpoint of a networked filesystem |
| is_vserver_sys | Return zero if currently running as a [vserver] |
| is_uml_sys | Return zero if currently running [UML User Mode Linux] |
| is_union_fs | Return zero if path is under unionfs control |
| is_xenU_sys | Return zero if currently running as an unprivileged Xen domain |
| get_base_ver | Echo the [baselayout] version being used |
| get_bootconfig | Determine [bootlevel] and [softlevel] from command line parameters |
| get_bootparam | Return zero if gentoo=param was passed to the kernel |
| get_libdir | Echo the current [libdir] (lib,lib32,lib64) |
| get_KV | Echo the kernel version number |
| get_mount_fstab | Echo parameters to pass to the mount command (generated from [fstab]) |
| has_addon | Check if a specified addon exists |
| import_addon | Import code from a specified addon if it exists |
| KV_major | Echo the Major (X of X.Y.Z) of the kernel version |
| KV_micro | Echo the Micro (Z of X.Y.Z) of the kernel version |
| KV_minor | Echo the Minor (Y of X.Y.Z) of the kernel version |
| KV_to_int | Echo the kernel version converted to an integer |
| profiling | An additional function to notify the [splashscreen] of events |
| reverse_list | Echos a list in reversed order |
| setup_defaultlevels | Additional adjustments to [bootlevel] and [softlevel] |
| splash | A preliminary function to notify the [splashscreen] of events |
| start_addon | Starts an [addon] |
| stop_addon | Stops an [addon] |
| vebegin | Uses ebegin if RC_VERBOSE |
| veend | Uses eend if RC_VERBOSE |
| veinfo | Uses einfo if RC_VERBOSE |
| veinfon | Uses einfon if RC_VERBOSE |
| veerror | Uses eerror if RC_VERBOSE |
| vewarn | Uses ewarn if RC_VERBOSE |
| veewend | Uses ewend if RC_VERBOSE |
[edit] Finalization Code
The finalization code sets some configuration variables for use by the shell depending on the terminal type in use, and makes some adjustments to bootlevel and softlevel via the setup_defaultlevels function.
