You are not logged in.

#1 2003-09-22 21:08:41

terrapin
Member
From: Lockport, IL
Registered: 2003-08-06
Posts: 104

/usr/bin/opera needs editing after makepkg. [FXx]

I am trying to create a package for Opera 7.11.   Makepkg successfully builds a package and I am able to install it using Pacman.  Here's the problem.   When I try to run /usr/bin/opera I get this error

The Opera binary is not located at "/var/tmp/opera/pkg/usr/lib/opera/7.11-20030515.1/opera".
Please modify the wrapper script at "/usr/bin/opera".

How do I tell the /usr/bin/opera script to look for the files under /usr instead of the temporary build directory?  I know that I can manually edit /usr/bin/opera after I install the package but I am hoping to avoid this.

thanks,
joseph

Here is my PKGBUILD

pkgname=opera
pkgver=7.11
pkgrel=1
pkgdesc="Opera web browser"
url="www.opera.com"
source=(ftp://my.opera.com/pub/$pkgname/linux/711/final/en/i386/static/$pkgname-$pkgver-20030515.1-static-qt.i386.tar.gz)
                                                                                            
build() {
  cd $startdir/src/$pkgname-$pkgver-20030515.1-static-qt.i386
  ./install.sh --prefix=$startdir/pkg/usr
}

and here is the /usr/bin/opera script

#!/bin/sh

# Location of the Opera binaries
BINARYDIR=/var/tmp/opera/pkg/usr/lib/opera/7.11-20030515.1

# Parse commandline parameters
passflags=''
while test "$#" -gt 0; do
    case $1 in
    --binarydir*|-binarydir*)
        BINARYDIR="$2"
        shift
        ;;
    --) shift; break;;
    *)
        passflags="$passflags $1"
        ;;
    esac
    shift
done

if test ! -f ${BINARYDIR}/opera; then
    echo "The Opera binary is not located at "${BINARYDIR}/opera"."
    echo "Please modify the wrapper script at "${0}"."
    exit 1
elif test ! -x "${BINARYDIR}/opera"; then
    echo "You do not have execute rights on "${BINARYDIR}/opera", please ask the sysadmin to chmod +x it."
    exit 1
fi

# Opera enviroment
if test "${OPERA_DIR}" = '' ; then 
  if test -d /var/tmp/opera/pkg/usr/share/opera ; then 
    OPERA_DIR=/var/tmp/opera/pkg/usr/share/opera
  else
    echo "OPERA_DIR unset and not found at expected location (/var/tmp/opera/pkg/usr/share/opera)"
    exit 1
  fi
fi

# Native Java enviroment
if test -f "${HOME}/.opera/javapath.txt"; then
    INIJAVA=`cat ${HOME}/.opera/javapath.txt`
    if test -f "${INIJAVA}/libjava.so"; then OPERA_JAVA_DIR="${INIJAVA}"; fi
fi

if test ! "${OPERA_JAVA_DIR}"; then

    PREFIXES="
    /usr
    /usr/java
    /usr/lib
    /usr/local
    /opt"

    for SUNJAVA in 
    j2re1.4.1_01 
    j2re1.4.1 
    j2re1.4.0_01 
    j2sdk1.4.0_01/jre 
    j2re1.4.0 
    jre1.4.0 
    j2se/1.4/jre 
    j2se/1.3/jre 
    j2se/jre 
    jre1.3.1_02 
    jre1.3.1_01 
    j2re1.3.1 
    jre1.3.1 
    j2re1.3 
    ; do
    for PREFIX in ${PREFIXES}; do
        if test -f "${PREFIX}/${SUNJAVA}/lib/i386/libjava.so"; then OPERA_JAVA_DIR="${PREFIX}/${SUNJAVA}/lib/i386" && break; fi
    done
    if test "${OPERA_JAVA_DIR}"; then break; fi
    done

    if test ! "${OPERA_JAVA_DIR}"; then
    for IBMJAVA in 
        IBMJava2-14/jre 
        IBMJava2-131/jre 
        ; do
        for PREFIX in ${PREFIXES}; do
        if test -f "${PREFIX}/${IBMJAVA}/bin/libjava.so"; then OPERA_JAVA_DIR="${PREFIX}/${IBMJAVA}/bin" && break; fi
        done
    if test "${OPERA_JAVA_DIR}"; then break; fi
    done
    fi
fi

if test "${OPERA_JAVA_DIR}"; then
    LD_LIBRARY_PATH="${OPERA_JAVA_DIR}:${OPERA_JAVA_DIR}/native_threads:${OPERA_JAVA_DIR}/client:${OPERA_JAVA_DIR}/classic:${LD_LIBRARY_PATH}"
    export LD_LIBRARY_PATH
    # Uncomment the next lines to workaround the "preloaded libXt" problem.
    #LD_PRELOAD="${OPERA_JAVA_DIR}/libawt.so"
    #OPERA_FORCE_JAVA_ENABLED="1"
    #export LD_PRELOAD OPERA_FORCE_JAVA_ENABLED
