generic template script (proposed patch on 1.9)
Lapo Luchini
lapo@lapo.it
Fri Dec 5 10:05:00 GMT 2003
> # determine correct decompression option and tarball filename
> -if [ -e ${PKG}-${VER}.tar.gz ] ; then
> - export opt_decomp=z
> - export src_orig_pkg_ext=gz
> -elif [ -e ${PKG}-${VER}.tar.bz2 ] ; then
> +export BASEPKG=${PKG}-${VER}
> +if [ -e ${BASEPKG}.tar.bz2 ] ; then
> export opt_decomp=j
> - export src_orig_pkg_ext=bz2
> + export src_orig_pkg_name=${BASEPKG}.tar.bz2
> +elif [ -e ${BASEPKG}.tar.gz ] ; then
> + export opt_decomp=z
> + export src_orig_pkg_name=${BASEPKG}.tar.gz
> +elif [ -e ${BASEPKG}.tgz ] ; then
> + export opt_decomp=z
> + export src_orig_pkg_name=${BASEPKG}.tgz
> +elif [ -e ${BASEPKG}.tar ] ; then
> + export opt_decomp=
> + export src_orig_pkg_name=${BASEPKG}.tar
> +else
> + echo Cannot find original package.
> + exit 1
> fi
Original script has a flaw: if no .tar.gz nor .tar.bz2 are found, it
happily continues wihtout defining values.
I also added support for a bunch more package types, but the important
parte is the last else imho.
> @@ -103,8 +108,7 @@
> rm -f ${instdir}${f} ; \
> fi ;\
> done &&\
> - for d in ${prefix}/share/doc/${PKG}-${VER} ${prefix}/share/doc/Cygwin \
> - ${sysconfdir}/postinstall ; do
> + for d in ${prefix}/share/doc/${PKG}-${VER}
> ${prefix}/share/doc/Cygwin ; do
> if [ ! -d ${instdir}${d} ] ; then
> mkdir -p ${instdir}${d} ;\
> fi ;\
> @@ -131,14 +135,16 @@
> fi ;\
> fi ;\
> if [ -f ${srcdir}/CYGWIN-PATCHES/postinstall.sh ] ; then \
> - /usr/bin/install -m 755 ${srcdir}/CYGWIN-PATCHES/postinstall.sh \
> + if [ ! -d ${instdir}${sysconfdir}/postinstall ]; then \
> + mkdir -p ${instdir}${sysconfdir}/postinstall ; \
> + fi && \
> + /usr/bin/install -m 755 ${srcdir}/CYGWIN-PATCHES/postinstall.sh \
> ${instdir}${sysconfdir}/postinstall/${PKG}.sh
> fi )
> }
It is useful IMHO to have the postinstall directory created
automatically only if there actualyl is a postinstall script to install
there.
This way the script must be modified less by mantainers to reflect the
fact that their package doesn't have a postinstall script (to avoid the
empty dir).
> strip() {
> (cd ${instdir} && \
> - find . -name "*.dll" | xargs strip > /dev/null 2>&1
> - find . -name "*.exe" | xargs strip > /dev/null 2>&1
> + find . -name "*.dll" -or -name "*.exe" | xargs strip > /dev/null 2>&1
> true )
> }
xargs already accepts a huge number of parameters, then why dividing
them in two?
The rest is just some whitespace changes and my usual "digital
signature" patch.
Lapo
--
Lapo 'Raist' Luchini
lapo@lapo.it (PGP & X.509 keys available)
http://www.lapo.it (ICQ UIN: 529796)
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: generic.diff
URL: <http://cygwin.com/pipermail/cygwin-apps/attachments/20031205/26be6e2a/attachment.ksh>
More information about the Cygwin-apps
mailing list