#!/bin/sh

set -eux

ARCH="$(uname -m)"
EXTRA_PACKAGES="https://raw.githubusercontent.com/pkgforge-dev/Anylinux-AppImages/refs/heads/main/useful-tools/get-debloated-pkgs.sh"

pacman -Syu --noconfirm \
	base-devel       \
	curl             \
	git              \
	djvulibre        \
	jbigkit          \
	libjpeg-turbo    \
	libjxl           \
	libraw           \
	libtiff          \
	libultrahdr      \
	libwebp          \
	libwmf           \
	libzip           \
	openexr          \
	openjpeg2        \
	libxcb           \
	libxcursor       \
	libxi            \
	libxkbcommon     \
	libxkbcommon-x11 \
	libxrandr        \
	libxtst          \
	qt6ct            \
	wget             \
	xorg-server-xvfb \
	rav1e            \
	ghostscript      \
	ffmpeg           \
	kvantum          \
	zsync

	

	# At the moment, the svt-av1 package is not available on aarch64
	if [ "$(uname -m)" = "x86_64" ]; then
	  pacman -S --noconfirm --needed svt-av1

	  # temporary fix for libheif, will be removed soon
	  pacman -U --noconfirm https://archive.archlinux.org/packages/l/libheif/libheif-1.21.2-2-x86_64.pkg.tar.zst
	fi

echo "Installing debloated packages..."
echo "---------------------------------------------------------------"
wget --retry-connrefused --tries=30 "$EXTRA_PACKAGES" -O ./get-debloated-pkgs.sh
chmod +x ./get-debloated-pkgs.sh
./get-debloated-pkgs.sh --add-common --prefer-nano x265-mini
