local ret=0
local arg
- for arg in $@; do
+ for arg in "$@"; do
local unit
case "${arg}" in
}
cmd_quiet() {
- cmd $@ &>/dev/null
+ cmd "$@" &>/dev/null
}
cmd_exec() {
# Executes the given command in background
cmd_background() {
- cmd_quiet $@ &
+ cmd_quiet "$@" &
}
# Prints the PID of the process that was started last
# Increase security of the read command
read() {
- builtin read -r $@
+ builtin read -r "$@"
}
seq() {
}
which() {
- type -P $@
+ type -P "$@"
}
# Prints the number of seconds since epoch.
module_load() {
local module=${1}
- if ! grep -q "^${module}" /proc/modules; then
- log DEBUG "Loading module '${module}'."
- modprobe ${module}
+ # Do nothing if the module is already loaded
+ if [ -d "/sys/module/${module//-/_}" ]; then
+ return ${EXIT_OK}
fi
+
+ log DEBUG "Loading kernel module ${module}"
+ modprobe "${module}"
}
binary_exists() {