nut-debian/scripts/Solaris/preproto.pl.in

40 lines
1.3 KiB
Perl
Raw Normal View History

2022-07-10 10:23:45 +03:00
#!/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;