summaryrefslogtreecommitdiffstats
path: root/scripts/zfs.sh
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2010-08-26 11:22:58 -0700
committerBrian Behlendorf <[email protected]>2010-08-31 13:41:27 -0700
commitc9c0d073da561bcbefbdf09c87fc75b227415619 (patch)
tree7daee55ae61526107f421de48171573fa5a15d28 /scripts/zfs.sh
parent40b84e7aec6392187722e61e5a4a853b530bf60f (diff)
Add build system
Add autoconf style build infrastructure to the ZFS tree. This includes autogen.sh, configure.ac, m4 macros, some scripts/*, and makefiles for all the core ZFS components.
Diffstat (limited to 'scripts/zfs.sh')
-rwxr-xr-xscripts/zfs.sh74
1 files changed, 74 insertions, 0 deletions
diff --git a/scripts/zfs.sh b/scripts/zfs.sh
new file mode 100755
index 000000000..523fbfcc0
--- /dev/null
+++ b/scripts/zfs.sh
@@ -0,0 +1,74 @@
+#!/bin/bash
+#
+# A simple script to simply the loading/unloading the ZFS module stack.
+
+basedir="$(dirname $0)"
+
+SCRIPT_COMMON=common.sh
+if [ -f "${basedir}/${SCRIPT_COMMON}" ]; then
+. "${basedir}/${SCRIPT_COMMON}"
+else
+echo "Missing helper script ${SCRIPT_COMMON}" && exit 1
+fi
+
+PROG=zfs.sh
+UNLOAD=
+
+usage() {
+cat << EOF
+USAGE:
+$0 [hvud] [module-options]
+
+DESCRIPTION:
+ Load/unload the ZFS module stack.
+
+OPTIONS:
+ -h Show this message
+ -v Verbose
+ -u Unload modules
+ -d Save debug log on unload
+
+MODULE-OPTIONS:
+ Must be of the from module="options", for example:
+
+$0 zfs="zfs_prefetch_disable=1"
+$0 zfs="zfs_prefetch_disable=1 zfs_mdcomp_disable=1"
+$0 spl="spl_debug_mask=0"
+
+EOF
+}
+
+while getopts 'hvud' OPTION; do
+ case $OPTION in
+ h)
+ usage
+ exit 1
+ ;;
+ v)
+ VERBOSE=1
+ ;;
+ u)
+ UNLOAD=1
+ ;;
+ d)
+ DUMP_LOG=1
+ ;;
+ ?)
+ usage
+ exit
+ ;;
+ esac
+done
+
+if [ $(id -u) != 0 ]; then
+ die "Must run as root"
+fi
+
+if [ ${UNLOAD} ]; then
+ unload_modules
+else
+ check_modules || die "${ERROR}"
+ load_modules "$@"
+fi
+
+exit 0