How to get running path in %pre script?
Yang, Shao-Hua (Yang shaohua,HPSW-BTO-R&D-SH)
shaohua.yang at hp.com
Fri Mar 4 04:24:19 UTC 2011
How to get running path in %pre script?
I have a spec like the below:
%define installPath /opt/discagnt
%define certFileName demo.cert
.........
%pre echo "starting to install.."
if [ -f ${"PWD"}/%cert_file ]
then
echo "The cert file exists!"
else
echo "please input the path for cert file : "
exec 6<&0 0</dev/tty
read cert_path
exec 0<&6 6<&-
if [ -f $cert_path/% ]
then
echo "The specified file $cert_path/%cert_file exists"
cp $cert_path/%cert_file %installPath
else
echo "The specified file $cert_path/%cert_file doesn't exist!"
exit 1
fi
fi
for example, if I run rpm like:
#pwd /tmp
#ls test.cert test.rmp
#rpm -i test.rmp
please input the path for cert file :
So, obviously, the script in %pre cann't locate the test.cert, I did some test, I found ${"PWD"} is / rather than /tmp
I want to get the current path ( /tmp) which the test.rmp located, Can somebody help me out about this issue?
thanks in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-list/attachments/20110304/438e9994/attachment.html>
More information about the Rpm-list
mailing list