File: preproto.pl.in

package info (click to toggle)
nut 2.8.3-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 24,356 kB
  • sloc: ansic: 123,904; sh: 14,718; cpp: 12,558; makefile: 5,212; python: 1,114; perl: 855; xml: 47
file content (39 lines) | stat: -rwxr-xr-x 1,291 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
#!/usr/bin/env perl

$temp = "prototype1";
$prototype="prototype";
$pkginfo = "pkginfo";
$checkinstall = "checkinstall";
$preinstall = "preinstall";
$postinstall = "postinstall";
$preremove = "preremove";
$postremove = "postremove";
$nutuser = "@RUN_AS_USER@";
$nutgroup = "@RUN_AS_GROUP@";

open (PREPROTO,"< $temp") || die "Unable to read prototype information ($!)\n";
open (PROTO,"> $prototype") || die "Unable to write file prototype ($!)\n";
print PROTO "i pkginfo=./$pkginfo\n";
print PROTO "i checkinstall=./$checkinstall\n";
print PROTO "i preinstall=./$preinstall\n";
print PROTO "i postinstall=./$postinstall\n";
print PROTO "i preremove=./$preremove\n";
print PROTO "i postremove=./$postremove\n";
while (<PREPROTO>) {
	# Read the prototype information from /tmp/prototype$$
	chomp;
	$thisline = $_;
	if ($thisline =~ " prototype1 ") {
	  # We don't need that line
	} elsif ($thisline =~ "^[fd] ") {
	  # Change the ownership for files and directories
	  ($dir, $none, $file, $mode, $user, $group) = split / /,$thisline;
	  print PROTO "$dir $none $file=$file $mode $nutuser $nutgroup\n";
	} else {
	  # Symlinks and other stuff should be printed as well ofcourse
	  print PROTO "$thisline\n";
	}
}
#print PROTO "f $none nut $mode root $nutgroup\n";
close PROTO;
close PREPROTO;