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

PKGNAME="ublinux-tmpfiles"

# 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() {
    [[ -d /run/tmpfiles.d ]] || mkdir -p /run/tmpfiles.d
    find /run/tmpfiles.d/ -type l -delete
    for F_TMPFILE in ublinux; do    
	[[ ! -f /usr/share/ublinux-tmpfiles/${F_TMPFILE}.tmpfiles ]] || ln -sr /usr/share/ublinux-tmpfiles/${F_TMPFILE}.tmpfiles /run/tmpfiles.d/${F_TMPFILE}.conf
    done
    /usr/share/libalpm/scripts/ublinux-tmpfiles
}

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

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