diff options
author | Rob Landley <rob@landley.net> | 2006-06-26 14:11:33 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2006-06-26 14:11:33 +0000 |
commit | ef10d52745a72f524e36edc375a6a05d3365ede4 (patch) | |
tree | bd1ee024e81262ec2485c4d5f391ef910d85bd38 /include | |
parent | cf7577d4171d517690e95e7225979bfde32fce7c (diff) | |
download | busybox-ef10d52745a72f524e36edc375a6a05d3365ede4.tar.gz |
Upgrade mdev to allow commands to be run on create/delete.
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.
Diffstat (limited to 'include')
-rw-r--r-- | include/usage.h | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/include/usage.h b/include/usage.h index 8defbd1fc..712eede63 100644 --- a/include/usage.h +++ b/include/usage.h @@ -1799,19 +1799,25 @@ USE_FEATURE_DATE_ISOFMT( \ "\t-s\tScan /sys and populate /dev during system boot\n\n" \ "Called with no options (via hotplug) it uses environment variables\n" \ "to determine which device to add/remove." -#ifdef CONFIG_FEATURE_MDEV_CONFIG -#define mdev_notes_usage \ +#define mdev_notes_usage "" \ +USE_FEATURE_MDEV_CONFIG( \ "The mdev config file contains lines that look like:\n" \ " hd[a-z][0-9]* 0:3 660\n\n" \ "That's device name (with regex match), uid:gid, and permissions.\n\n" \ - "Optionally, that can be followed (on the same line) by an asterisk\n" \ - "and a command line to run after creating the corresponding device(s),\n"\ - "ala:\n\n" \ - " hdc root:cdrom 660 *ln -s hdc cdrom\n\n" \ + USE_FEATURE_MDEV_EXEC( \ + "Optionally, that can be followed (on the same line) by a special character\n" \ + "and a command line to run after creating/before deleting the corresponding\n" \ + "device(s). The environment variable $MDEV indicates the active device node\n" \ + "(which is useful if it's a regex match). For example:\n\n" \ + " hdc root:cdrom 660 *ln -s $MDEV cdrom\n\n" \ + "The special characters are @ (run after creating), $ (run before deleting),\n" \ + "and * (run both after creating and before deleting). The commands run in\n" \ + "the /dev directory, and use system() which calls /bin/sh.\n\n" \ + ) \ "Config file parsing stops on the first matching line. If no config\n"\ "entry is matched, devices are created with default 0:0 660. (Make\n"\ - "the last line match .* to override this.)\n\n" -#endif + "the last line match .* to override this.)\n\n" \ +) #define mesg_trivial_usage \ "[y|n]" |