File: post_setup_disable_usr_share_doc

package info (click to toggle)
piuparts 0.62
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 1,692 kB
  • sloc: python: 6,823; sh: 2,194; makefile: 126
file content (30 lines) | stat: -rwxr-xr-x 885 bytes parent folder | download | duplicates (3)
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
#!/bin/sh
set -e

case ${PIUPARTS_OBJECTS%%=*} in
	dpkg)
		# skip while creating the tarball
		exit 0
		;;
esac

# clear out /usr/share/doc
# but keep the directories (and symlinks) as well as the copyright files
cat << EOF > /etc/dpkg/dpkg.cfg.d/piuparts-path-exclude
path-exclude=/usr/share/doc/*/*
path-include=/usr/share/doc/*/copyright
EOF

# switching init systems forth and back will clean out /usr/share/doc
# reinstalling the affected packages beforehand makes the files disappear
# before the snapshot of the reference system is created
CANDIDATES="systemd systemd-sysv sysv-rc"
CANDIDATES=$(dpkg-query -W $CANDIDATES | awk '{ if ($2) { print $1 } }')
if [ -n "$CANDIDATES" ]; then
	echo "Reinstalling $(echo $CANDIDATES)..."
	# workaround apt bug #770291 - do it one by one, not all at once
	for package in $CANDIDATES
	do
		apt-get -u --reinstall install $package
	done
fi