How to use variables in postinst scripts?

Currently, I use a variable for the upstream version with these lines in debian/rules:

        [...]
        # Get the upstream version from the changelog.
upstream := $(shell head -1 debian/changelog | sed 's/^.*(\(.*\)-.*).*$$/\1/')
        [...]
install -o root -g root -m 755 unison $(CURDIR)/debian/unison/usr/bin/unison-$(upstream)
        [...]

But I can't use it in postinst:

        [...]
        update-alternatives \
                --install /usr/bin/unison unison /usr/bin/unison-2.10.2 128
        [...]

Must I regexp postinst manually, or is there some magic for this?

debian/control contains ${Source-Version}, which gets replaced, but I haven't figured out which part of the build system is responsible, or if it could be used on postinst.

Thanks!

Jack

Reply via email to