#! /bin/bash

for base in base-*; do
	source $base
done

export POSTCOPY="\
	plasma \
	skel \
	wallpapers/wallpapers \
"

export SUB_PACKAGES="\
	$BASE_PACKAGES \
	$BASE_KDE_PACKAGES \
	$EXTRA_KDE_PACKAGES \
	npm \
"

export SUB_AUR_PACKAGES="\
	$BASE_AUR_PACKAGES \
	$BASE_KDE_AUR_PACKAGES \
	bilibili-bin \
	cursor-bin \
	linuxqq \
	microsoft-edge-stable-bin \
	qqmusic-bin \
	winboat-bin \
	wechat-universal-bwrap \
	ventoy-bin \
"

export SUB_LOCAL_PACKAGES="\
	$BASE_LOCAL_PACKAGES \
	$BASE_KDE_LOCAL_PACKAGES \
"

export SUB_PACKAGES_TO_DELETE="\
	gnome-desktop \
	mutter \
"

export SUB_PACKAGE_OVERRIDES_URLS=""

sub_postinstallhook() {
	if [ -n "$SUB_PACKAGE_OVERRIDES_URLS" ]; then
		temp_pkg_dir=$(mktemp -d)
		wget --directory-prefix=$temp_pkg_dir $SUB_PACKAGE_OVERRIDES_URLS

		pacman --noconfirm -U --overwrite='*' $temp_pkg_dir/*.pkg.tar.zst --needed
		rm -rf $temp_pkg_dir
	fi
}