From ef10d52745a72f524e36edc375a6a05d3365ede4 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Mon, 26 Jun 2006 14:11:33 +0000 Subject: Upgrade mdev to allow commands to be run on create/delete. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both Jason Schoon and Giuseppe Ciotta deserve credit for this, I used elements of both.  It's been upgraded so that you can specify that a given command should run at create, at delete, or at both using different special characters (@, $, and * respectively).  It uses the system() method of running command lines which means you can use environment variables on the command line (it sets $MDEV to the name of the current device being created/deleted, which is useful if you matched it via regex), and the documentation warns that you need a /bin/sh to make that work, so you probably want to pick a default shell. --- util-linux/Config.in | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'util-linux/Config.in') diff --git a/util-linux/Config.in b/util-linux/Config.in index a493fbfb4..501ed6bfc 100644 --- a/util-linux/Config.in +++ b/util-linux/Config.in @@ -265,16 +265,31 @@ config CONFIG_FEATURE_MDEV_CONF That's device name (with regex match), uid:gid, and permissions. - Optionally, that can be followed (on the same line) by an asterisk - and a command line to run after creating the corresponding device(s), - ala: - - hdc root:cdrom 660 *ln -s hdc cdrom - Config file parsing stops on the first matching line. If no config entry is matched, devices are created with default 0:0 660. (Make the last line match .* to override this.) +config CONFIG_FEATURE_MDEV_EXEC + bool "Support command execution at device addition/removal" + default n + depends on CONFIG_FEATURE_MDEV_CONF + help + This adds support for an optional field to /etc/mdev.conf, consisting + of a special character and a command line to run after creating the + corresponding device(s) and before removing, ala: + + hdc root:cdrom 660 *ln -s $MDEV cdrom + + The $MDEV environment variable is set to the name of the device. + + The special characters and their meanings are: + @ Run after creating the device. + $ Run before removing the device. + * Run both after creating and before removing the device. + + Commands are executed via system() so you need /bin/sh, meaning you + probably want to select a default shell in the Shells menu. + config CONFIG_MKSWAP bool "mkswap" default n -- cgit v1.2.3