File: setperms.sh.in

package info (click to toggle)
courier 1.0.6-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 49,084 kB
  • sloc: ansic: 126,176; cpp: 24,278; sh: 8,957; perl: 4,127; makefile: 3,192; sed: 16
file content (49 lines) | stat: -rw-r--r-- 931 bytes parent folder | download | duplicates (8)
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
#! @SHELL@
#
# Copyright 1998 - 2004 Double Precision, Inc.  See COPYING for
# distribution information.
#
# setperms automatically generated from setperms.in

${MAKE} install-perms || exit 1
cd ../courier

./perms.sh >install-perms-list.dat || exit 1

@PERL@ -e '

	$root="'$1'";

	while (<>)
	{
		chomp;
		($FILE, $MODE, $USERID, $GROUPID, $SPECIAL)=split (/[ \t]+/);

		next if $FILE eq "";
		$FILE="$root$FILE";

		print "chown $USERID $FILE\n";
		print "chgrp $GROUPID $FILE\n";
		print "chmod $MODE $FILE\n";

		next if -l $FILE;

		if (-w "/etc")
		{
			$uid=getpwnam($USERID);
			die "$USERID: not found.\n"
				unless defined $uid;

			$gid=getgrnam($GROUPID);
			die "$GROUPID: not found.\n"
				unless defined $gid;

			chown ($uid, $gid, $FILE) || die "chown $FILE: $!\n";
		}

		$MODE= oct($MODE);
		chmod ($MODE, $FILE) || die "chmod $FILE: $!\n";
	}
	exit (0);
' <install-perms-list.dat
rm -f install-perms-list.dat