/[gentoo-x86]/sys-fs/udftools/files/pktcdvd.init
Gentoo

Contents of /sys-fs/udftools/files/pktcdvd.init

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Fri Oct 31 20:07:41 2008 UTC (5 years, 9 months ago) by dsd
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +15 -11 lines
Make pktcdvd initscript POSIX-compatible, patch from  Martin Väth in bug #192420
(Portage version: 2.2_rc12/cvs/Linux 2.6.27-gentoo-r2 i686)

1 #!/sbin/runscript
2 # Copyright 1999-2005 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License, v2
4 # $Header: /var/cvsroot/gentoo-x86/sys-fs/udftools/files/pktcdvd.init,v 1.1 2005/09/05 22:10:58 dsd Exp $
5
6 depend() {
7 need localmount modules
8 }
9
10 checkconfig() {
11 if ! [ -e /dev/pktcdvd/control ]; then
12 eerror "Could not find packet-writing control device at /dev/pktcdvd/control"
13 eerror "Please ensure that your kernel includes packet writing support,"
14 eerror "and if modular, ensure that the module is loaded."
15 return 1
16 fi
17 }
18
19 get_rw_devices() {
20 devices_raw=$(sed -re '/^drive name:/I!d; s/.*:\s+//' /proc/sys/dev/cdrom/info)
21 count=0
22 for i in $devices_raw; do
23 eval "devices_$count=\"\$i\""
24 count=$(( $count + 1 ))
25 done
26 devs=""
27
28 cdrw_caps=$(sed -re '/^Can write CD-RW:/I!d; s/.*:\s+//' /proc/sys/dev/cdrom/info)
29
30 count=0
31 for i in $cdrw_caps; do
32 [ "$i" -eq 1 ] && eval "devs=\"\$devs \$devices_$count\""
33 count=$(( $count + 1 ))
34 done
35
36 echo ${devs}
37 }
38
39 start() {
40 checkconfig || return 1
41
42 for i in $(get_rw_devices)
43 do
44 devnode="/dev/${i}"
45 [ -e "${devnode}" ] || continue
46
47 /usr/bin/pktsetup "${i}" "${devnode}" > /dev/null
48 [ -e "/dev/pktcdvd/${i}" ] || continue
49 chmod 660 "/dev/pktcdvd/${i}"
50 chgrp cdrw "/dev/pktcdvd/${i}"
51 done
52 }
53
54 stop() {
55 checkconfig || return 1
56
57 for i in $(get_rw_devices)
58 do
59 /usr/bin/pktsetup -d "${i}" > /dev/null
60 done
61 }

  ViewVC Help
Powered by ViewVC 1.1.20