You are not logged in.
this is my first pkgbuild and everything works great, except the post_install stuff.
i want to export some variables in the post_install hook - the hook get called but the variables are not exported after install.
cd ~/abs
mkdir -p sun-jdk5-dlj/sun-jdk5-dlj && cd $_
cat >PKGBUILD <<\EOF
pkgname="sun-jdk5-dlj"
pkgver="21"
pkgrel=1
pkgdesc="Sun JDK 5.0"
arch=('i686')
url='http://java.sun.com'
source=( \
"http://download.java.net/dlj/binaries/jdk-5.0u${pkgver}-dlj-linux-i586.bin" \
)
conflicts=('java-environment' 'java-runtime')
provides=('java-environment=5' 'java-runtime=5')
license=('custom')
install="${pkgname}.install"
md5sums=( \
'36f1628264efaaebf70812cdafb27a52' \
)
build() {
cd ${startdir}
rm -rf jdk1.5.0_${pkgver}
sh jdk-5.0u${pkgver}-dlj-linux-i586.bin --accept-license --unpack
mkdir -p ${pkgdir}/opt/jdk
cp -R jdk1.5.0_${pkgver}/* ${pkgdir}/opt/jdk/
install -m755 -D ${startdir}/jdk.profile ${pkgdir}/etc/profile.d/jdk.sh
}
EOFcat >sun-jdk5-dlj.install <<\EOF
post_install() {
echo "*** post_install ***"
source /etc/profile.d/jdk.sh
}
EOFthe following exports should be executed after installation has been run.
cat >jdk.profile <<\EOF
export JAVA_HOME=/opt/jdk
export PATH=$PATH:$JAVA_HOME/bin
export MANPATH=$MANPATH:$JAVA_HOME/man
export JAVADIR=$JAVA_HOME
export JAVA_ROOT=$JAVA_HOME
export JAVA_BINDIR=$JAVA_HOME/bin
export JDK_HOME=$JAVA_HOME
export J2SDKDIR=$JAVA_HOME
export JRE_HOME=$JAVA_HOME/jre
export J2REDIR=$JRE_HOME
EOFany help would be really appreciated.
regards
jan
Last edited by jzimmek (2009-10-18 16:34:33)
Offline
Exporting variables means that they will exported to and become available in the environment of any subsequent child processes started by the current process. They will not magically become part of the environment of parent processes. (see help export).
Just tell you users to either relogin or to "source /etc/profile.d/jdk.sh in your current environment", which, in my case, would require me at least to shut down X, source the file in the text console I'm logged in to, and then to startx again in order to make those variables available to all my processes.
Last edited by hbekel (2009-10-18 16:26:36)
Offline
thanks for your fast and explaining answer.
Offline