summaryrefslogtreecommitdiff
path: root/dh_fixperms
blob: 0534549ccd8299d8a84db6a01c1ae130a435e0ac (plain)
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
#!/bin/sh -e
#
# Do some general file permission fixups.

PATH=debian:$PATH:/usr/lib/debhelper
. dh_lib

for PACKAGE in $DH_DOPACKAGES; do
	TMP=`tmpdir $PACKAGE`
	EXT=`pkgext $PACKAGE`

	# General things..
	if [ -d $TMP ]; then
		doit "chown -R root.root $TMP"
		doit "chmod -R go=rX $TMP"
	fi

	# Fix up premissions in usr/doc, setting everything to not exectable
	# by default, but leave examples directories alone.
	files=`find $TMP/usr/doc -type f 2>/dev/null | grep -v /examples/ | tr "\n" " "` || true
	if [ "$files" ]; then
		doit "chmod 644 $files"
	fi
	files=`find $TMP/usr/doc -type d 2>/dev/null | tr "\n" " "` || true
	if [ "$files" ]; then
		doit "chmod 755 $files"
	fi

	# Executable man pages are a bad thing.
	files=`find $TMP/usr/man/ $TMP/usr/X11*/man/ -type f 2>/dev/null | tr "\n" " "` || true
	if [ "$files" ]; then
		doit "chmod 644 $files"
	fi
done