@@ -1,98 +1,105 | |||
|
1 | 1 | # |
|
2 | 2 | # Reduce system disk usage |
|
3 | 3 | # |
|
4 | 4 | |
|
5 | 5 | # Load utility functions |
|
6 | 6 | . ./functions.sh |
|
7 | 7 | |
|
8 | 8 | if [ "$ENABLE_IPV6" = false ] ; then |
|
9 | 9 | "$LIB_DIR"/xtables/libip6t_ah.so |
|
10 | 10 | "$LIB_DIR"/xtables/libip6t_dst.so |
|
11 | 11 | "$LIB_DIR"/xtables/libip6t_eui64.so |
|
12 | 12 | "$LIB_DIR"/xtables/libip6t_frag.so |
|
13 | 13 | "$LIB_DIR"/xtables/libip6t_hbh.so |
|
14 | 14 | "$LIB_DIR"/xtables/libip6t_hl.so |
|
15 | 15 | "$LIB_DIR"/xtables/libip6t_HL.so |
|
16 | 16 | "$LIB_DIR"/xtables/libip6t_icmp6.so |
|
17 | 17 | "$LIB_DIR"/xtables/libip6t_ipv6header.so |
|
18 | 18 | "$LIB_DIR"/xtables/libip6t_LOG.so |
|
19 | 19 | "$LIB_DIR"/xtables/libip6t_mh.so |
|
20 | 20 | "$LIB_DIR"/xtables/libip6t_REJECT.so |
|
21 | 21 | "$LIB_DIR"/xtables/libip6t_rt.so |
|
22 | 22 | "$LIB_DIR"/xtables/libip6t_DNAT.so |
|
23 | 23 | "$LIB_DIR"/xtables/libip6t_DNPT.so |
|
24 | 24 | "$LIB_DIR"/xtables/libip6t_MASQUERADE.so |
|
25 | 25 | "$LIB_DIR"/xtables/libip6t_NETMAP.so |
|
26 | 26 | "$LIB_DIR"/xtables/libip6t_REDIRECT.so |
|
27 | 27 | "$LIB_DIR"/xtables/libip6t_SNAT.so |
|
28 | 28 | "$LIB_DIR"/xtables/libip6t_SNPT.so |
|
29 | 29 | fi |
|
30 | 30 | # Reduce the image size by various operations |
|
31 | 31 | if [ "$ENABLE_REDUCE" = true ] ; then |
|
32 | 32 | if [ "$REDUCE_APT" = true ] ; then |
|
33 | 33 | # Install dpkg configuration file |
|
34 | 34 | if [ "$REDUCE_DOC" = true ] || [ "$REDUCE_MAN" = true ] ; then |
|
35 | 35 | install_readonly files/dpkg/01nodoc "${ETC_DIR}/dpkg/dpkg.cfg.d/01nodoc" |
|
36 | 36 | fi |
|
37 | 37 | |
|
38 | 38 | # Install APT configuration files |
|
39 | 39 | install_readonly files/apt/02nocache "${ETC_DIR}/apt/apt.conf.d/02nocache" |
|
40 | 40 | install_readonly files/apt/03compress "${ETC_DIR}/apt/apt.conf.d/03compress" |
|
41 | 41 | install_readonly files/apt/04norecommends "${ETC_DIR}/apt/apt.conf.d/04norecommends" |
|
42 | 42 | |
|
43 | 43 | # Remove APT cache files |
|
44 | 44 | rm -fr "${R}/var/cache/apt/pkgcache.bin" |
|
45 | 45 | rm -fr "${R}/var/cache/apt/srcpkgcache.bin" |
|
46 | 46 | fi |
|
47 | 47 | |
|
48 | 48 | # Remove all doc files |
|
49 | 49 | if [ "$REDUCE_DOC" = true ] ; then |
|
50 | 50 | find "${R}/usr/share/doc" -depth -type f ! -name copyright -print0 | xargs -0 rm || true |
|
51 | 51 | find "${R}/usr/share/doc" -empty -print0 | xargs -0 rmdir || true |
|
52 | 52 | fi |
|
53 | 53 | |
|
54 | 54 | # Remove all man pages and info files |
|
55 | 55 | if [ "$REDUCE_MAN" = true ] ; then |
|
56 | 56 | rm -rf "${R}/usr/share/man" "${R}/usr/share/groff" "${R}/usr/share/info" "${R}/usr/share/lintian" "${R}/usr/share/linda" "${R}/var/cache/man" |
|
57 | 57 | fi |
|
58 | 58 | |
|
59 | 59 | # Remove all locale translation files |
|
60 | 60 | if [ "$REDUCE_LOCALE" = true ] ; then |
|
61 | 61 | find "${R}/usr/share/locale" -mindepth 1 -maxdepth 1 ! -name 'en' -print0 | xargs -0 rm -r |
|
62 | 62 | fi |
|
63 | 63 | |
|
64 | 64 | # Remove hwdb PCI device classes (experimental) |
|
65 | 65 | if [ "$REDUCE_HWDB" = true ] ; then |
|
66 | 66 | rm -fr "/lib/udev/hwdb.d/20-pci-*" |
|
67 | 67 | fi |
|
68 | 68 | |
|
69 | 69 | # Replace bash shell by dash shell (experimental) |
|
70 | 70 | if [ "$REDUCE_BASH" = true ] ; then |
|
71 | 71 | # Purge bash and update alternatives |
|
72 | 72 | echo "Yes, do as I say!" | chroot_exec apt-get purge -qq -y --allow-remove-essential bash |
|
73 | 73 | chroot_exec update-alternatives --install /bin/bash bash /bin/dash 100 |
|
74 | 74 | fi |
|
75 | 75 | |
|
76 | 76 | # Remove sound utils and libraries |
|
77 | 77 | if [ "$ENABLE_SOUND" = false ] ; then |
|
78 | if [ "$ENABLE_BLUETOOTH" = false ] ; then | |
|
78 | 79 |
|
|
80 | else | |
|
81 | chroot_exec apt-get -qq -y purge alsa-utils libsamplerate0 | |
|
82 | fi | |
|
79 | 83 | fi |
|
80 | 84 | |
|
81 | 85 | # Remove GPU kernels |
|
82 | 86 | if [ "$ENABLE_MINGPU" = true ] ; then |
|
83 | 87 | rm -f "${BOOT_DIR}/start.elf" |
|
84 | 88 | rm -f "${BOOT_DIR}/fixup.dat" |
|
85 | 89 | rm -f "${BOOT_DIR}/start_x.elf" |
|
86 | 90 | rm -f "${BOOT_DIR}/fixup_x.dat" |
|
87 | 91 | fi |
|
88 | 92 | |
|
89 | 93 | # Remove kernel and initrd from /boot (already in /boot/firmware) |
|
90 | 94 | if [ "$BUILD_KERNEL" = false ] ; then |
|
91 | 95 | rm -f "${R}/boot/vmlinuz-*" |
|
92 | 96 | rm -f "${R}/boot/initrd.img-*" |
|
93 | 97 | fi |
|
94 | 98 | |
|
99 | #Reduce BOOT | |
|
100 | #Only necessary files for my gen pi | |
|
101 | ||
|
95 | 102 | # Clean APT list of repositories |
|
96 | 103 | rm -fr "${R}/var/lib/apt/lists/*" |
|
97 | 104 | chroot_exec apt-get -qq -y update |
|
98 | 105 | fi |
General Comments 0
Vous devez vous connecter pour laisser un commentaire.
Se connecter maintenant