[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: /usr/bin/bash Failed dependency???



Circa 2003-01-31 10:37:34 -0800 dixit da_alchemist@yahoo.com:

: I am trying to install a custom RPM that merely untars
: and unzips a file and sets some symbolic links, but I
: keep getting
:
: #rpm -ivh --force myrpm-utl-1.0.0-1.i386.rpm
: error: failed dependencies:
:         /usr/bin/bash   is needed by myrpm-util
:
: What is this?  Is it a common error?  I don't have any
: "requires" clauses in my spec file and all the
: commands I use are fully qualified under my %post
: section.

This is caused because you have an executable script somewhere in your
package (i.e., a file caught by the %files section in the spec file)
which begins with:

  #!/usr/bin/bash

If this is a sample script that comes with the softawer in your
package, you can fix the problem by doing:

  chmod -x "${RPM_BUILD_ROOT}/wherever/the/script/is"

in the %install section.  If the script is needed for the operation of
the software package (and potentially, even if it's not) then you
should do one of two things in the %build section:

  (a) Change the "hash-bang" line in the file to wherever the 'bash'
      shell lives on your system.  For example:

        PATH="/bin:/usr/bin${PATH:+:${PATH}}"
        BASH=`which bash 2>/dev/null || type -p bash 2>/dev/null || :`
        if [ -n "${BASH}" ]; then
          echo "error: unable to find bash on '${PATH}'"
          exit 1
        fi
        cat SCRIPTFILE \
          |sed -e 's|^#![ \t]*/usr/bin/bash|#!'"${BASH}"'|' \
          >SCRIPTFILE.tmp \
          && mv -f SCRIPTFILE.tmp SCRIPTFILE

      Where '\t' is an actual tab character (i.e., [Control+V][Tab] in
      vi/vim, or [Control+Q][Tab] in emacs/xemacs/jed).

      Most Linux systems have bash living at /bin/bash, but this sort
      of thing will make your package "portable" in that it can be
      rebuilt and adapt to a system where bash is in a different spot
      (for example, FreeBSD).

      It's important to set the PATH in the spec file to avoid finding,
      for example, a symlink from /usr/bin/bash -> /bin/bash that's not
      included in the bash package, when your PATH="/usr/bin:/bin:...";
      likewise, it avoids finding ${HOME}/bin/bash in preference to
      /bin/bash when ${HOME}/bin is at the beginning of your PATH.

  (b) Alternately, change the "hash-bang" line in the script file as
      follows:

        cat SCRIPTFILE \
          |sed -e 's|^#![ \t]*/usr/bin/bash|#!/usr/bin/env bash|' \
          >SCRIPTFILE.tmp \
          && mv -f SCRIPTFILE.tmp SCRIPTFILE

      (where, again, '\t' is an actual tab character).

      This approach allows things to work even when bash is located in
      different spots on the system where the package is built and the
      system where it's installed.

      This is especially the recommended approach for non-shell
      interpreters such as perl or python.

      This is also easier than [a].  :)

Good luck.

--
jim knoble  |  jmknoble@pobox.com  |  http://www.pobox.com/~jmknoble/
(GnuPG fingerprint: 31C4:8AAC:F24E:A70C:4000::BBF4:289F:EAA8:1381:1491)
"I am non-refutable."  --Enik the Altrusian

Attachment: pgp00000.pgp
Description: PGP signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []