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

PKGNAME="ubl-xfce-config-ubblack"

# arg 1:  the new package version
pre_install() {
    true
}

# 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() {
    cd /usr/share/${PKGNAME}
    find * -type d -exec install -dm0755 /{} \;
    find * -type f -exec install -Dm0644 {} /{} \;
    pkill xfconfd 2>/dev/null || true
}

# arg 1:  the old package version
pre_remove() {
    cat << EOF 

==> IMPORTANT!!!
==> The configuration files will not be deleted from the system:
EOF
    cd /usr/share/${PKGNAME}/
    find * -type f -exec echo "==>   /{}" \;
}

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