PACKAGES := $(shell cat common-tools)

all:
	echo OK

upgrade:
	dnf check-update
	dnf update -y

update-gpg-keys:
	rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux
	curl "https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinu" -o "/etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux.in" && mv "/etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux.in" "/etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux"

install-common-tools:
	dnf check-update
	echo $(PACKAGES)
	dnf install -y $(PACKAGES)

sysprep:
	dnf clean all
	cloud-init clean
	echo -n "" > /etc/machine-id

cleanup-old-kernels:
	dnf remove -y --oldinstallonly --setopt installonly_limit=2 kernel
