diff options
author | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-06-26 14:11:33 +0000 |
---|---|---|
committer | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-06-26 14:11:33 +0000 |
commit | 8f10d19d6a9ff193c18167b7b3019437a2334fde (patch) | |
tree | bd1ee024e81262ec2485c4d5f391ef910d85bd38 /include/usage.h | |
parent | c09c0ceca18b494288b9c1d81e24affd7a332415 (diff) | |
download | busybox-w32-8f10d19d6a9ff193c18167b7b3019437a2334fde.tar.gz busybox-w32-8f10d19d6a9ff193c18167b7b3019437a2334fde.tar.bz2 busybox-w32-8f10d19d6a9ff193c18167b7b3019437a2334fde.zip |
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.
git-svn-id: svn://busybox.net/trunk/busybox@15515 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'include/usage.h')
-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( \ | |||
1799 | "\t-s\tScan /sys and populate /dev during system boot\n\n" \ | 1799 | "\t-s\tScan /sys and populate /dev during system boot\n\n" \ |
1800 | "Called with no options (via hotplug) it uses environment variables\n" \ | 1800 | "Called with no options (via hotplug) it uses environment variables\n" \ |
1801 | "to determine which device to add/remove." | 1801 | "to determine which device to add/remove." |
1802 | #ifdef CONFIG_FEATURE_MDEV_CONFIG | 1802 | #define mdev_notes_usage "" \ |
1803 | #define mdev_notes_usage \ | 1803 | USE_FEATURE_MDEV_CONFIG( \ |
1804 | "The mdev config file contains lines that look like:\n" \ | 1804 | "The mdev config file contains lines that look like:\n" \ |
1805 | " hd[a-z][0-9]* 0:3 660\n\n" \ | 1805 | " hd[a-z][0-9]* 0:3 660\n\n" \ |
1806 | "That's device name (with regex match), uid:gid, and permissions.\n\n" \ | 1806 | "That's device name (with regex match), uid:gid, and permissions.\n\n" \ |
1807 | "Optionally, that can be followed (on the same line) by an asterisk\n" \ | 1807 | USE_FEATURE_MDEV_EXEC( \ |
1808 | "and a command line to run after creating the corresponding device(s),\n"\ | 1808 | "Optionally, that can be followed (on the same line) by a special character\n" \ |
1809 | "ala:\n\n" \ | 1809 | "and a command line to run after creating/before deleting the corresponding\n" \ |
1810 | " hdc root:cdrom 660 *ln -s hdc cdrom\n\n" \ | 1810 | "device(s). The environment variable $MDEV indicates the active device node\n" \ |
1811 | "(which is useful if it's a regex match). For example:\n\n" \ | ||
1812 | " hdc root:cdrom 660 *ln -s $MDEV cdrom\n\n" \ | ||
1813 | "The special characters are @ (run after creating), $ (run before deleting),\n" \ | ||
1814 | "and * (run both after creating and before deleting). The commands run in\n" \ | ||
1815 | "the /dev directory, and use system() which calls /bin/sh.\n\n" \ | ||
1816 | ) \ | ||
1811 | "Config file parsing stops on the first matching line. If no config\n"\ | 1817 | "Config file parsing stops on the first matching line. If no config\n"\ |
1812 | "entry is matched, devices are created with default 0:0 660. (Make\n"\ | 1818 | "entry is matched, devices are created with default 0:0 660. (Make\n"\ |
1813 | "the last line match .* to override this.)\n\n" | 1819 | "the last line match .* to override this.)\n\n" \ |
1814 | #endif | 1820 | ) |
1815 | 1821 | ||
1816 | #define mesg_trivial_usage \ | 1822 | #define mesg_trivial_usage \ |
1817 | "[y|n]" | 1823 | "[y|n]" |