removing deprecated reference to mlocate
[tails.git] / config / chroot_local-hooks / 98-remove_unwanted_packages
blob372325c290e586e82bf2452d31aa14785064fbf7
1 #!/bin/sh
3 set -e
5 # Import is_package_installed
6 . /usr/local/lib/tails-shell-library/common.sh
8 echo "Removing unwanted packages"
10 ### Deinstall dev packages.
12 # We use apt-get as aptitude doesn't know about globs.
13 # There are packages we could be tempted to remove but we can't:
14 # - gcc-*-base (libstdc++6 depends on it)
15 # - libgcc1 (apt depends on it)
16 # - cpp, cpp-* (big parts of GNOME depend on it)
17 apt-get --yes purge \
18 '^binutils*' \
19 build-essential \
20 debhelper \
21 dh-autoreconf \
22 dpkg-dev \
23 fakeroot \
24 gcc \
25 '^gcc-[0-9]+$' \
26 gdbm-l10n \
27 libc-dev-bin \
28 libc6-dev \
29 '^libgcc-[0-9]+-dev$' \
30 libtool \
31 linux-libc-dev \
32 make
34 ### Deinstall a few unwanted packages that were pulled by tasksel
35 ### since they have Priority: standard.
36 apt-get --yes purge \
37 m4 \
38 nfs-common \
39 texinfo
41 ### We'll remove packages listed in this variable. It's purpose is to
42 ### gather *several* packages we might want to remove below and purge
43 ### then at the same time, which has less overhead than purging them
44 ### one at a time.
45 packages_to_purge=""
47 ### Remove packages that can get a different priority in the security
48 ### archive (see https://bugs.debian.org/867668).
49 for package in mutt rpcbind tcpd ; do
50 if is_package_installed "${package}"; then
51 packages_to_purge="${packages_to_purge} ${package}"
53 done
55 ### Remove unwanted packages that might, or might not,
56 ### have been installed during the build.
57 for package in gcc-7 libgcc-7-dev procmail; do
58 if is_package_installed "${package}"; then
59 packages_to_purge="${packages_to_purge} ${package}"
61 done
63 if [ -n "${packages_to_purge}" ]; then
64 apt-get --yes purge "${packages_to_purge}"
67 ### Deinstall some other unwanted packages.
68 apt-get --yes purge \
69 '^aptitude*' \
70 live-build \
71 localepurge \
72 tasksel \
73 tasksel-data
75 ### Deinstall some other unwanted packages whose regexp might not be match
76 ### anything when building with partial, tagged APT snapshots.
77 if dpkg --get-selections | grep -qs -E '^geoclue'; then
78 apt-get --yes purge '^geoclue*'
80 if dpkg --get-selections | grep -qs -E '^exim4'; then
81 apt-get --yes purge '^exim4*'
84 ### Deinstall dependencies of the just removed packages.
85 apt-get --yes --purge autoremove