# old version (without -$pkgrel): ${1%%-*}
# new version (without -$pkgrel): ${2%%-*}

PKGNAME="grub-theme-ublinux-db"

# arg 1:  the new package version
pre_install() {
    pre_upgrade $@
}

# arg 1:  the new package version
post_install() {
    post_upgrade $@
}

# arg 1:  the new package version
# arg 2:  the old package version
pre_upgrade() {
    true
}

# arg 1:  the new package version
# arg 2:  the old package version
post_upgrade() {
    local NAME_THEME=${PKGNAME/#grub-theme-/}; NAME_THEME=${NAME_THEME//-/_}
    echo "==> WARNING: Configure theme to modular UBLinux GRUB is not complete"
    pacman -Qqs ubboot &>/dev/null || echo "  -> Install package: pacman -Sy ubboot"
    echo "  -> To apply the theme, run: /usr/lib/ubboot/ubboot-skel update --quiet --grub-theme ${NAME_THEME}"
}

# arg 1:  the old package version
pre_remove() {
    true
}

# arg 1:  the old package version
post_remove() {
    true
}

