Please login or register. December 18, 2017, 05:11:14 AM

Author Topic: mkisntallp templatefile  (Read 1220 times)

0 Members and 1 Guest are viewing this topic.

eckertd

  • Jr. Member
  • **
  • Posts: 6
  • Karma: +0/-0
mkisntallp templatefile
« on: November 21, 2016, 04:38:51 PM »
Greetings.

Trying to get Net-SNMP built with a post-install script (AIX 6100-09-08-1642). I have the following in the templatefile

Post-installation Script: /gpl_dev/builds/AIX6/net-snmp-5.7.3.1/opt/freeware/tmp/post_i

But when I run 'mkinstallp' I get this

Using templatefile as the template file.
0503-878 mkinstallp: Unknown keyword (Post-installation Script)
                                                in templatefile

Not sure why it's doing this, as this is the keyword syntax according to /usr/lpp/bos/README.MKINSTALLP

eckertd

  • Jr. Member
  • **
  • Posts: 6
  • Karma: +0/-0
Re: mkisntallp templatefile
« Reply #1 on: November 22, 2016, 06:44:22 PM »
I think I found it. After taking a look at the /usr/sbin/mkinstallp script itself, it appears that the pre/post install keywords must appear between USRLIBLPPFiles & EOUSRLIBLPPFiles keywords in the templatefile.


Michael

  • Administrator
  • Hero Member
  • *****
  • Posts: 1056
  • Karma: +0/-0
Re: mkisntallp templatefile
« Reply #2 on: November 23, 2016, 09:51:53 AM »
    I hate LONG forum answers, but notime to do this as an article
     The short answer is below
    I have this 'worked out' in my buildaix tool - that automates the packaging of OSS and more recently, even directories. And I hope the details/discussion encourage you to give it a test drive.