fi

# Opera Plug-in enviroment, Add more plugin search paths here
# If OPERA_PLUGIN_PATH is set NPX_PLUGIN_PATH will be ignored

for DIR in 
    "${HOME}/.opera/plugins" 
    /var/tmp/opera/pkg/usr/lib/opera/plugins 
    /usr/lib/opera/plugins 
    /usr/local/lib/opera/plugins 
    /opt/lib/opera/plugins 
    /usr/local/Acrobat[45]/Browsers/intellinux 
    /usr/lib/Acrobat[45]/Browsers/intellinux 
    /usr/X11R6/lib/Acrobat[45]/Browsers/intellinux 
    /opt/Acrobat[45]/Browsers/intellinux 
    /usr/Acrobat[45]/Browsers/intellinux 
    /usr/j2se/jre/plugin/i386/ns4 
    /usr/java/jre1.4.0/plugin/i386/ns4 
    /usr/java/jre1.3.1/plugin/i386/ns4 
    /usr/lib/j2re1.3/plugin/i386/netscape4 
    /usr/local/jdk1.3.1/jre/plugin/i386/ns4 
    /usr/local/linux-jdk1.3.1/jre/plugin/i386/ns4 
    /usr/lib/RealPlayer8/Plugins 
    /usr/lib/realplay/plugins 
    /usr/lib/RealPlayer8 
    /usr/lib/realplay 
    "${HOME}/.netscape/plugins" 
    /opt/netscape/plugins 
    /usr/lib/netscape/plugins 
    /usr/local/netscape/plugins 
    /usr/local/lib/netscape/plugins 
    ; do
    if test -d ${DIR} ; then OPERA_PLUGIN_PATH="${OPERA_PLUGIN_PATH}":"${DIR}"; fi
done

# Opera does not support Mozilla plugins, only Opera and Netscape plugins.
# Since Mozilla supports NS plugins, there might be some in the Mozilla plugin
# directory. Perhaps add below paths to list above
# /usr/X11R6/lib/mozilla/plugins


# Acrobat Reader
for BINDIR in 
    /usr/local/Acrobat[45]/bin 
    /usr/lib/Acrobat[45]/bin 
    /usr/X11R6/lib/Acrobat[45]/bin 
    /opt/Acrobat[45]/bin 
    /usr/Acrobat[45]/bin 
    ; do
    if test -d ${BINDIR} ; then PATH=${PATH}:${BINDIR}; fi
done

OPERA_PLUGIN_PATH="${OPERA_PLUGIN_PATH}":"${NPX_PLUGIN_PATH}"
 
# Exporting the enviroment
export OPERA_DIR OPERA_PLUGIN_PATH PATH

# Running Opera
"${BINARYDIR}/opera" --binarydir "${BINARYDIR}" $passflags "${@}"

Offline

#2 2003-09-22 21:20:44

sarah31
Member
From: Middle of Canada
Registered: 2002-08-20
Posts: 2,975
Website

Re: /usr/bin/opera needs editing after makepkg. [FXx]

edit this line :



BINARYDIR=/var/tmp/opera/pkg/usr/lib/opera/7.11-20030515.1

you can do it with sed after the last command in the pkgbuild something like:

sed -e "s|BINARYDIR=/var/tmp/opera/pkg/usr/lib/opera/7.11-20030515.1|BINARYDIR=/usr/bin/|g" <filename you want to edit>

if that doesn't work you may have to play with the command a bit until it does.

btw i would put opera in /opt/opera


AKA uknowme

I am not your friend

Offline

#3 2003-09-22 23:43:37

terrapin
Member
From: Lockport, IL
Registered: 2003-08-06
Posts: 104

Re: /usr/bin/opera needs editing after makepkg. [FXx]

With your suggestion I was able to get it working big_smile  I also changed the directory to /opt/opera.

here's the updated version hopefully someone finds it useful

pkgname=opera
pkgver=7.11
pkgrel=0.1
pkgdesc="Opera web browser."
url="www.opera.com"
source=(ftp://my.opera.com/pub/opera/linux/711/final/en/i386/static/$pkgname-$pkgver-20030515.1-static-qt.i386.tar.gz)

build() {
  cd $startdir/src/$pkgname-$pkgver-20030515.1-static-qt.i386
  ./install.sh --prefix=$startdir/pkg/opt/opera
  sed -i "s|/var/tmp/opera/pkg/opt|/opt|g" $startdir/pkg/opt/opera/bin/opera
}

Offline

Board footer

Powered by FluxBB