Add pkg_setup.sh :sh feature

Issue #27 resolved
Aaron Bartell created an issue

#tl;dr By default this is the rpm command that's invoked for installing nginx:

rpm --ignoreos --ignorearch --replacepkgs --nodeps -hUv nginx-1.9.4-1.aix5.3.ppc.rpm 

It was hanging on the install scripts so I added --noscripts, as shown below, and now nginx installs and works fine. I haven't determined what the install scripts are failing to accomplish.

rpm --ignoreos --ignorearch --replacepkgs --nodeps -hUv --noscripts nginx-1.9.4-1.aix5.3.ppc.rpm

#More details... Installing the perzl nginx requires a slight modification to the rpm command. I documented the process in this article.

Below is a proposed pkg_perzl_nginx-1.9.4-1.lst (not yet in repo) that works up to the last rpm (the nginx one). Again, details are in aforementioned article.

$ cat /QOpenSys/ibmichroot/pkg_perzl_nginx-1.9.4-1.lst
# Command:
#   > ./pkg_setup.sh pkg_perzl_nginx-1.9.4-1.lst
# Use:
#   > export PATH=/opt/freeware/bin:$PATH
#   > export LIBPATH=/opt/freeware/lib:$LIBPATH (if error, remove ':$LIBPATH')
#   > any_util (below)
# Contents:
# Other files:

#
# read file
#
:file
pkg_perzl_bash-4.3.lst

#
# rpm list
#
:rpm
http://www.oss4aix.org/download/everything/RPMS/bash-4.3-17.aix5.1.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/bzip2-1.0.5-3.aix5.3.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/expat-2.1.0-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/fontconfig-2.10.2-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/freetype2-2.5.5-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/gd-2.0.35-5.aix5.1.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/gdbm-1.11-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/GeoIP-1.5.1-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/gettext-0.10.40-8.aix5.2.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/glib2-2.34.3-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/info-5.1-2.aix5.1.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/libffi-3.2.1-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/libgcc-4.8.3-1.aix6.1.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/libgcrypt-1.6.3-1.aix5.2.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/libgpg-error-1.18-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/libiconv-1.14-2.aix5.1.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/libjpeg-9a-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/libpng-1.6.18-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/libxml2-2.9.2-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/libXpm-3.5.10-2.aix6.1.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/libxslt-1.1.28-2.aix5.1.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/openssl-1.0.1p-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/pcre-8.37-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/perl-5.8.8-2.aix5.1.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/pkg-config-0.28-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/readline-6.3-5.aix5.1.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/xorg-compat-aix-1.2-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/xz-libs-5.2.1-1.aix5.1.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/zlib-1.2.4-2.aix5.1.ppc.rpm
http://www.oss4aix.org/download/everything/RPMS/nginx-1.9.4-1.aix5.3.ppc.rpm

#Proposal I am guessing we will have more situations like this that require custom massaging during install. After thinking about it a bit I believe the most flexible solution will be to allow :sh sections to be processed in pkg_perzl_xxxxx.lst files. This way an customer shell command can be invoked in the order it is found.

For example:

:sh 
rpm --ignoreos --ignorearch --replacepkgs --nodeps -hUv --noscripts nginx-1.9.4-1.aix5.3.ppc.rpm

I haven't yet drawn up the changes to pkg_setup.sh because I wanted to wait for your input.

##Thoughts?

Comments (9)

  1. Former user Account Deleted

    Go ahead and experiment. If works, push it up.

    Hesitation ...

    1) i don't know what the global effect of hard coding --noscripts for everything.

    2) I thought :sh already worked, so what is changing for :sh?

  2. Aaron Bartell reporter

    1) i don't know what the global effect of hard coding --noscripts for everything.

    My (forthcoming) change wouldn't touch existing rpm code in pkg_setup.sh...

    note pkg_setup.sh doesn't currently support :sh. Instead it only supports :rpm and :file. I am proposing the addition of :sh. Guessing other chroot_setup.sh features might follow (i.e. :mkdir, :ln) but :sh is the only one I need right now.

    The pkg_perzl-nginx-xxxx.lst file would then look like the following. Note the lack of an :rpm line for the nginx rpm and instead it is done in :sh.

    :file
    pkg_perzl_bash-4.3.lst
    
    :rpm
    http://www.oss4aix.org/download/everything/RPMS/bzip2-1.0.5-3.aix5.3.ppc.rpm
    . . . extra lines suppressed for brevity . . .
    http://www.oss4aix.org/download/everything/RPMS/zlib-1.2.4-2.aix5.1.ppc.rpm
    
    :sh 
    rpm --ignoreos --ignorearch --replacepkgs --nodeps -hUv --noscripts nginx-1.9.4-1.aix5.3.ppc.rpm
    
  3. Former user Account Deleted

    Oh, well, you are not a good test case ...

    Part of the :rpm is the "download" from the web. You may have to introduce a new key work :wget perhaps ... argh getting ugly in here

    Back step ... do you know exactly why the rpm load hung ???

  4. Aaron Bartell reporter

    Part of the :rpm is the "download" from the web. You may have to introduce a new key work :wget perhaps ... argh getting ugly in here

    Or, for exceptions like this, we can just put wget in the :sh section:

    :sh 
    wget http://www.oss4aix.org/download/everything/RPMS/nginx-1.9.4-1.aix5.3.ppc.rpm
    rpm --ignoreos --ignorearch --replacepkgs --nodeps -hUv --noscripts nginx-1.9.4-1.aix5.3.ppc.rpm
    

    Back step ... do you know exactly why the rpm load hung ???

    No, but the issue has occurred on three separate machines. I figure we can't change the perzl rpm files so it would be best that we have means of massaging installs.

  5. Former user Account Deleted

    No, but the issue has occurred on three separate machines. I figure we can't change the perzl rpm files so it would be best that we have means of massaging installs.

    Cowards way out here ... we don't know what is going on ... so we invent something to make it never happen. I think we should understand what is happening.

  6. Former user Account Deleted

    Or, for exceptions like this, we can just put wget in the :sh section:

    Maybe ... but ... actually, we need something like it works today, aka, when rpm is already downloaded, it will not download again. Yes???

  7. Aaron Bartell reporter

    Cowards way out here ... we don't know what is going on ... so we invent something to make it never happen. I think we should understand what is happening.

    Agreed. I will see if I can get to it next week.

    Maybe ... but ... actually, we need something like it works today, aka, when rpm is already downloaded, it will not download again. Yes???

    If we added a :wget section, then yes, I would expect it to check if file already exists in current/local directory. If we add :sh and someone puts a raw wget in there then I would expect it to download regardless of whether the rpm already exists.

    Or if single-line-shell-ninjas are present they can do this:

    if [ ! -e nginx-1.9.4-1.aix5.3.ppc.rpm ]; then wget http://www.oss4aix.org/download/everything/RPMS/nginx-1.9.4-1.aix5.3.ppc.rpm; fi
    
  8. Former user Account Deleted

    Oh, i forgot to respond. I am ok with your change for single-line-shell-ninjas. That is, we should debug problems (general), but completely fine to introduce additional advanced functions for script ninjas (if work).

  9. Log in to comment