File: postinst

package info (click to toggle)
sendfile 2.1b.20080616-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,548 kB
  • ctags: 745
  • sloc: ansic: 13,128; sh: 3,885; perl: 851; makefile: 143; java: 36; csh: 3
file content (62 lines) | stat: -rw-r--r-- 1,587 bytes parent folder | download | duplicates (2)
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
#! /usr/bin/perl
# post install script for the Debian GNU/Linux sendfile package

require DebianNet;

# First modify the services file

open(SERVICES, "/etc/services");
    @services=<SERVICES>;
close(SERVICES);

if (! grep(/^saft.*/, @services)) {
   push (@services, "saft		487/tcp			# simple asynchronous file transfer\n");
   open(SERVICES, ">/etc/services.new");
   print SERVICES @services;
   close (SERVICES);
   system ("mv -f /etc/services.new /etc/services");
}

# Now modify the inetd.conf file

open(INETD, "/etc/inetd.conf");
@inetd=<INETD>;
close(INETD);

if (! grep(/.*sendfiled/, @inetd)) {
    $newentry = 'saft	stream	tcp	nowait	root	/usr/sbin/tcpd	/usr/sbin/sendfiled';
    $DebianNet::sep = "#<off># "; DebianNet::add_service($newentry, "OTHER");
}
undef(@inetd);

for $profile (('/etc/profile')) {
    open(PROFILE, "$profile");
    @profile=<PROFILE>;
    close(PROFILE);

    if (! grep(/^.*check-sendfile/, @profile)) {
	open(PROFILE, ">>$profile");
	print PROFILE "test -x /usr/bin/check-sendfile && /usr/bin/check-sendfile || /bin/true\n";
	close (PROFILE);
    }
}

for $profile (('/etc/csh.login')) {
    open(PROFILE, "$profile");
    @profile=<PROFILE>;
    close(PROFILE);

    if (grep(/^.*check-sendfile/, @profile)) {
	open(PROFILE, ">$profile");
	printf PROFILE "%s", join ('', grep (!/^.*check-sendfile/, @profile));
	close(PROFILE);
    }
}

system "/etc/init.d/netbase reload";

if ($ARGV[0] eq 'configure') {
    if (defined $ARGV[1] && $ARGV[1] =~ /2\.1b(-[67]|\.20080311-|\.20080616-1)/) {
	system "chmod 644 /etc/logrotate.d/sendfile";
    }
}