File: voldconfig%2Cv

package info (click to toggle)
vold 1.1-9
  • links: PTS
  • area: main
  • in suites: potato
  • size: 112 kB
  • ctags: 66
  • sloc: cpp: 508; makefile: 56; sh: 31; perl: 16
file content (153 lines) | stat: -rw-r--r-- 2,502 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
head	1.4;
access;
symbols;
locks; strict;
comment	@# @;


1.4
date	98.02.15.09.53.30;	author david;	state Exp;
branches;
next	1.3;

1.3
date	98.02.15.09.04.44;	author david;	state Exp;
branches;
next	1.2;

1.2
date	98.01.26.20.53.27;	author david;	state Exp;
branches;
next	1.1;

1.1
date	98.01.26.20.50.29;	author david;	state Exp;
branches;
next	;


desc
@@


1.4
log
@Cosmetic changes in questions.
@
text
@#!/usr/bin/perl

# voldconfig.  (c) 1998 David A. van Leeuwen
# configure /etc/voltab
# $Id: voldconfig,v 1.3 1998/02/15 09:04:44 david Exp david $

$|=1;
$VOLTAB = "/etc/voltab";
$FSTAB = "/etc/fstab";

$arg = shift;
$force = $arg eq "--force";

if (-e $VOLTAB) {
    if (!$force) {
	print "  Already existing $VOLTAB found.
  Do you want to reconfigure $VOLTAB anyway? [y/N] ";
	$in=<stdin>;
	if ($in !~ /^[yY]/) {
	    exit (-1);
	}
    }
}

open OUT, ">$VOLTAB" or die "  Sorry, I can't open $VOLTAB\n";

if (-e $FSTAB) {
    open IN, "grep iso9660  $FSTAB |";
    while (<IN>) {
	($device, $mountpoint, $type, $options, $freq, $passno)=split " ";
	print "    Found device $device in $FSTAB, add entry for use with vold? ";
	$in = <stdin>;
	if ($in =~ /^[yY]/) {
	    print OUT "$device\t/cdrom\tiso9660\t$options\t0\t0\n";
	}
    }
} else {
    do {
	print "    What is the device of your CDROM player? ";
	$dev=<stdin>;
	if ($dev !~ m|^/dev/|) {
	    $dev = "/dev/".$in;
	}
	if (! -e $dev) {
	    print "    Sorry, but $dev seems not to exist\n";
	} else {
	    print OUT "$dev\t/cdrom\tiso9660\tnoexec,ro\t0\t0\n";
	}
	print "    Do you want to add more CDROM devices? ";
	$in = <stdin>;
    } while ($in =~ /^[yY]/);
}
close OUT;
print "  $VOLTAB is now configured.\n";

exit 0;

@


1.3
log
@Rephrased question.
@
text
@d5 1
a5 1
# $Id: voldconfig,v 1.2 1998/01/26 20:53:27 david Exp david $
d16 2
a17 2
	print "Already existing $VOLTAB found.
Do you want to reconfigure $VOLTAB anyway? [y/N] ";
d25 1
a25 1
open OUT, ">$VOLTAB" or die "Sorry, I can't open $VOLTAB\n";
d31 1
a31 1
	print "Found device $device in $FSTAB, add entry for use with vold? ";
d39 1
a39 1
	print "What is the device of your CDROM player? ";
d45 1
a45 1
	    print "Sorry, but $dev seems not to exist\n";
d49 1
a49 1
	print "Do you want to add more CDROM devices? ";
d54 1
a54 1
print "$VOLTAB is now configured.\n";
@


1.2
log
@$Id$ added
@
text
@d5 1
a5 1
# $Id$
d16 2
a17 1
	print "Already existing $VOLTAB found, do you want to continue? ";
@


1.1
log
@Initial revision
@
text
@d5 1
a5 1
# $Version$
@