Bug 535012 (RHQ-1752) - on Solaris and HP-UX (and AIX?), we can try to work around the missing readlink problem
Summary: on Solaris and HP-UX (and AIX?), we can try to work around the missing readli...
Keywords:
Status: CLOSED NEXTRELEASE
Alias: RHQ-1752
Product: RHQ Project
Classification: Other
Component: Launch Scripts
Version: unspecified
Hardware: All
OS: All
low
medium
Target Milestone: ---
: ---
Assignee: RHQ Project Maintainer
QA Contact:
URL: http://jira.rhq-project.org/browse/RH...
Whiteboard:
Depends On: jon30-bugs
Blocks: 1088032
TreeView+ depends on / blocked
 
Reported: 2009-03-10 13:01 UTC by John Mazzitelli
Modified: 2014-05-05 15:22 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-05-05 15:21:24 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 535784 0 medium CLOSED rhq-agent-wrapper.sh needs to be modified to work with SYSV init systems and chkconfig 2021-02-22 00:41:40 UTC
Red Hat Bugzilla 1088032 0 unspecified CLOSED Linux/Unix shell scripts attempt to use readlink even if it isn't installed/exist causing "readlink: not found" to be di... 2021-02-22 00:41:40 UTC

Internal Links: 535784 1088032

Description John Mazzitelli 2009-03-10 13:01:00 UTC
If readlink does not exist, we could recursively parse the output of ls -ld which, for symlinks, has the form "name ->  target".

Note that we don't want to assume /usr/bin - I would just leave those full paths out and assume that $PATH points to ls, expr, and dirname (since there might be those people that have those in /bin or /usr/local/bin or wherever).

# Resolve symlinks.
while [ -h "$PRG" ]; do
     ls=`/usr/bin/ls -ld "$PRG"`
     link=`/usr/bin/expr "$ls" : '^.*->  \(.*\)$'`
     if /usr/bin/expr "$link" : '^/'>  /dev/null; then
       prg="$link"
     else
       prg="`/usr/bin/dirname $PRG`/$link"
     fi
     PRG=`whence "$prg"`>  /dev/null 2>&1
     APPHOME=`/usr/bin/dirname "$PRG"`
done

(found this here: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4789162 )



Comment 1 Red Hat Bugzilla 2009-11-10 20:45:55 UTC
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-1752
This bug is related to RHQ-1391
This bug relates to RHQ-1520


Comment 2 wes hayutin 2010-02-16 17:08:11 UTC
mass add of key word FutureFeature to help track

Comment 3 Charles Crouch 2010-11-29 16:50:55 UTC
Similar suggestion has been done in JBAS:

http://old.nabble.com/Symlinks-and-JBoss-AS-.-bin-*.sh-scripts-td30324231.html#a30324231


Note You need to log in before you can comment on or make changes to this bug.