4
# Call pktsetup to set up packet device associations
6
# Written and Copyright 2003 Richard Atterer <atterer<at>debian.org>, GPLv2.
7
# * Thanks to Aleksandar Topuzovic <aleksandar.topuzovic<at>fer.hr> for an
8
# initial version of the script.
9
# * Thanks to Cyrille Ch�p�lov <cyrille<at>chepelov.org> for additional
10
# help with the specifics of 2.6 packet writing.
11
# * Thanks to Christopher Martin <christopher.martin<at>utoronto.ca>
12
# for fixes to make things work on systems that have "no udev + new
13
# interface" or "udev + old interface"
17
# Required-Start: $remote_fs
18
# Required-Stop: $remote_fs
19
# Default-Start: 2 3 4 5
21
# Short-Description: Set up packet writing devices
22
# Description: Set up packet writing devices, i.e. tell the kernel that
23
# e.g. device /dev/hdc is to be made available as packet
24
# writing device /dev/pktcdvd/0.
29
PATH=/sbin:/bin:/usr/sbin:/usr/bin
30
DESC="udftools packet writing"
31
PKTSETUP=/usr/bin/pktsetup
32
DEFAULTFILE=/etc/default/udftools
35
UDEVNAMES="/dev/pktcdvd/0 /dev/pktcdvd/1 /dev/pktcdvd/2 /dev/pktcdvd/3"
39
if test -e /dev/.devfsd; then
40
OLDINTNAMES="/dev/pktcdvd/0 /dev/pktcdvd/1 /dev/pktcdvd/2 /dev/pktcdvd/3"
42
OLDINTNAMES="/dev/pktcdvd0 /dev/pktcdvd1 /dev/pktcdvd2 /dev/pktcdvd3"
45
if test -f "$DEFAULTFILE"; then
49
test -x "$PKTSETUP" || exit 0
51
# Only execute modprobe if DEVICES set - avoid possible problems with
52
# the module for people who don't use packet writing.
53
if test -n "$DEVICES"; then
54
modprobe --quiet pktcdvd || true
55
if test -z "$NEWINT"; then # User did not set NEWINT, try auto-detection
56
if dpkg --compare-versions `uname -r` ge 2.6.8; then
62
if test -z "$UDEV"; then # User did not set UDEV, try auto-detection
63
if test -e /dev/.udev; then
72
if test -z "$DEVICES"; then
73
echo "Not starting $DESC: No devices listed in $DEFAULTFILE"
75
echo "Starting $DESC:"
78
for DEVICE in $DEVICES; do
79
echo -n "/dev/pktcdvd/$1=$DEVICE " || true
80
$PKTSETUP "$1" "$DEVICE"
89
for DEVICE in $DEVICES; do
90
echo -n "$1=$DEVICE " || true
91
$PKTSETUP "$1" "$DEVICE"
100
if test -z "$DEVICES"; then
101
echo "Not stopping $DESC: No devices listed in $DEFAULTFILE"
103
echo "Stopping $DESC:"
106
for DEVICE in $DEVICES; do
107
echo -n "/dev/pktcdvd/$1=$DEVICE " || true
108
$PKTSETUP -d "$1" || true
117
for DEVICE in $DEVICES; do
118
echo -n "$1=$DEVICE " || true
119
$PKTSETUP -d "$1" || true
130
restart|force-reload) dostop; dostart;;
132
nmappings=`$PKTSETUP -s | wc -l`
133
echo "Status of $DESC: $nmappings device mappings"
134
if test $nmappings -eq 0; then exit 1; fi
137
echo "Usage: /etc/init.d/udftools {start|stop|restart|force-reload}" >&2