1
0
mirror of https://github.com/home-assistant/operating-system.git synced 2025-12-20 02:18:37 +00:00
Files
operating-system/buildroot-external/scripts/rootfs-layer.sh
Jan Čermák 8531e7b57d Remove all info pages in post-build script (#3888)
As we don't have the info utility in HAOS, it's worthless to preserve info
pages. While there are currently some files in /share/info (coming from GRUB2
tools install), /usr/share/info was added pre-emptively.
2025-02-20 17:50:38 +01:00

48 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
function fix_rootfs() {
# Cleanup etc
rm -rf "${TARGET_DIR:?}/etc/init.d"
rm -rf "${TARGET_DIR:?}/etc/network"
rm -rf "${TARGET_DIR:?}/etc/X11"
rm -rf "${TARGET_DIR:?}/etc/xdg"
# Cleanup root
rm -rf "${TARGET_DIR:?}/media"
rm -rf "${TARGET_DIR:?}/srv"
rm -rf "${TARGET_DIR:?}/opt"
# Remove info pages
rm -rf "${TARGET_DIR:?}/share/info"
rm -rf "${TARGET_DIR:?}/usr/share/info"
# Cleanup miscs
rm -rf "${TARGET_DIR}/usr/lib/modules-load.d"
# systemd-update-done.service relies on writeable /var and /etc
rm -f "${TARGET_DIR}/usr/lib/systemd/system/sysinit.target.wants/systemd-update-done.service"
# Fix: tempfs with /srv
sed -i "/srv/d" "${TARGET_DIR}/usr/lib/tmpfiles.d/home.conf"
# Fix: Could not generate persistent MAC address
sed -i "s/MACAddressPolicy=persistent/MACAddressPolicy=none/g" "${TARGET_DIR}/usr/lib/systemd/network/99-default.link"
# Use systemd-resolved for Host OS resolve
sed -i '/^hosts:/ {/resolve/! s/files/resolve [!UNAVAIL=return] files/}' "${TARGET_DIR}/etc/nsswitch.conf"
# Remove unnecessary grub userspace tools, config, modules and translations
find "${TARGET_DIR}"/usr/{,s}bin -name "grub-*" -not -name "grub-editenv" -delete
rm -rf "${TARGET_DIR}/etc/grub.d"
rm -rf "${TARGET_DIR}/usr/lib/grub"
if [ -d "${TARGET_DIR}/share/locale" ]; then
find "${TARGET_DIR}/share/locale" -name "grub.mo" -delete
find "${TARGET_DIR}/share/locale" -type d -empty -delete
fi
}
function install_tini_docker() {
ln -fs /usr/bin/tini "${TARGET_DIR}/usr/bin/docker-init"
}