summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--functions22
1 files changed, 22 insertions, 0 deletions
diff --git a/functions b/functions
index 584fe0d..f2515de 100644
--- a/functions
+++ b/functions
@@ -2,6 +2,28 @@ msg () { [ "${QUIET}" = "n" ] && echo $@; }
err () { echo "ERROR: $@" >&2; }
die () { echo "FATAL: $@" >&2; cleanup; exit 1; }
+get_dirname ()
+{
+ # strip any trailing slash first...
+ local dir="${1%/}"
+ # then get the directory portion
+ echo "${dir%/*}"
+}
+
+get_basename ()
+{
+ echo "${1##*/}"
+}
+
+get_module_name ()
+{
+ #cleanup - remove .ko, replace - with _
+ local modname="${1%.gz}"
+ modname=$(get_basename "${modname%.ko}")
+ modname="${modname//-/_}"
+ echo "$modname"
+}
+
auto_modules ()
{
aliases="$(find /sys/devices/ -name modalias -exec cat {} +)"