File: postinst

package info (click to toggle)
x10 1.06-4
  • links: PTS
  • area: main
  • in suites: potato
  • size: 100 kB
  • ctags: 69
  • sloc: ansic: 755; perl: 42; makefile: 39
file content (47 lines) | stat: -rw-r--r-- 1,244 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/perl

$|=1;

$v = shift @ARGV;

if ($v eq "configure") {
    if (-d "/usr/doc" && ! -e "/usr/doc/x10" && -d "/usr/share/doc/x10") {
	system("ln -sf ../share/doc/x10 /usr/doc/x10");
    }
}

if ( ! ( -e "/dev/x10" || -l "/dev/x10" ) ) {
	print "Now installing the X-10 power module control program.\n";
	print "If you have an X-10 CP-290 controller connected to your system,\n";
	print "You can give the name of the serial port that it is connected to,\n";
	print "and that port will be linked to /dev/x10 where the program will\n";
	print "find it. For example, the first serial port on your system is\n";
	print "named \"/dev/ttyS0\".\n";
	print "If you don't want to do this, just press Enter.\n";
	for ( ; ; ) {
		print "\nEnter the serial device for the X-10 CP-290 controller: ";
		chop($serial=<STDIN>);
		if ( $serial =~ /^$/ ) {
			exit(0);
		}
		else {
			if ( ! -e $serial ) {
				print $serial, " does not exist.\n";
			}
			else {
				if ( ! -c $serial ) {
					print $serial, " doesn't look like a serial port.\n";
				}
				else {
					if  ( symlink($serial, "/dev/x10") < 0 ) {
						print "Failed to link ", $serial, "to /dev/x10: ", ($!), ".\n";
					}
					else {
						exit(0);
					}
				}
			}
		}
	}
}
exit(0);