docker-devuan_paddy-hack/scripts-slim/tweak-dpkg-config

38 lines
782 B
Bash

#!/bin/sh -eu
# tweak-dpkg-config -- for use in a Docker image
# Copyright (C) 2017 Olaf Meeuwissen
#
# License: GPL-3.0+
cfg=/etc/dpkg/dpkg.cfg.d
cat > $cfg/docker-excludes <<EOF
path-exclude=/usr/share/doc/*
EOF
chmod 0644 $cfg/docker-excludes
cat > $cfg/docker-includes <<EOF
path-include=/usr/share/doc/*/copyright
EOF
chmod 0644 $cfg/docker-includes
# Retro-actively apply the above on what's already installed.
find /usr/share/doc/* -type f ! -name copyright -delete
find /usr/share/doc/* -empty -delete
for dir in \
/usr/share/groff \
/usr/share/info \
/usr/share/linda \
/usr/share/lintian \
/usr/share/locale \
/usr/share/man \
; do
cat >> $cfg/docker-excludes <<EOF
path-exclude=$dir/*
EOF
find $dir/* -delete || true
done
rm $0