A couple of things when using buildaix.

    it installs three scripts - buildaix.ksh, aixinfo, and mkinstallp.ksh in /opt/bin and a symbolic link /usr/bin/buildaix -> /opt/bin/buildaix.ksh

    it also installs some common 'missing' include files for libraries that are installed (e.g., zlib.h) in /opt/include. I may have also added some links into /usr/include because so many projects still fail to find /opt/include during the ./configure script
      if you do not set any other variables the name of the LPP comes from the directory the sources come from.

    e.g., if the project is in /some/directory/sourceforge/net-snmp-5.7.3 the default LPP should become:
    buildaix.sourceforge.net-snmp.* with VRMF 5.7.3.0
      I export the variable PROGRAM=aixtools to make the default aixtools.sourceforge.net-snmp

    Originally, I orgized my downloads as: "source"/"project"/"project"-version and also packaged as "aixtools.project.version". Starting with version 2 of buildaix I changed the way I named packages - so, e.g., all GNU sourced projects are easily available. "Sourceforge" is also a 'source', i.e., a hint to a user to where they can look for where the OpenSource can be found.

    Some examples:
      michael@x071:[/data/prj/sourceforge/net-snmp/net-snmp-5.7.3]aixinfo -verbose
      aixinfo FILESET: net-snmp
      aixinfo Version.Release.Maintenance.Fix 5.7.3.0
      aixinfo LPP NAME: aixtools.sourceforge.net-snmp.5.7.3.0


      michael@x071:[/data/prj/gnu/gettext/gettext-0.19.6]aixinfo -verbose
      aixinfo FILESET: gettext
      aixinfo Version.Release.Maintenance.Fix 0.19.6.0
      aixinfo LPP NAME: aixtools.gnu.gettext.0.19.6.0



    More recently I organize my projects in fewer subdirectories:

    Code: [Select]
    michael@x071:[/data/prj/gnu/gettext-0.19.8.1]aixinfo -verbose
    aixinfo FILESET: gettext
    aixinfo Version.Release.Maintenance.Fix 0.19.8.1
    aixinfo LPP NAME: aixtools.gnu.gettext.0.19.8.1

    In short, should you wish to tryout buildaix you can change the packaging name easily with:

    Code: [Select]
    michael@x071:[/data/prj/gnu/gettext-0.19.8.1]export PROGRAM=mamf
    michael@x071:[/data/prj/gnu/gettext-0.19.8.1]aixinfo -verbose
    aixinfo FILESET: gettext
    aixinfo Version.Release.Maintenance.Fix 0.19.8.1
    aixinfo LPP NAME: mamf.gnu.gettext.0.19.8.1

    To get to your post/pre install scripts.

    buildaix -T creates a number of script templates in ./buildaix and ./buildaix/root - see http://www.aixtools.net/index.php/buildaix#Installation for details on how these work.

    For building, rather packaging a project I usually just type

    # buildaix

    and wait for it to finish. There are often things they need fixing, but it can be as simple as:
    Code: [Select]
    michael@x071:[/data/prj/gnu]id
    uid=0(root) gid=0(system) groups=2(bin),3(sys),7(security),8(cron),10(audit),11(lp),13(dbsysadm),207(idsldap)

    michael@x071:[/data/prj/gnu]ls dist/less*
    dist/less-481.tar.gz
    michael@x071:[/data/prj/gnu]gzip -dc dist/less-481.tar.gz | tar xf -
    michael@x071:[/data/prj/gnu]cd less-481
    michael@x071:[/data/prj/gnu/less-481]buildaix
    VRMF 481.0.0.0
    xlc is /usr/vacpp/bin/xlc
    + CPPFLAGS="-I/opt/include" CFLAGS="-I/opt/include -qmaxmem=-1 -qarch=pwr4 -O2"\
            ./configure\
                    --prefix=/opt \
                    --sysconfdir=/var/less/etc\
                    --sharedstatedir=/var/less/com\
                    --localstatedir=/var/less\
                    --mandir=/usr/share/man\
                    --infodir=/opt/share/info/less \
                            > .buildaix/configure.out
    + /opt/bin/make > .buildaix/make.out
    + /opt/bin/make install DESTDIR=/var/mamf/gnu/less/481.0.0.0 > .buildaix/install.out
    mkdir /var/mamf/gnu/less/481.0.0.0/opt
    mkdir /var/mamf/gnu/less/481.0.0.0/opt/bin
    mkdir /var/mamf/gnu/less/481.0.0.0/usr
    mkdir /var/mamf/gnu/less/481.0.0.0/usr/share
    mkdir /var/mamf/gnu/less/481.0.0.0/usr/share/man
    mkdir /var/mamf/gnu/less/481.0.0.0/usr/share/man/man1
    + mkinstallp.ksh /var/mamf/gnu/less/481.0.0.0 > .buildaix/mkinstallp.out
    0503-005 inutoc:  The format of the toc file is invalid.
    0503-019 inutoc:  mamf 481.0.0.0 is an invalid level.
            ALL levels must be in one of the following formats:
                    vv.rr.mmmm.ffff OR vv.rr.mmmm.fffff.ppppppppp
    ==============================
    0503-003 installp:  The specified device /data/prj/gnu/less-481/installp/ppc
            is not a valid device or file.
    ==============================

    Here, the issue is the VRMF number - the maximum value for V is 99.

    So, add one argument to specify a new VRMF and:

    Code: [Select]
    michael@x071:[/data/prj/gnu/less-481]ls -l installp/ppc
    total 528
    -rw-r--r--    1 root     513          267264 Nov 23 08:47 mamf.gnu.less.481.0.0.0.I
    michael@x071:[/data/prj/gnu/less-481]rm installp/ppc/*.I
    michael@x071:[/data/prj/gnu/less-481]buildaix -V 4.81.0.0
    VRMF 4.81.0.0
    do_configure: using existing Makefile
    do_configure: run distclean to get a standard AIX configure

    -rw-------    1 root     513            3644 Nov 23 08:47 ./Makefile
    -rw-------    1 root     513           48269 Nov 23 08:47 config.log
    -rwx------    1 root     513           28983 Nov 23 08:47 config.status

    +  > .buildaix/make.out
    + /opt/bin/make install DESTDIR=/var/mamf/gnu/less/4.81.0.0 > .buildaix/install.out
    mkdir /var/mamf/gnu/less/4.81.0.0/opt
    mkdir /var/mamf/gnu/less/4.81.0.0/opt/bin
    mkdir /var/mamf/gnu/less/4.81.0.0/usr
    mkdir /var/mamf/gnu/less/4.81.0.0/usr/share
    mkdir /var/mamf/gnu/less/4.81.0.0/usr/share/man
    mkdir /var/mamf/gnu/less/4.81.0.0/usr/share/man/man1
    + mkinstallp.ksh /var/mamf/gnu/less/4.81.0.0 > .buildaix/mkinstallp.out
    ==============================
    mamf.gnu.less:mamf.gnu.less.man.en_US:4.81.0.0::I:T:::::N:gnu less man pages::::0::
    mamf.gnu.less:mamf.gnu.less.rte:4.81.0.0::I:T:::::N:gnu less 23-Nov-2016::::0::
    ==============================
    michael@x071:[/data/prj/gnu/less-481]ls -l installp/ppc
    total 544
    -rw-r-----    1 root     513             372 Nov 23 08:58 .toc
    -rw-r--r--    1 root     513          267264 Nov 23 08:58 mamf.gnu.less.4.81.0.0.I

    now, to look at details


    michael@x071:[/data/prj/gnu/less-481]ls buildaix
    less.LICENSE                      less.la                           mamf.gnu.less.481.0.0.0.template
    less.README                       mamf.gnu.less.4.81.0.0.template


    Here you see the mkinstallp.template files buildaix generated automatically. The other files, noteably the .la and LICENSE are to add license agreements and acceptance at a later date.

    There is very little difference between the V-481 and V-4 templates:

    Code: [Select]
    michael@x071:[/data/prj/gnu/less-481/buildaix]diff -u *template
    --- mamf.gnu.less.4.81.0.0.template     2016-11-23 08:58:26 +0000
    +++ mamf.gnu.less.481.0.0.0.template    2016-11-23 08:47:27 +0000
    @@ -1,9 +1,9 @@
     Package Name: mamf.gnu.less
    -Package VRMF: 4.81.0.0
    +Package VRMF: 481.0.0.0
     Update: N
     Fileset
       Fileset Name: mamf.gnu.less.man.en_US
    -  Fileset VRMF: 4.81.0.0
    +  Fileset VRMF: 481.0.0.0
       Fileset Description: gnu less man pages
       USRLIBLPPFiles
       EOUSRLIBLPPFiles
    @@ -24,7 +24,7 @@
     EOFileset
     Fileset
       Fileset Name: mamf.gnu.less.rte
    -  Fileset VRMF: 4.81.0.0
    +  Fileset VRMF: 481.0.0.0
       Fileset Description: gnu less 23-Nov-2016
       USRLIBLPPFiles
       EOUSRLIBLPPFiles

    So, I shall just add the default templates - and remove the ones you are not using, and compare templates again.

    Code: [Select]
    michael@x071:[/data/prj/gnu/less-481/buildaix]cd ..
    michael@x071:[/data/prj/gnu/less-481]buildaix -T
    customization script directories made
    +-----------------------------------------------------------------------------+
    total 144
    -rw-r--r--    1 bin      bin             701 Jun 06 22:46 README.less.cfgfiles
    -rw-r--r--    1 bin      bin            1558 Jun 06 22:46 README.less.override
    -rw-r--r--    1 bin      bin            5114 Jun 06 22:46 README.less.templates
    -r--r--r--    1 beimin   513            1271 Aug 31 2015  less.LICENSE
    -r--r--r--    1 beimin   513           10065 Aug 31 2015  less.README
    -r--r-----    1 root     513            1271 Nov 23 08:58 less.la
    -rwxr-xr-x    1 bin      bin            1471 Jun 06 22:46 less.rte.post_i
    -rwxr-xr-x    1 bin      bin            1316 Jun 06 22:46 less.rte.pre_i
    -rwxr-xr-x    1 bin      bin             819 Jun 06 22:46 less.rte.pre_rm
    -rwxr-xr-x    1 bin      bin            1449 Jun 06 22:46 less.rte.unpost_i
    -rwxr-xr-x    1 bin      bin            1076 Jun 06 22:46 less.rte.unpre_i
    -rw-r-----    1 root     513            1046 Nov 23 08:58 mamf.gnu.less.4.81.0.0.template
    -rw-r-----    1 root     513            1049 Nov 23 08:47 mamf.gnu.less.481.0.0.0.template
    drwx------    2 root     513            4096 Nov 23 09:08 root
    buildaix/root:
    total 48
    -rwxr-xr-x    1 bin      bin            1631 Jun 06 22:46 less.rte.config
    -rwxr-xr-x    1 bin      bin            1471 Jun 06 22:46 less.rte.post_i
    -rwxr-xr-x    1 bin      bin            1316 Jun 06 22:46 less.rte.pre_i
    -rwxr-xr-x    1 bin      bin            1124 Jun 06 22:46 less.rte.unconfig
    -rwxr-xr-x    1 bin      bin            1449 Jun 06 22:46 less.rte.unpost_i
    -rwxr-xr-x    1 bin      bin            1076 Jun 06 22:46 less.rte.unpre_i
    +-----------------------------------------------------------------------------+
    remove scripts you are not planning on using.
    remember ROOT installs last, but uninstalls first

    So, to emulate only having post_i scripts I have the following setup for the template:

    Code: [Select]
    michael@x071:[/data/prj/gnu/less-481]ls -R buildaix
    README.less.cfgfiles              less.README                       mamf.gnu.less.481.0.0.0.template
    README.less.override              less.la                           root
    README.less.templates             less.rte.post_i
    less.LICENSE                      mamf.gnu.less.4.81.0.0.template
    buildaix/root:
    less.rte.post_i

    After running buildaix -V 4.81.0.0 again, the templates now differ as:

    Code: [Select]
    michael@x071:[/data/prj/gnu/less-481/buildaix]diff -u mamf.gnu.less.481.0.0.0.template  mamf.gnu.less.4.81.0.0.template
    --- mamf.gnu.less.481.0.0.0.template    2016-11-23 08:47:27 +0000
    +++ mamf.gnu.less.4.81.0.0.template     2016-11-23 09:33:46 +0000
    @@ -1,9 +1,9 @@
     Package Name: mamf.gnu.less
    -Package VRMF: 481.0.0.0
    +Package VRMF: 4.81.0.0
     Update: N
     Fileset
       Fileset Name: mamf.gnu.less.man.en_US
    -  Fileset VRMF: 481.0.0.0
    +  Fileset VRMF: 4.81.0.0
       Fileset Description: gnu less man pages
       USRLIBLPPFiles
       EOUSRLIBLPPFiles
    @@ -24,9 +24,10 @@
     EOFileset
     Fileset
       Fileset Name: mamf.gnu.less.rte
    -  Fileset VRMF: 481.0.0.0
    +  Fileset VRMF: 4.81.0.0
       Fileset Description: gnu less 23-Nov-2016
       USRLIBLPPFiles
    +  Post-installation Script: /data/prj/gnu/less-481/buildaix/less.rte.post_i
       EOUSRLIBLPPFiles
       Bosboot required: N
       License agreement acceptance required: N

    Hope this helps!

    p.s. I see I downloaded net-snmp a log time ago. Ran into this issue, and never got back to it. Maybe you have a suggestion!

    make[1]: *** No rule to make target `/usr/opt/perl5/lib/5.8.2/aix-thread-multi/Config.pm', needed by `Makefile'.  Stop.
    make[1]: Leaving directory `/data/prj/sourceforge/net-snmp/net-snmp-5.7.3/perl'


Michael

  • Administrator
  • Hero Member
  • *****
  • Posts: 1056
  • Karma: +0/-0
Re: mkinstallp templatefile
« Reply #3 on: November 23, 2016, 10:21:06 AM »
Actually, I remember now why I did not get this packaged LONG ago.

Code: [Select]
root@x064:[/data/prj/sourceforge/net-snmp/net-snmp-5.7.3]buildaix
VRMF 5.7.3.0
do_configure: using existing Makefile
do_configure: run distclean to get a standard AIX configure

-rwxrwx--- 1 root    system   32166 Mar 19  2015 ./Makefile
-rwxrwx--- 1 michael felt     45044 Dec  8  2014 config.guess
-rwxrwx--- 1 root    system 2566769 Mar 19  2015 config.log
-rwxrwx--- 1 root    system   79796 Mar 19  2015 config.status
-rwxrwx--- 1 michael felt     35070 Dec  8  2014 config.sub

+  > .buildaix/make.out
+ make install DESTDIR=/var/aixtools/sourceforge/net-snmp/5.7.3.0 > .buildaix/install.out
libtool: install: warning: remember to run `libtool --finish /opt/lib'
libtool: install: warning: relinking `libnetsnmpagent.la'
libtool: install: warning: remember to run `libtool --finish /opt/lib'
libtool: install: warning: remember to run `libtool --finish /opt/lib'
libtool: install: warning: relinking `libnetsnmpmibs.la'
libtool: install: warning: remember to run `libtool --finish /opt/lib'
libtool: install: warning: relinking `libnetsnmptrapd.la'
libtool: install: warning: remember to run `libtool --finish /opt/lib'
libtool: install: warning: remember to run `libtool --finish /opt/lib'
libtool: install: warning: relinking `libnetsnmpagent.la'
libtool: install: warning: remember to run `libtool --finish /opt/lib'
libtool: install: warning: remember to run `libtool --finish /opt/lib'
libtool: install: warning: relinking `libnetsnmpmibs.la'
libtool: install: warning: remember to run `libtool --finish /opt/lib'
libtool: install: warning: `libnetsnmpagent.la' has not been installed in `/opt/lib'
libtool: install: warning: `libnetsnmpmibs.la' has not been installed in `/opt/lib'
libtool: install: warning: `/data/prj/sourceforge/net-snmp/net-snmp-5.7.3/agent/libnetsnmpagent.la' has not been insta      lled in `/opt/lib'
libtool: install: warning: `/data/prj/sourceforge/net-snmp/net-snmp-5.7.3/snmplib/libnetsnmp.la' has not been installe      d in `/opt/lib'
libtool: install: warning: `../snmplib/libnetsnmp.la' has not been installed in `/opt/lib'
libtool: install: warning: remember to run `libtool --finish /opt/lib'
libtool: install: warning: relinking `libnetsnmptrapd.la'
libtool: install: warning: remember to run `libtool --finish /opt/lib'
libtool: install: warning: `../snmplib/libnetsnmp.la' has not been installed in `/opt/lib'
libtool: install: warning: `../snmplib/libnetsnmp.la' has not been installed in `/opt/lib'
libtool: install: warning: `../snmplib/libnetsnmp.la' has not been installed in `/opt/lib'
libtool: install: warning: `../snmplib/libnetsnmp.la' has not been installed in `/opt/lib'
libtool: install: warning: `../snmplib/libnetsnmp.la' has not been installed in `/opt/lib'
libtool: install: warning: `../snmplib/libnetsnmp.la' has not been installed in `/opt/lib'
libtool: install: warning: `../snmplib/libnetsnmp.la' has not been installed in `/opt/lib'
libtool: install: warning: `../snmplib/libnetsnmp.la' has not been installed in `/opt/lib'
libtool: install: warning: `../snmplib/libnetsnmp.la' has not been installed in `/opt/lib'
libtool: install: warning: `../snmplib/libnetsnmp.la' has not been installed in `/opt/lib'
libtool: install: warning: `../snmplib/libnetsnmp.la' has not been installed in `/opt/lib'
libtool: install: warning: `../snmplib/libnetsnmp.la' has not been installed in `/opt/lib'
libtool: install: warning: `../snmplib/libnetsnmp.la' has not been installed in `/opt/lib'
libtool: install: warning: `../agent/libnetsnmpmibs.la' has not been installed in `/opt/lib'
libtool: install: warning: `/data/prj/sourceforge/net-snmp/net-snmp-5.7.3/agent/libnetsnmpagent.la' has not been insta      lled in `/opt/lib'
libtool: install: warning: `../agent/libnetsnmpagent.la' has not been installed in `/opt/lib'
libtool: install: warning: `/data/prj/sourceforge/net-snmp/net-snmp-5.7.3/snmplib/libnetsnmp.la' has not been installe      d in `/opt/lib'
libtool: install: warning: `../snmplib/libnetsnmp.la' has not been installed in `/opt/lib'
libtool: install: warning: `../snmplib/libnetsnmp.la' has not been installed in `/opt/lib'
libtool: install: warning: `../snmplib/libnetsnmp.la' has not been installed in `/opt/lib'
libtool: install: warning: `../snmplib/libnetsnmp.la' has not been installed in `/opt/lib'
libtool: install: warning: `libnetsnmptrapd.la' has not been installed in `/opt/lib'
libtool: install: warning: `/data/prj/sourceforge/net-snmp/net-snmp-5.7.3/agent/libnetsnmpmibs.la' has not been instal      led in `/opt/lib'
libtool: install: warning: `../agent/libnetsnmpmibs.la' has not been installed in `/opt/lib'
libtool: install: warning: `/data/prj/sourceforge/net-snmp/net-snmp-5.7.3/agent/libnetsnmpagent.la' has not been insta      lled in `/opt/lib'
libtool: install: warning: `../agent/libnetsnmpagent.la' has not been installed in `/opt/lib'
libtool: install: warning: `/data/prj/sourceforge/net-snmp/net-snmp-5.7.3/snmplib/libnetsnmp.la' has not been installe      d in `/opt/lib'
libtool: install: warning: `../snmplib/libnetsnmp.la' has not been installed in `/opt/lib'
libtool: install: warning: `../../snmplib/libnetsnmp.la' has not been installed in `/opt/lib'
+ mkinstallp.ksh /var/aixtools/sourceforge/net-snmp/5.7.3.0 > .buildaix/mkinstallp.out
renamed:./usr/share/man/man3/NetSNMP::TrapReceiver.3:./usr/share/man/man3/NetSNMP_TrapReceiver.3
renamed:./usr/share/man/man3/NetSNMP::ASN.3:./usr/share/man/man3/NetSNMP_ASN.3
renamed:./usr/share/man/man3/NetSNMP::agent::default_store.3:./usr/share/man/man3/NetSNMP_agent_default_store.3
renamed:./usr/share/man/man3/NetSNMP::agent.3:./usr/share/man/man3/NetSNMP_agent.3
renamed:./usr/share/man/man3/NetSNMP::OID.3:./usr/share/man/man3/NetSNMP_OID.3
renamed:./usr/share/man/man3/NetSNMP::netsnmp_request_infoPtr.3:./usr/share/man/man3/NetSNMP_netsnmp_request_infoPtr.3
renamed:./usr/share/man/man3/NetSNMP::default_store.3:./usr/share/man/man3/NetSNMP_default_store.3
==============================
aixtools.sourceforge.net-snmp:aixtools.sourceforge.net-snmp.man.en_US:5.7.3.0::I:T:::::N:sourceforge net-snmp man page      s::::0::
aixtools.sourceforge.net-snmp:aixtools.sourceforge.net-snmp.rte:5.7.3.0::I:T:::::N:sourceforge net-snmp 23-Nov-2016:::      :0::
aixtools.sourceforge.net-snmp:aixtools.sourceforge.net-snmp.share:5.7.3.0::I:T:::::N:sourceforge net-snmp universal fi      les::::0::
==============================
root@x064:[/data/prj/sourceforge/net-snmp/net-snmp-5.7.3]

In short, some the file names include the colon character ':' and that messes up the template. Since then I have added some things to the template builder (mkinstallp.ksh) to rename those files. I am working on something 'better' to rename them (in a generic way) back after the install, but that will take some additional time.

I put my packaging at http://download.aixtools.net/test/aixtools.sourceforge.net-snmp.5.7.3.0.I - and I would be grateful for your feedback as I do not know net-snmp. Maybe, because of perl specifics (the Config.pm) the package will be AIX specific (5.8.2 is AIX 5.3, 5.8.8 is AIX 6.1, etc..)

Thanks for your interest!

Many thanks for your feedback