148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens# CDDL HEADER START
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens# The contents of this file are subject to the terms of the
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens# Common Development and Distribution License (the "License").
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens# You may not use this file except in compliance with the License.
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens# See the License for the specific language governing permissions
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens# and limitations under the License.
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens# When distributing Covered Code, include this CDDL HEADER in each
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens# If applicable, add the following below this CDDL HEADER, with the
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens# fields enclosed by brackets "[]" replaced with your own identifying
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens# information: Portions Copyright [yyyy] [name of copyright owner]
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens# CDDL HEADER END
6d52f363e3b2c0c5da672c5b8c8adec99d345f38Lori Alt# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens# Note, we want SIGINT (control-c) to exit the process quietly, to mimic
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens# the standard behavior of C programs. The best we can do with pure
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens# Python is to run with -S (to disable "import site"), and start our
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens# program with a "try" statement. Hopefully nobody hits ^C before our
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens# try statement is executed.
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens """This is the main script for doing zfs subcommands. It doesn't know
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens what subcommands there are, it just looks for a module zfs.<subcommand>
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens that implements that subcommand."""
e4d060fb4c00d44cd578713eb9a921f594b733b8Sam Falkner _ = gettext.translation("SUNW_OST_OSCMD", "/usr/lib/locale",
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens zfs.ioctl.set_cmdstr(" ".join(["zfs"] + sys.argv[1:]))
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens # import zfs.<subcommand>
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens # subfunc = zfs.<subcommand>.do_<subcommand>