3 # Do some general file permission fixups.
5 BEGIN { push @INC, "debian", "/usr/share/debhelper" }
9 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
10 $TMP=tmpdir($PACKAGE);
12 if (! defined($dh{EXCLUDE_FIND}) || $dh{EXCLUDE_FIND} eq '') {
16 $find_options="! \\( $dh{EXCLUDE_FIND} \\)";
19 # General permissions fixing.
20 complex_doit("find $TMP ! -type l $find_options -print0",
21 "2>/dev/null | xargs -0r chown root.root");
22 complex_doit("find $TMP ! -type l $find_options -print0",
23 "2>/dev/null | xargs -0r chmod go=rX,u+rw,a-s");
26 # Fix up premissions in usr/share/doc, setting everything to not
27 # executable by default, but leave examples directories alone.
28 complex_doit("find $TMP/usr/share/doc $TMP/usr/doc -type f $find_options ! -regex '.*/examples/.*' -print0",
29 "2>/dev/null | xargs -0r chmod 644");
30 complex_doit("find $TMP/usr/share/doc $TMP/usr/doc -type d $find_options -print0",
31 "2>/dev/null | xargs -0r chmod 755");
33 # Executable man pages are a bad thing..
34 complex_doit("find $TMP/usr/share/man $TMP/usr/man/ $TMP/usr/X11*/man/ -type f",
35 "$find_options -print0 2>/dev/null | xargs -0r chmod 644");
37 # ..and so are executable shared and static libraries
38 # (and .la files from libtool)
39 complex_doit("find $TMP -perm -5 -type f",
40 "\\( -name '*.so*' -or -name '*.la' -or -name '*.a' \\) $find_options -print0",
41 "2>/dev/null | xargs -0r chmod a-X");