3 # $Id: makedev.unet.in,v 1.1 2001/01/25 22:03:39 mdw Exp $
7 # (c) 1998 Mark Wooding
10 #----- Licensing notice -----------------------------------------------------
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; either version 2 of the License, or
15 # (at your option) any later version.
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write to the Free Software Foundation,
24 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 #----- Revision history -----------------------------------------------------
28 # $Id: makedev.unet.in,v 1.1 2001/01/25 22:03:39 mdw Exp $
30 # --- Configuration stuff ---
33 unet_transMinor
=@TRANSMINOR@
34 unet_persistent
=@NPERSIST@
37 # --- Sanity check ---
42 echo >&2 "$0: this program is Linux-specific" ;;
45 # --- Sort out command line arguments ---
47 while [ $# -gt
0 ]; do
51 # --- Help requests ---
53 -h|
-he|
-hel|
-help |
--h|
--he|
--hel|
--help)
55 makedev.unet [OPTIONS...]
57 Constructs usernet device nodes.
59 The usernet device allows userspace processes to process and distribute
60 network packets. See the Usernet manual for more details.
64 --help Display this help text.
65 -p, --persistent=NUM Configure NUM persistent unet devices.
66 -t, --transient=NUM Use minor device NUM for transient unets.
67 -M, --major=NUM Use major device NUM instead of $unet_major.
72 # --- Set number of persistent devices ---
74 -p |
--p|
--pe|
--per|
--pers|
--persi|
--persis|
--persist|\
75 --persiste|
--persisten|
--persistent
)
76 unet_persistent
="$1"; shift ;;
79 unet_persistent
="`echo "$opt" | cut -b 3-`" ;;
81 --p
=*|
--pe
=*|
--per
=*|
--pers
=*|
--persi
=*|
--persis
=*|
--persist
=*|\
82 --persiste
=*|
--persisten
=*|
--persistent
=*)
83 unet_persistent
="`echo "$opt" | sed -e "s
/^
[-a-z
]*=//"`" ;;
85 # --- Set transient minor device ---
87 -t |
--t|
--tr|
--tra|
--tran|
--trans|
--transi|
--transie|\
88 --transien|
--transient
)
89 unet_transMinor
="$1"; shift ;;
92 unet_transMinor
="`echo "$opt" | cut -b 3-`" ;;
94 --t
=*|
--tr=*|
--tra
=*|
--tran
=*|
--trans
=*|
--transi
=*|
--transie
=*|\
95 --transien
=*|
--transient
=*)
96 unet_transMinor
="`echo "$opt" | sed -e "s
/^
[-a-z
]*=//"`" ;;
98 # --- Set major number (caution!) ---
100 -M |
--ma|
--maj|
--majo|
--major
)
101 unet_major
="$1"; shift ;;
104 unet_major
="`echo "$opt" | cut -b 3-`" ;;
106 --ma
=*|
--maj
=*|
--majo
=*|
--major
=*)
107 unet_major
="`echo "$opt" | sed -e "s
/^
[-a-z
]*=//"`" ;;
109 # --- Set default mode ---
111 -m |
--m|
--mo|
--mod|
--mode
)
112 unet_mode
="$1"; shift ;;
115 unet_mode
="`echo "$opt" | cut -b 3-`" ;;
117 --m
=*|
--mo
=*|
--mod
=*|
--mode
=*)
118 unet_mode
="`echo "$opt" | sed -e "s
/^
[-a-z
]*=//"`" ;;
120 # --- Unknown option ---
123 echo >&2 "$0: unknown option $opt"; exit 1 ;;
128 # --- Do the stuff ---
131 if [ "$unet_persistent" -gt
0 ]; then
133 while [ "$i" -lt
"$unet_persistent" ]; do
134 mknod
-m
"$unet_mode" /dev
/unet
$i c
"$unet_major" $i
138 mknod
-m
"$unet_mode" /dev
/unet c
"$unet_major" "$unet_transMinor"