1
0
mirror of https://github.com/rancher/os.git synced 2025-07-19 09:26:27 +00:00
os/files/usr/bin/finalize
2021-06-16 01:52:08 -07:00

51 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
set -e -o pipefail
packages="openSUSE-release-appliance-docker
systemd-presets-branding-MicroOS
dracut
rpm-config-SUSE
openSUSE-release-15.3
openSUSE-build-key"
packages="$packages $(zypper rm --details -D -u -y zypper | grep '^[a-z]' | grep -v procps)"
echo Removing $packages
rpm --nodeps -v -e $packages 2>&1 | grep -v LC_MESSAGES
echo Removing zypper data
rm -rf /etc/zypp \
/var/cache/zypp \
/var/log/zypp \
/var/lib/zypp
echo Removing luet metadata
rm -rf /var/cache/luet \
/var/luet \
/etc/luet
echo Removing rpm
rpm --nodeps -v -e rpm 2>&1 | grep -v LC_MESSAGES
rm -rf /usr/lib/rpm \
/usr/lib/sysimage/rpm \
/etc/rpm
echo Removing extra kernel weight
rm -rf /boot/vmlinux*
if ! command -v man >/dev/null; then
echo Removing man pages
find /usr/share/man -type f -exec rm {} \;
fi
if [ -e /usr/lib/os-release.tmpl ]; then
echo Setting up /etc/os-release
export OS_NAME=${OS_NAME:-NoNameOS} OS_VERSION="${OS_VERSION:-0.0.0}" OS_GIT="${OS_GIT:-HEAD}"
cat /usr/lib/os-release.tmpl | envsubst > /usr/lib/os-release
rm /usr/lib/os-release.tmpl
ln -sf ../usr/lib/os-release /etc/os-release
fi
echo Removing self
rm /usr/bin/finalize