This is the mail archive of the
cygwin
mailing list for the Cygwin project.
[patch] cygport-0.2.7 allow multiple postinstall/preremove scripts
- From: Charles Wilson <cygwin at cwilson dot fastmail dot fm>
- To: cygwin at cygwin dot com
- Date: Fri, 05 Jan 2007 23:40:06 -0500
- Subject: [patch] cygport-0.2.7 allow multiple postinstall/preremove scripts
Originally part of the relocatable patch from 2006-10-22:
http://www.cygwin.com/ml/cygwin/2006-10/msg00743.html
On 2006-11-28, split into its own patch when I refactored all my cygport
patches after cygport-0.2.6 was released:
http://www.cygwin.com/ml/cygwin/2006-11/msg00719.html
Now that cygport-0.2.7 has been released, I've regenerated the patch and
updated a few comments, but no substantive changes. What it does:
Enable cygports to handle cases where a multi-binpkg project has
different postinstall/preinstall scripts for more than one of the
subpackages -- for instance, the main gdbm subpackage needs no
postinstall, but the libgdbm-devel subpackage has one.
In addition, the patch enables client cygports to turn off automatic
install-info postinstall generation. For example, in gettext,
gettext.info belongs to the gettext-devel subpackage -- so an
automatically generated "gettext.sh" postinstall should NOT install it.
However, libasprintf.info belongs to the gettext subpackage. Since no
automated tool can know this, gettext needs to turn off the (ordinarily
useful) install-info help, and manage its info files explicitly.
2007-01-05 Charles Wilson <...>
* bin/prep_gnu_info.sh: allow cygport client to suppress
automatic install-info (useful if: subpackages each have own
explicit postinstall scripts, and each subpackage "owns"
certain info files. To activate *suppression*, set
SUPPRESS_AUTOMATIC_INSTALLINFO to non-empty. Default behavior
is unchanged from current.
* bin/cygport.in (__prepetc): allow ${C}/${PN}.postinstall
and ${C}/${PN}.sh as synonyms for ${C}/postinstall.sh (however,
presence of more than one of these causes error message).
Allow ${C}/${PN}.preremove as synonym for ${C}/preremove.sh
(but presence of both causes error message). Allow for
${C}/${pkg_name[${n}]}.postinstall and/or
${C}/${pkg_name[${n}]}.preremove [n > 1].
--
Chuck
Index: bin/cygport.in
===================================================================
RCS file: /cvsroot/cygwin-ports/cygport/bin/cygport.in,v
retrieving revision 1.45
diff -u -r1.45 cygport.in
--- bin/cygport.in 4 Jan 2007 02:35:26 -0000 1.45
+++ bin/cygport.in 6 Jan 2007 04:24:40 -0000
@@ -1038,16 +1038,63 @@
__prepetc() {
local d;
local s;
+ local -i n=1
+ local -i count=0
- for s in postinstall preremove
+ # handle some conflicts between default behavior...
+ if [ -f ${C}/${PN}.sh ]; then count+=1 ; fi
+ if [ -f ${C}/postinstall.sh ]; then count+=1 ; fi
+ if [ -f ${C}/${PN}.postinstall ]; then count+=1 ; fi
+ if (( $count > 1 ))
+ then
+ error "Can have only one of ${PN}.sh, ${PN}.postinstall, and postinstall.sh"
+ fi
+
+ count=0
+ if [ -f ${C}/preremove.sh ]; then count+=1 ; fi
+ if [ -f ${C}/${PN}.preremove ]; then count+=1 ; fi
+ if (( $count > 1 ))
+ then
+ error "Can have only one of ${PN}.preremove, preremove.sh"
+ fi
+
+ # do "main" postinstall if present; guaranteed that at most
+ # only one of these three exist, thanks to checks above.
+ for f in ${PN}.sh ${PN}.postinstall postinstall.sh
+ do
+ if [ -f ${C}/${f} ]
+ then
+ dodir /etc/postinstall;
+ cat >> ${D}/etc/postinstall/${PN}.sh < ${C}/${f}
+ break
+ fi
+ done
+
+ # do "main" preremove if present; guaranteed that at most
+ # only one of these two exist, thanks to checks above.
+ for f in ${PN}.preremove preremove.sh
do
- if [ -f ${C}/${s}.sh ]
+ if [ -f ${C}/${f} ]
then
- dodir /etc/${s};
- cat >> ${D}/etc/${s}/${PN}.sh < ${C}/${s}.sh;
+ dodir /etc/preremove;
+ cat >> ${D}/etc/preremove/${PN}.sh < ${C}/${f};
fi
done
+ # now do other postinstall/preremove scripts if present
+ while [ -n "${pkg_name[${n}]}" ]
+ do
+ for s in postinstall preremove
+ do
+ if [ -f ${C}/${pkg_name[${n}]}.${s} ]
+ then
+ dodir /etc/${s};
+ cat >> ${D}/etc/${s}/${pkg_name[${n}]}.sh < ${C}/${pkg_name[${n}]}.${s}
+ fi
+ done
+ n+=1
+ done
+
if [ -f ${C}/profile.d.sh ]
then
exeinto /etc/profile.d;
Index: bin/prep_gnu_info.sh
===================================================================
RCS file: /cvsroot/cygwin-ports/cygport/bin/prep_gnu_info.sh,v
retrieving revision 1.4
diff -u -r1.4 prep_gnu_info.sh
--- bin/prep_gnu_info.sh 20 Nov 2006 05:48:58 -0000 1.4
+++ bin/prep_gnu_info.sh 6 Jan 2007 04:24:40 -0000
@@ -22,12 +22,16 @@
gzip -q ${infopage}
done
-dodir /etc/postinstall
-for infopage in $(find ${D}/usr/share/info -type f)
-do
- cat >> ${D}/etc/postinstall/${PN}.sh <<-_EOF
+if [ -z "${SUPPRESS_AUTOMATIC_INSTALLINFO}" ]
+then
+ dodir /etc/postinstall
+ for infopage in $(find ${D}/usr/share/info -type f)
+ do
+ cat >> ${D}/etc/postinstall/${PN}.sh <<-_EOF
/usr/bin/install-info --dir-file=/usr/share/info/dir --info-file=/usr/share/info/${infopage##*/}
_EOF
-done
-echo >> ${D}/etc/postinstall/${PN}.sh
+ done
+ echo >> ${D}/etc/postinstall/${PN}.sh
+fi
+
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/